
                         2   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  ej*                  ej,                  j.                  ej,                  j0                         G d dej2                               Zy)z.`gcloud dataplex environments create` command.    )absolute_import)division)unicode_literals)environment)util)
exceptions)arg_parsers)base)resource_args)labels_util)logc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)CreatezCreate a Dataplex Environment.EXAMPLESa  
          To create a Dataplex Environment `test-environment`  within lake `test-lake` in
          location `us-central1` inside project `test-project` , run:

            $ {command} test-environment  --project=test-project --location=us-central1 --lake=test-lake  --os-image-version=1.0

          To know about the other required arguments to create an environment run:

            $ gcloud dataplex environment create --help

          c                    t        j                  | d       | j                  ddd       | j                  ddd       | j                  dd	      }|j                  d
      }|j                  dt        ddd       |j                  dt        ddd       |j                  dt        ddd       |j                  dd      }|j                  ddd       |j                  dg dt        j                         dd       |j                  dg dt        j                         dd       |j                  dd t        j                         dd!"       | j                  d#      }|j                  d$dd%       |j                  d&d'ddd()       | j                  ddd*+      }|j                  d,d'dd-.       t        j                  j                  |       t        j                  |        y )/Nzto create a Environment to.z--descriptionFzDescription of the Environment)requiredhelpz--display-namezDisplay Name of the EnvironmentTzFConfiguration for the underlying infrastructure used to run workloads.zDCompute resources associated with the analyze interactive workloads.)r   z--compute-disk-size-gbd   z*Size in GB of the disk. Default is 100 GB.)typedefaultr   r   z--compute-node-countr   z,Total number of worker nodes in the cluster.z--compute-max-node-countz%Maximum number of configurable nodes.z.Software Runtime Configuration to run Analyze.z--os-image-versionzDataplex Image version.z--os-image-java-librariesOS_IMAGE_JAVA_LIBRARIESzList of Java jars to be included in the runtime environment. Valid input includes Cloud Storage URIs to Jar binaries. For example, gs://bucket-name/my/path/to/file.jar)r   metavarr   r   r   z--os-image-python-packagesOS_IMAGE_PYTHON_PACKAGESzA list of python packages to be installed. Valid formats include Cloud Storage URI to a PIP installable library. For example, gs://bucket-name/my/path/to/lib.tar.gzz--os-image-propertiesOS_IMAGE_PROPERTIESzOverride to common configuration of open source components installed on the Dataproc cluster. The properties to set on daemon config files. Property keys are specified in `prefix:property` format.)r   r   r   r   zEConfiguration for sessions created for the environment to be created.z--session-max-idle-durationzjThe idle time configuration of the session. The session will be auto-terminated at the end of this period.z--session-enable-fast-startup
store_truezEnables fast startup. This causes sessions to be pre-created and available for faster startup to enable interactive exploration use-cases.)actionr   r   r   z:At most one of --async | --validate-only can be specified.)mutexr   r   z--validate-onlyz:Validate the create action, but don't actually perform it.)r   r   r   )r   AddEnvironmentResourceArgadd_argument	add_groupintr	   ArgListArgDictr
   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserinfrastructure_speccompute_resourcesos_image_runtimesession_specasync_groups         +lib/surface/dataplex/environments/create.pyArgszCreate.Args3   s   ++F,IK
%.N  P
.  0 !**U +  ,55S 6  "" 9 # ; ""; # = """4 # 6 +44L 5 N!!t2K " M!!#)  " w "  !!$*  " t "  !!%  " T "  ##T $ L %y  
 ' Z   ""I # KK J	  L
 	OO,$$V,    z-Status code: {status_code}. {status_message}.c           
      @   |j                   j                  j                         }t        j                         }|j
                  j                  t        j                         j                  |j                         |j                         j                         |j                  t        j                  |                  }t        |dd      }|r t        j                   j#                  d       y t        |dd      }|sgt        j$                  |      }t        j&                  |j(                  dj+                  |j,                  |j.                  |j0                               |S t        j                   j#                  dj+                  ||j(                               |S )	N)environmentIdparentvalidateOnly googleCloudDataplexV1Environmentvalidate_onlyFzValidation complete.async_zFEnvironment created in lake [{0}] in project [{1}] with location [{2}])detailsz9Creating environment with path [{0}] and operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstance%projects_locations_lakes_environmentsr   GetMessageModule7DataplexProjectsLocationsLakesEnvironmentsCreateRequestNameParentRelativeNamer5   #GenerateEnvironmentForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourcenameformatlakesId
projectsIdlocationsId)selfargsenvironment_refdataplex_clientcreate_req_opr5   r6   responses           r-   Runz
Create.Run   sX    mm//557O#557O#IIPP&& 	

A
A)..0"))+88:++-800.7	 B 89M D/59M	jj-.T8U+F--m<h	
--Z6/))?+E+E!--/0
 oJJCJJ]//	12 r/   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr.   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrS    r/   r-   r   r      sR    & -  V- V-p 544577r/   r   N)rW   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r:   googlecloudsdk.api_lib.utilr   rZ   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   r\   r/   r-   <module>ri      su    5 &  ' 7 A F / ( = < # D%%++T->->-A-ABLT\\ L CLr/   