
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dZdez   dz   Z G d de	      Zy)z@Implementation of rb command for deleting cloud storage buckets.    )absolute_import)print_function)division)unicode_literals)NotEmptyException)Command)CommandArgument)ApiSelector)CommandException)NO_URLS_MATCHED_TARGET)StorageUrlFromString)NO_MAX)GcloudStorageFlag)GcloudStorageMapz(
  gsutil rb [-f] gs://<bucket_name>...
z
<B>SYNOPSIS</B>
a  


<B>DESCRIPTION</B>
  Delete one or more buckets. Buckets must be empty before you can delete them.

  Be certain you want to delete a bucket before you do so, as once it is
  deleted the name becomes available and another user may create a bucket with
  that name. (But see also "DOMAIN NAMED BUCKETS" under "gsutil help naming"
  for help carving out parts of the bucket name space.)


<B>OPTIONS</B>
  -f          Continues silently (without printing error messages) despite
              errors when removing buckets. If some buckets couldn't be removed,
              gsutil's exit status will be non-zero even if this flag is set.
              If no buckets could be removed, the command raises a
              "no matches" error.
c                      e Zd ZdZ ej
                  dg dededdddej                  ej                  gej                   ej                         g      Z ej                  dg dd	d
ei       Z eg dd ed      i      Zd Zy)	RbCommandz$Implementation of gsutil rb command.rb)deletebucketremovebucketremovebucketsrmdir   fFr   )command_name_aliasesusage_synopsismin_argsmax_argssupported_sub_argsfile_url_okprovider_url_okurls_start_arggs_api_supportgs_default_apiargparse_argumentscommand_helpzRemove buckets)	help_namehelp_name_aliases	help_typehelp_one_line_summary	help_textsubcommand_help_text)storagebucketsdelete-fz--continue-on-error)gcloud_commandflag_mapc                 (   d| _         | j                  r!| j                  D ]  \  }}|dk(  sd| _          d}d}| j                  D ]  }t        |      }|j	                         rt        d      	 t        | j                  |      j                  dg            }|D ]^  }|j                  }	| j                  j                  d|	       	 | j                  j                  |	j                  |	j                         d}`  |s%t        t$        t        | j                        z        |rdS dS #  d}| j                   rY  xY w# t         $ r5}
d}| j                   rY d	}
~
d
|
j"                  v rt        d|	z         d	}
~
w d}| j                   s Y xY w)z'Command entry point for the rb command.Fr/   Tz."rb" command requires a provider or bucket URLid)bucket_fieldszRemoving %s...)providerNVersionedBucketNotEmptyzqBucket is not empty. Note: this is a versioned bucket, so to delete all objects
you need to use:
	gsutil rm -r %sr   r   )continue_on_errorsub_optsargsr   IsObjectr   listWildcardIteratorIterBucketsstorage_urlloggerinfo
gsutil_apiDeleteBucketbucket_nameschemer   reasonr   )selfounused_adid_some_worksome_failedurl_strwildcard_urlblrsblrurles              $platform/gsutil/gslib/commands/rb.py
RunCommandzRbCommand.RunCommandn   s   "D}}+!X9#'$
  ' MK99)'2l				   , - 	-
 !!'*66dV6LN #oo)3/	
//
&
&s
&
L  ) / X 3d499oEFF1"";!!

 ! 
	+##(AHH4" $9 <?$? @ @
 	+'' (s0   /+D,1E,D?>D?	FE;E;;FN)__name__
__module____qualname____doc__r   CreateCommandSpec	_SYNOPSISr   r
   XMLJSONr	   %MakeZeroOrMoreCloudBucketURLsArgumentcommand_specHelpSpec_DETAILED_HELP_TEXT	help_specr   r   gcloud_storage_maprR        rQ   r   r   <   s    , +**
 
//


 !%%
?/
?
?
A),2 g ,#) (5
!"788#rb   r   N)rV   
__future__r   r   r   r   gslib.cloud_apir   gslib.commandr   gslib.command_argumentr	   gslib.cs_api_mapr
   gslib.exceptionr   r   gslib.storage_urlr   gslib.utils.constantsr   gslib.utils.shim_utilr   r   rX   r^   r   ra   rb   rQ   <module>rl      sd    G & %  ' - ! 2 ( , 2 2 ( 3 2	 .j# j#rb   