
                             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  Sr\R&                   " S S\R(                  5      5       rg)z4Implementation of create command for making buckets.    )absolute_import)division)unicode_literals)arg_parsers)base)errors)errors_util)flags)storage_url)user_request_args_factory)resource_reference)create_bucket_taskad  
Sets the lifecycle management configuration on a bucket. For example,
The following lifecycle management configuration JSON document
specifies that all objects in this bucket that are more than 365 days
old are deleted automatically:

  {
    "rule":
    [
      {
        "action": {"type": "Delete"},
        "condition": {"age": 365}
      }
    ]
  }
c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Create1   z#Create buckets for storing objects.z!
      Create new buckets.
      a  

      The following command creates 2 Cloud Storage buckets, one named
      ``my-bucket'' and a second bucket named ``my-other-bucket'':

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

      The following command creates a bucket with the ``nearline'' default
      [storage class](https://cloud.google.com/storage/docs/storage-classes) in
      the ``asia'' [location](https://cloud.google.com/storage/docs/locations):

        $ {command} gs://my-bucket --default-storage-class=nearline --location=asia
      )DESCRIPTIONEXAMPLESc           
         UR                  S[        SSS9  UR                  SS[        [        R                  " SSS	9S
S9  UR                  SS[        R                  SS9  UR                  SS[        R                  SS9  UR                  SSS[        SS9  UR                  SS[        SS9  UR                  SSS9  [
        R                  " U5        UR                  S[        R                  " 5       SS9  [
        R                  " U5        [
        R                  " U5        [
        R                  " U5        [
        R                  " U5        UR                  S S!S S"S#9  UR                  S$[        S9  [
        R                  " U5        g )%Nurl+z"The URLs of the buckets to create.)typenargshelpz
--locationz-lFT)default_universenon_default_universez[Location](https://cloud.google.com/storage/docs/locations) for the bucket. If not specified, the location used by Cloud Storage is ``us''. A bucket's location cannot be changed after creation.)r   requiredr   z--public-access-preventionz--papzSets public access prevention to "enforced". For details on how exactly public access is blocked, see: http://cloud.google.com/storage/docs/public-access-prevention)actionr   z--uniform-bucket-level-accessz-bz?Turns on uniform bucket-level access setting. Default is False.z--default-storage-classz-cz-szDefault [storage class](https://cloud.google.com/storage/docs/storage-classes) for the bucket. If not specified, the default storage class used by Cloud Storage is "Standard".)r   r   z--default-encryption-keyz-kzSet the default KMS key using the full path to the key, which has the following form: ``projects/[project-id]/locations/[location]/keyRings/[key-ring]/cryptoKeys/[my-key]''.z--retention-periodao  Minimum [retention period](https://cloud.google.com/storage/docs/bucket-lock#retention-periods) for objects stored in the bucket, for example ``--retention-period=P1Y1M1DT5S''. Objects added to the bucket cannot be deleted until they've been stored for the specified length of time. Default is no retention period. Only available for Cloud Storage using the JSON API.)r   z--soft-delete-durationzDuration to retain soft-deleted objects. For example, "2w1d" is two weeks and one day. See `gcloud topic datetimes` for more information on the duration format. Setting `0` will disable soft delete policy on the bucket. Default is 7 days.z--enable-hierarchical-namespace
store_truezoEnable hierarchical namespace for the bucket. To use this flag, you must also use --uniform-bucket-level-access)r   defaultr   z--lifecycle-file)add_argumentstrr   ArgRequiredInUniverseStoreTrueFalseActionr
   add_placement_flagDurationadd_additional_headers_flagadd_autoclass_flags$add_enable_per_object_retention_flag!add_recovery_point_objective_flag_LIFECYCLE_HELP_TEXTadd_ip_filter_file_flag)clsparsers     %lib/surface/storage/buckets/create.pyArgsCreate.ArgsH   s   
Cs)M   22"
   $//M  	 '//N	   !4   "f  	 5   
V$
 !!#D	  	 
%%f-	f%	..v6	++F3
)E   *1EF	!!&)    c                    UR                    H  n[        R                  " U5      n[        R                  " UR
                  U5        [        R                  " U5      n[        R                  " U[        R                  R                  S9nUR                  R                   b1  UR                  R                  (       d  [        R                   " S5      e["        R$                  " XES9R'                  5         M     g )N)metadata_typezP--autoclass_terminal_storage_class is only allowed if --enable-autoclass is set.)user_request_args)r   r   storage_url_from_stringr	   raise_error_if_not_bucketcommand_pathr   UnknownResourcer   'get_user_request_args_from_command_argsMetadataTypeBUCKETresource_args autoclass_terminal_storage_classenable_autoclassr   Errorr   CreateBucketTaskexecute)selfargs
url_stringr   resourcer4   s         r.   Run
Create.Run   s    hh
//
;c++D,=,=sC#33C8h
#
K
K";"H"H"O"O  
)
)
J
J#11BBll*
 	
 ))
	) r1    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr/   rF   __static_attributes__rH   r1   r.   r   r   1   s2    +

	-& _* _*Br1   r   N)rM   
__future__r   r   r   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.storager   r	   r
   r   r   ,googlecloudsdk.command_lib.storage.resourcesr   0googlecloudsdk.command_lib.storage.tasks.bucketsr   r*   UniverseCompatibleCommandr   rH   r1   r.   <module>rX      s^    ; &  ' / ( 5 : 4 : H K O $ MT\\ M Mr1   