
    #              	       x   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \	R&                  \	R(                  " SSS9\	R*                  \	R,                  " \	R.                  R0                  5       " S S\	R2                  5      5       5       5       5       rg)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                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Delete!   z)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                     U R                  SSSS9  U R                  SSSS9  U R                  S	[        S
SSS9  [        R                  " U 5        g )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.)actionr   z--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ArgsDelete.Args`   sv    
P  Q
 $  %
 ;  = 
%%f-    c           	         UR                   =(       d    S/n[        R                  " 5       nUR                  U5      u  pEU(       a(  UR                  (       d  [
        R                  " SS5      e/ n/ nU Ha  n[        R                  R                  USS9n	U	R                  (       d  UR                  U	R                  5        UR                  US-   5        Mc     UR                  U5      u  pUR                  U
5        / n[        U5       HE  nUR                  [        R                   " [        R                  R                  U5      5      5        MG     U(       a\  ["        R$                  " S5        SnUS	R'                  U Vs/ s H  oR(                  PM     sn5      -  n[*        R,                  " USSS
9  SnUSR'                  U Vs/ s H  nS	UR/                  5       -   PM     sn5      -  nUSR'                  U Vs/ s H   nS	UR0                  R/                  5       -   PM"     sn5      -  n[*        R,                  " USSS
9  [        R2                  " XR4                  SS9  ["        R6                  R9                  SR;                  [=        U5      [=        U5      S:  a  SOS5      5        [>        R@                  " 5       nU H7  nURC                  U5        ["        RD                  " UR/                  5       SS9  M9     g s  snf s  snf s  snf )Nzgs://r   zBSource 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: zDeleting Files)num_threadsprogress_bar_labelzDeleted [{}] file{}.
   sbucket)kind)#r   r
   GCSPathExpanderExpandPaths	recursiver	   RequiredArgumentExceptionr   ObjectReferenceFromUrlnameappend
bucket_refupdatesortedr   ObjectDeleteTaskr   r   joinr4   r   PromptContinueToUrlobj_refExecuteTasksr0   statuswriteformatlenr   StorageClientDeleteBucketDeletedResource)selfargspathsexpanderobjectsdirsbuckets	dir_pathsdrE   sub_objects_tasksor,   btstorage_clients                     r&   Run
Delete.Runu   s   II"'E((*H((/MGDNN00

NP P GI,,44Q44Pg\\w))*q4x 	 
 )))4NKNN;EG_ll#44

&
&
.
.q
13 4  	kk 8 9Eg81hh899gt$H 7GrwwG<Gq*G<==GrwwEBEq!22EBCCGTF !!%5E5E5EGJJ ''Js5zA~2	78 !..0N!!!$	!'')(3 % 9 =Bs   K?
L
>'L	
 N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr'   r^   __static_attributes__r`   r)   r&   r   r   !   s2     2

.
5-n . .(24r)   r   N)re   
__future__r   r   r   googlecloudsdk.api_lib.storager   r   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.storager
   r   r   googlecloudsdk.corer   googlecloudsdk.core.consoler   Hidden	DeprecateUniverseCompatibleReleaseTracksReleaseTrackALPHACommandr   r`   r)   r&   <module>rv      s     - &  ' 6 7 ( . 8 4 ? # 2 5 +9 :D%%++,A4T\\ A4 - : 
A4r)   