
                         >   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.                  " \R0                  R2                  \R0                  R4                  5       " S S\R6                  5      5       rg)z+Command to create a Dataplex zone resource.    )absolute_import)division)unicode_literals)util)zone)
exceptions)base)flags)resource_args)	arg_utils)labels_util)logc                   `    \ rS rSrSrSS0r\S 5       r\R                  " S5      S 5       r
Srg	)
Create    a  Create a zone.

A zone represents a logical group of related assets within a lake. A zone can
be used to map to organizational structure or represent stages of data
readiness from raw to curated. It provides managing behavior that is shared
or inherited by all contained assets.

The Zone ID is used to generate names such as database and dataset names
when publishing metadata to Hive Metastore and BigQuery.
 * Must contain only lowercase letters, numbers, and hyphens.
 * Must start with a letter.
 * Must end with a number or a letter.
 * Must be between 1-63 characters.
 * Must be unique across all lakes from all locations in a project.
EXAMPLESa            To create a Dataplex zone with name `test-zone` within lake
          `test-lake` in location `us-central1` with type `RAW`, and resource
          location type `SINGLE_REGION`, run:

            $ {command} test-zone --location=us-central --lake=test-lake --resource-location-type=SINGLE_REGION --type=RAW

          To create a Dataplex zone with name `test-zone` within lake
          `test-lake` in location `us-central1` with type `RAW`,resource
          location type `SINGLE_REGION` with discovery-enabled and discovery
          schedule `0 * * * *`, run:

            $ {command} test-zone --location=us-central --lake=test-lake --resource-location-type=SINGLE_REGION --type=RAW --discovery-enabled --discovery-schedule="0 * * * *"

          c                    [         R                  " U S5        U R                  SSSSS9  U R                  SSS	9  U R                  S
SS	9  U R                  SSSS.[        R                  SSS9  [
        R                  " U 5        U R                  SSS9nUR                  SSSS.[        R                  SSS9  [        R                  R                  U 5        [        R                  " U 5        g )Nz
to create.z--validate-only
store_trueFz:Validate the create action, but don't actually perform it.)actiondefaulthelpz--descriptionzDescription of the zone.)r   z--display-namezDisplay name of the zone.z--typezA zone that contains data that needs further processing
                   before it is considered generally ready for consumption and
                   analytics workloads.aX  A zone that contains data that is considered to be ready for
                   broader consumption and analytics workloads. Curated
                   structured data stored in Cloud Storage must conform to
                   certain file formats (Parquet, Avro, and Orc) and organized
                   in a hive-compatible directory layout.)RAWCURATEDTypeT)choicestyper   requiredz8Settings for resources attached as assets within a zone.)r   r   z--resource-location-typez3Resources that are associated with a single region.z;Resources that are associated with a multi-region location.)SINGLE_REGIONMULTI_REGIONz1Location type of the resources attached to a zone)r   AddZoneResourceArgadd_argumentr   ChoiceToEnumNamer
   AddDiscoveryArgs	add_groupr	   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserresource_specs     $lib/surface/dataplex/zones/create.pyArgsCreate.ArgsE   s   $$V\:
J	  L
 .HI
(/JK
+=
 ''!  " 
6"$$G % IM " FM	
 ''@  
 	OO'$$V,    z-Status code: {status_code}. {status_message}.c           
      L   UR                   R                  R                  5       n[        R                  " 5       nUR
                  R                  [        R                  " 5       R                  UR                  5       UR                  5       R                  5       UR                  [        R                  " U5      S95      n[        USS5      nU(       a   [        R                   R#                  S5        g [        USS5      nU(       de  [        R$                  " U5        [        R&                  " UR                  5       SR)                  UR                  5       R                  5       5      S9  g [        R                   R#                  SR)                  X$R*                  5      5        g )	N)zoneIdparentvalidateOnlygoogleCloudDataplexV1Zonevalidate_onlyFzValidation complete.async_zZone created in [{0}])detailsz$Creating [{0}] with operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstanceprojects_locations_lakes_zonesr   GetMessageModule0DataplexProjectsLocationsLakesZonesCreateRequestNameParentRelativeNamer3   GenerateZoneForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourceformatname)selfargszone_refdataplex_clientcreate_req_opr3   r4   s          r*   Run
Create.Runr   s=    }}!!'')H#557O#BBII&& 	

:
:==???$113++&*&G&G&M	 ; OPM D/59M	jj-.T8U+F
M*	
--/)6(//#00235 JJ;BB$$& 'r-    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr+   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrM   __static_attributes__rO   r-   r*   r   r       sO    " -& *- *-X 4457'7'r-   r   N)rT   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r8   r   googlecloudsdk.api_lib.utilr   rW   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   r   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rO   r-   r*   <module>rg      sv    2 &  ' A 0 F ( 5 = : < # D%%++T->->-A-ABm'T\\ m' Cm'r-   