
    	                         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
 ej                   G d d	ej                               Zy
)zCImplementation of create command for making folders in HNS buckets.    )api_factory)base)errors_util)flags)storage_url)logc                   0    e Zd ZdZdddZed        Zd Zy)Createz1Create folders for hierarchical namespace bucket.zCreate folders.aA  
      The following command creates a folder called `folder/` in a bucket
      named `my-bucket`:

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

      The following command creates all folders in the path `A/B/C/D` in a
      bucket named `my-bucket`:

        $ {command} --recursive gs://my-bucket/folder/A/B/C/D
      )DESCRIPTIONEXAMPLESc                     | j                  dt        dd       | j                  ddd       t        j                  |        y	)
z2Adds arguments specific to this command to parser.url+z"The URLs of the folders to create.)typenargshelpz--recursive
store_truezLRecursively create all folders in a given path if they do not alraedy exist.)actionr   N)add_argumentstrr   add_additional_headers_flag)parsers    %lib/surface/storage/folders/create.pyArgszCreate.Args-   sQ     Cs)M   	   
%%f-    c                    g }|j                   D ]I  }t        j                  |      }t        j                  |j
                  |d       |j                  |       K |D ]  }t        j                  |j                        }t        j                  j                  dj                  |             |j                  |j                  |j                   |j"                          y )NfolderzCreating {}...)r   r   storage_url_from_stringr   "raise_error_if_not_gcs_folder_typecommand_pathappendr   get_apischemer   statusPrintformatcreate_folderbucket_nameresource_name	recursive)selfargsurls
url_stringr   clients         r   Runz
Create.Run@   s    Dhh
//
;c44


S( kk#  ""3::.f	jj'..s343??C,=,=t~~N r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r0    r   r   r
   r
      s0    9 '

- . .$Or   r
   N)r4   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   r   r   googlecloudsdk.corer   DefaultUniverseOnlyCommandr
   r7   r   r   <module>r>      sG    J 7 ( : 4 : # 1OT\\ 1O 1Or   