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__/rm.cpython-312.pyc
�

��8)��0�dZddlmZddlmZddlmZddlZddlmZddlmZ	ddl
mZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZej8Gd�dej:��Zy)z4Implementation of rm command for deleting resources.�)�absolute_import)�division)�unicode_literalsN)�	cloud_api)�errors)�base)�flags)�folder_util)�name_expansion)�plurality_checkable_iterator)�rm_command_util)�stdin_iterator)�user_request_args_factory)�
task_executor)�task_graph_executor)�task_status)�delete_task_iterator_factory)�logc�0�eZdZdZddd�Zed��Zd�Zy)�RmzDelete objects and buckets.z)
      Delete objects and buckets.
      a�

      The following command deletes a Cloud Storage object named ``my-object''
      from the bucket ``my-bucket'':

        $ {command} gs://my-bucket/my-object

      The following command deletes all objects directly within the directory
      ``my-dir'' but no objects within subdirectories:

        $ {command} gs://my-bucket/my-dir/*

      The following command deletes all objects and subdirectories within the
      directory ``my-dir'':

        $ {command} gs://my-bucket/my-dir/**

      Note that for buckets that contain
      [versioned objects](https://cloud.google.com/storage/docs/object-versioning),
      the above command only affects live versions. Use the `--recursive` flag
      instead to delete all versions.

      The following command deletes all versions of all resources in
      ``my-bucket'' and then deletes the bucket.

        $ {command} --recursive gs://my-bucket/

      The following command deletes all text files in the top-level of
      ``my-bucket'', but not text files in subdirectories:

        $ {command} -recursive gs://my-bucket/*.txt

      The following command deletes one wildcard expression per line passed
      in by stdin:

        $ some_program | {command} -I
      )�DESCRIPTION�EXAMPLESc�T�|jddd��|jddddd	�
�|jdddd
�
�|jdddd��tj|�tj|�tj|�tj
|�y)N�urls�*z$The URLs of the resources to delete.)�nargs�helpz--recursivez-Rz-r�
store_trueadRecursively delete the contents of buckets or directories that match the path expression. By default, this will delete managed folders as well. If the path is set to a bucket, like ``gs://bucket'', the bucket is also deleted. This option implies the `--all-versions` option. If you want to delete only live object versions, use the ``**'' wildcard instead.)�actionrz--all-versionsz-az\Delete all [versions](https://cloud.google.com/storage/docs/object-versioning) of an object.z--exclude-managed-foldersFaExcludes managed folders from command operations. By default gcloud storage includes managed folders in recursive removals. Please note that this flag would not be applicable for hierarchical namespace buckets as we always list managed folders for these buckets.)r�defaultr)�add_argumentr	�add_additional_headers_flag�add_continue_on_error_flag�add_precondition_flags�add_read_paths_from_stdin_flag)�cls�parsers  �lib/surface/storage/rm.py�ArgszRm.ArgsYs���
�����
3��5��������
F�
���������	�����#���
"���
�%�%�f�-�	�$�$�V�,�	� � ��(�	�(�(��0�c���|jrOtjj}tj
j}tjj}nItjj}tj|�}tjj}|jxr
|j}tj�}tjt!j"|j$|j&�tj(j*|t,j.j0t,j2j4||j||��	}t7j8|�}t:j<j?�}	tAjB||	|��}
tDjFjId�tKjL|
jO�d|	tQjRtPjTjVd��|jX��}|jrWtj|j$t,j2jZ|||��}	t]j^||	d��}
nd}
|rptj|j$t,j.jjddtjj|�
�}	t]jl|||	d��}nd}tojp|
js��}|jr�|ju�sqtDjFjId�tKjL|d|	tQjRtPjTjVd��|jX��}nd}tw|||
|�|_<y#t`jb$r<}|jdjfd	k7r�tEjhd
�d}
Yd}~���d}~wwxYw#t`jb$r<}|jdjfd	k7r�tEjhd�d}Yd}~��bd}~wwxYw)N)�fields_scope�include_buckets�managed_folder_setting�folder_setting�object_state�raise_error_for_unmatched_urls�recursion_requested�url_found_match_tracker)�task_status_queue�user_request_argszRemoving objects:T)�increment_type�
manifest_path)�parallelizabler4�progress_manager_args�continue_on_error)r/r1r2r3)�verbosei�z4Unable to delete folders due to missing permissions.rF)r.r1�(raise_managed_folder_precondition_errorsr2r3z<Unable to delete managed folders due to missing permissions.zRemoving buckets:)=�	recursiver�
BucketSetting�YESr�ObjectState�LIVE_AND_NONCURRENT�RecursionSetting�NOr	�get_object_state_from_flags�NO_WITH_WARNING�exclude_managed_folders�collections�OrderedDict�NameExpansionIteratorr�get_urls_iterabler�read_paths_from_stdin�FieldsScope�SHORTr
�ManagedFolderSetting�DO_NOT_LIST�
FolderSetting�LIST_AS_PREFIXESr�'get_user_request_args_from_command_argsr�multiprocessing_context�Queuer�DeleteTaskIteratorFactoryr�status�Printr�
execute_tasks�object_iteratorr�ProgressManagerArgs�
IncrementType�INTEGERr:�LIST_AS_FOLDERSr
�remove_folders�
api_errors�GcsApiError�payload�status_code�warning�LIST_WITHOUT_OBJECTS�remove_managed_foldersr�PluralityCheckableIterator�bucket_iterator�is_empty�max�	exit_code)�self�args�bucket_settingr0�recursion_setting�(should_perform_managed_folder_operationsr3�name_expansion_iteratorr5r4�task_iterator_factory�object_exit_code�folder_expansion_iterator�folder_exit_code�error�!managed_folder_expansion_iterator�managed_folder_exit_coderg�bucket_exit_codes                   r(�RunzRm.Run�s����~�~�%�3�3�7�7�n��*�*�>�>�l�(�9�9�=�=��%�3�3�6�6�n��6�6�t�<�l�(�9�9�I�I��	
���;�t�;�;�;�-�*�5�5�7��-�B�B��(�(����D�4N�4N�O��*�*�0�0�&�*�?�?�K�K�"�0�0�A�A�!�+/�>�>�'9�-� 7�
��	"�I�I�$�O��+�C�C�I�I�K��$�>�>�#�/�/�	1���J�J���(�)�$�2�2��-�-�/��+�)�=�=�&�4�4�<�<�D�
��0�0����~�~�"0�"F�"F�
�)�)�$�2�2�B�B�-U�)U�/�"9�#���*�9�9�%���
����/�*8�*N�*N�
�)�)�!,�!A�!A�!V�!V�)-�49�,�=�=�A�A�"9�
+�'�%�#2�#I�#I��-���	$
� �"#��2�M�M��-�-�/��O�
�~�~�o�6�6�8�	�j�j���*�+�&�4�4�
��-� +� ?� ?�(�6�6�>�>� �!�!�2�2�	������ ���	�D�N��w�
#�
#���=�=�$�$��+�
����J�K������8�
#�
#�%��=�=�$�$��+�
����J�	
�$%� ��%�s0�O�3P'�P$�(1P�P$�'Q6�:1Q1�1Q6N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�classmethodr)ry�r*r(rr(s2��#�
�$
�
+�-�Z�,1��,1�\Hr*r)r}�
__future__rrrrG�googlecloudsdk.api_lib.storagerrr_�googlecloudsdk.callioper�"googlecloudsdk.command_lib.storager	r
rrr
rr�(googlecloudsdk.command_lib.storage.tasksrrr�+googlecloudsdk.command_lib.storage.tasks.rmr�googlecloudsdk.corer�UniverseCompatible�Commandrr�r*r(�<module>r�sk��;�&��'��4�?�(�4�:�=�K�>�=�H�B�H�@�T�#����g����g��gr*