HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/storage/__pycache__/delete.cpython-312.pyc
�

��#�	�~�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZe	j&e	j(dd��e	j*e	j,e	j.j0�Gd�de	j2�����Zy)z&Command to list Cloud Storage objects.�)�absolute_import)�division)�unicode_literals)�storage_api)�storage_util)�base)�
exceptions)�	expansion)�flags)�storage_parallel)�log)�
console_ioFzBThis command is deprecated. Use `gcloud alpha storage rm` instead.)�
is_removed�warningc�0�eZdZdZddd�Zed��Zd�Zy)�Deletez)Delete Cloud Storage objects and buckets.z�      *{command}* lets you delete Cloud Storage objects and buckets. You can
      specify one or more paths (including wildcards) and all matching objects
      and buckets will be deleted.
      a~      To delete an object, run:

        $ *{command}* gs://mybucket/a.txt

      To delete all objects in a directory, run:

        $ *{command}* gs://mybucket/remote-dir/*

      The above command will delete all objects under remote-dir/ but not its sub-directories.

      To delete a directory and all its objects and subdirectories, run:

        $ *{command}* --recursive gs://mybucket/remote-dir
        $ *{command}* gs://mybucket/remote-dir/**

      To delete all objects and subdirectories of a directory, without deleting the directory
      itself, run:

        $ *{command}* --recursive gs://mybucket/remote-dir/*

        or

        $ *{command}* gs://mybucket/remote-dir/**

      To delete all objects and directories in a bucket without deleting the bucket itself, run:

        $ *{command}* gs://mybucket/**

      To delete all text files in a bucket or a directory, run:

        $ *{command}* gs://mybucket/*.txt
        $ *{command}* gs://mybucket/remote-dir/*.txt

      To go beyond directory boundary and delete all text files in a bucket or a directory, run:

        $ *{command}* gs://mybucket/**/*.txt
        $ *{command}* gs://mybucket/remote-dir/**/*.txt

      To delete a bucket, run:

        $ *{command}* gs://mybucket

      You can use wildcards in bucket names. To delete all buckets with prefix of `my`, run:

        $ *{command}* --recursive gs://my*
      )�DESCRIPTION�EXAMPLESc��|jddd��|jddd��|jd	td
dd�
�tj|�y)N�path�+z}The path of objects and directories to delete. The path must begin with gs:// and may or may not contain wildcard characters.)�nargs�help�--recursive�
store_truezRRecursively delete the contents of any directories that match the path expression.)�actionrz
--num-threadsT�z,The number of threads to use for the delete.)�type�hidden�defaultr)�add_argument�intr�add_additional_headers_flag)�parsers �lib/surface/storage/delete.py�ArgszDelete.Args`sv��
�����P��Q�
�����$��%�
����
���
;��=�
�%�%�f�-�c	���|jxsdg}tj�}|j|�\}}|r"|jstjdd��g}g}|D]^}tjj|d��}	|	js|j|	j�|j|dz��`|j|�\}
}|j|
�g}t|�D]C}
|jtj tjj|
����E|r[t#j$d�d}|d	j'|D�cgc]}|j(��c}�z
}t+j,|dd�
�d}|dj'|D�cgc]}d	|j/�z��c}�z
}|dj'|D�cgc]}d	|j0j/�z��!c}�z
}t+j,|dd�
�tj2||j4d
��t"j6j9dj;t=|�t=|�dkDrdnd��t?j@�}|D]8}|jC|�t#jD|j/�d���:ycc}wcc}wcc}w)Nzgs://rzBSource path matches directories but --recursive was not specified.T)�allow_empty_objectz**z[Deleting a bucket is irreversible and makes that bucket name available for others to claim.z2This command will delete the following buckets:
  z
  )�message�throw_if_unattended�cancel_on_noz&You are about to delete the following:�zDeleting Files)�num_threads�progress_bar_labelzDeleted [{}] file{}.
��s�bucket)�kind)#rr
�GCSPathExpander�ExpandPaths�	recursiver	�RequiredArgumentExceptionr�ObjectReference�FromUrl�name�append�
bucket_ref�update�sortedr�ObjectDeleteTaskr
r�joinr2r�PromptContinue�ToUrl�obj_ref�ExecuteTasksr.�status�write�format�lenr�
StorageClient�DeleteBucket�DeletedResource)�self�args�paths�expander�objects�dirs�buckets�	dir_paths�drC�sub_objects�_�tasks�or*�b�t�storage_clients                  r%�Runz
Delete.Runus����I�I�"�'��E��(�(�*�H��(�(��/�M�G�T��D�N�N��0�0�
�
N�
P�P��G��I�
���,�,�4�4�Q�4�4�P�g�
�\�\����w�)�)�*����q�4�x� �	�
�)�)�)�4�N�K���N�N�;���E�
�G�_���l�l�#�4�4�
�
&�
&�
.�
.�q�
1�3�4���	�k�k�8�9�E�g�
�����8��1�a�h�h��8�9�9�g�����t�$�H�7�G��r�w�w�G�<�G�q������*�G�<�=�=�G��r�w�w�E�B�E�q�������!2�2�E�B�C�C�G�����T��F��!�!�%�T�5E�5E�5E�G��J�J��� �'�'���J�s�5�z�A�~��2�	7�8�!�.�.�0�N�
���!�!�!�$�	���!�'�'�)�(�3���%9��=��Bs�&K 
�,K%
�$K*
N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�staticmethodr&r\�r'r%rr!s2��2�
�
.
�
5�-�n�.��.�(24r'rN)r`�
__future__rrr�googlecloudsdk.api_lib.storagerr�googlecloudsdk.callioperr	�"googlecloudsdk.command_lib.storager
rr�googlecloudsdk.corer
�googlecloudsdk.core.consoler�Hidden�	Deprecate�UniverseCompatible�
ReleaseTracks�ReleaseTrack�ALPHA�Commandrrcr'r%�<module>rqs��� -�&��'�6�7�(�.�8�4�?�#�2��������5�+9�:��������D�%�%�+�+�,�A4�T�\�\�A4�-��:�
�
A4r'