
                         >   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  ej*                  ej,                  j.                  ej,                  j0                         G d dej2                               Zy)z.`gcloud dataplex environments update` 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)Updatez?Update a Dataplex Environment with the given configurations.
  EXAMPLESaM  
          To update a Dataplex environment `test-environment` within lake `test-lake` in location `us-central1` and
          change the description to `Updated Description`, run:

            $ {command} test-environment --project=test-project --location=us-central1 --lake=test-lake --description='Updated Description'

          c                    t        j                  | d       | j                  dd       | j                  dd       | j                  d      }|j                  d      }|j                  d	t        d
       |j                  dt        d       |j                  dt        d       |j                  d      }|j                  dd       |j                  ddt        j                         g d       |j                  ddt        j                         g d       |j                  ddt        j                         d       | j                  d      }|j                  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 update a Environment to.z--descriptionzDescription of the Environment)helpz--display-namezDisplay Name of the EnvironmentzFConfiguration for the underlying infrastructure used to run workloads.zDCompute resources associated with the analyze interactive workloads.z--compute-disk-size-gbz*Size in GB of the disk. Default is 100 GB.)typer   z--compute-node-countz,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)metavarr   defaultr   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   zEConfiguration for sessions created for the environment to be updated.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_trueFzEnables fast startup. This causes sessions to be pre-created and available for faster startup to enable interactive exploration use-cases.)actionr   requiredr   Tz: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/update.pyArgszUpdate.Args1   sR   ++F,IK
.NO
@  B **U +  ,55S 6  "" 9 # ; ""; # = """4 # 6 +44= 5 ?!!#< " >!!#)  " w "  !!$*  " t "  !!%  " T	 "  ##T $ L %y   ' Z   ""I # KK J	  L
 	OO,$$V,    z-Status code: {status_code}. {status_message}.c           
      (   t        j                  |      }t        |      dk  rt        j                  d      |j
                  j                   j                         }t        j                         }t        j                         }|j                  j                  |j                  |j                         |j                  dj                  |      t        j                   |                  }t#        |dd      }|r t$        j&                  j)                  d       y t#        |dd      }|s.t        j*                  |      }	t%        j,                  |d	
       |	S t$        j&                  j)                  dj/                  ||j0                               |S )N   zIUpdate commands must specify at least one additional parameter to change.,)namevalidateOnly
updateMask googleCloudDataplexV1Environmentvalidate_onlyFzValidation complete.async_zOperation was successful.)detailsz$Updating [{0}] with operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstanceGetMessageModule%projects_locations_lakes_environmentsPatch6DataplexProjectsLocationsLakesEnvironmentsPatchRequestRelativeNamer6   join#GenerateEnvironmentForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourceformatr2   )
selfargsupdate_maskenvironment_refdataplex_clientmessageupdate_req_opr6   r7   responses
             r,   Runz
Update.Run|   sY    006K
;!$$
U  mm//557O#557O,,.G#IIOOFF --/++yy--800.7	 	G 	89M D/59M	jj-.T8U+F--m<h	/3NOoJJ;BB++- .r.   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr-   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrU    r.   r,   r   r       sT     
- H- H-T 544577r.   r   N)rY   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r>   googlecloudsdk.api_lib.utilr   r\   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   r^   r.   r,   <module>rk      sx    5 &  ' 7 A F / ( . = < # D%%++T->->-A-AB|T\\ | C|r.   