
    :                     >   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+Command to update a Dataplex zone resource.    )absolute_import)division)unicode_literals)util)zone)
exceptions)base)flags)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 zone resource.EXAMPLESar            To update a Dataplex zone `test-zone` in lake `test-lake` in location
          `us-central1` to have the display name `first-dataplex-zone` and
          discovery include patterns `abc`, `def`, run:

            $ {command} test-zone --location=us-central1 --lake=test-lake --display-name="first-dataplex-zone" --discovery-include-patterns=abc,def
          c                 8   t        j                  | d       | j                  dddd       | j                  dd	       | j                  d
d	       t        j                  |        t
        j                  j                  |        t        j                  |        y )Nz
to update.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)
r   AddZoneResourceArgadd_argumentr
   AddDiscoveryArgsr	   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parsers    $lib/surface/dataplex/zones/update.pyArgszUpdate.Args/   s    $$V\:
J	  L
 .GH
(~>	6"OO'$$V,    z-Status code: {status_code}. {status_message}.c           
          t        j                  |      }t        |      dk  rt        j                  d      |j
                  j                   j                         }t        j                         }|j                  j                  t        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	
       y t$        j&                  j)                  dj/                  ||j0                               y )N   zIUpdate commands must specify at least one additional parameter to change.,)namevalidateOnly
updateMaskgoogleCloudDataplexV1Zonevalidate_onlyFzValidation complete.async_zOperation was sucessful.)detailsz$Updating [{0}] with operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstanceprojects_locations_lakes_zonesPatchGetMessageModule/DataplexProjectsLocationsLakesZonesPatchRequestRelativeNamer'   joinGenerateZoneForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourceformatr#   )selfargsupdate_maskzone_refdataplex_clientupdate_req_opr'   r(   s           r   Runz
Update.Run=   sK    ))$/K
;!$$
U  }}!!'')H#557O#BBHH&& 	

9
9&&(++yy-&*&G&G&M	 : OPM D/59M	jj-.T8U+F
M*	(,FGJJ;BB-$$& 'r   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrD    r   r   r   r       sO    ( 	- - - 54457'7'r   r   N)rH   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r/   r   googlecloudsdk.api_lib.utilr   rK   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rM   r   r   <module>rZ      su    2 &  ' A 0 F ( . 5 = < # D%%++T->->-A-AB:'T\\ :' C:'r   