
                         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*                  j.                         G d dej0                               Zy)z+Command to update a Dataplex lake resource.    )absolute_import)division)unicode_literals)lake)util)
exceptions)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 lake resource.EXAMPLESa            To update a Dataplex Lake `test-lake` in location `us-central1` to
          have the display name `first-dataplex-lake` and metastore service           `projects/test-lake/locations/us-central1/service/test-service`, run:

            $ {command} test-lake --location=us-central1 --display-name="first-dataplex-lake" --metastore-service="projects/test-lake/locations/us-central1/service/test-service"
          c                 X   t        j                  | d       | j                  dddd       | j                  dd	       | j                  d
d	       | j                  d	      }|j                  dd	       t        j
                  j                  |        t        j                  |        y )Nz
to update.z--validate-only
store_trueFz:Validate the update action, but don't actually perform it.)actiondefaulthelpz--descriptionzDescription of the lake)r   z--display-namezDisplay NamezGSettings to manage metadata publishing to a Hive Metastore from a lake.z--metastore-serviceaN   A relative reference to the Dataproc Metastore
        (https://cloud.google.com/dataproc-metastore/docs) service instance into
        which metadata will be published. This is of the form:
        `projects/{project_number}/locations/{location_id}/services/{service_id}`
        where the location matches the location of the lake.)	r
   AddLakeResourceArgadd_argument	add_groupr	   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parser	metastores     $lib/surface/dataplex/lakes/update.pyArgszUpdate.Args.   s    $$V\:
J	  L
 .GH
(~>  V ! I @  A 	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                  |      |j!                  |j"                  |j$                  |j'                  |j(                        t        j*                  |j                   |                        }t-        |dd      }|r!t.        j0                  j3                  d	       |S t-        |d
d      }|s-t        j4                  |       t/        j6                  |d       y t.        j0                  j3                  dj9                  ||j:                               y )N   zIUpdate commands must specify at least one additional parameter to change.,)service)descriptiondisplayNamer   labels)namevalidateOnly
updateMaskgoogleCloudDataplexV1Lakevalidate_onlyFz Validation complete with errors:async_zOperation was sucessful.)detailsz$Updating [{0}] with operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstanceGetMessageModuleprojects_locations_lakesPatch*DataplexProjectsLocationsLakesPatchRequestRelativeNamer+   joinGoogleCloudDataplexV1Laker$   display_name"GoogleCloudDataplexV1LakeMetastoremetastore_serviceCreateLabelsgetattrr   statusPrintWaitForOperationUpdatedResourceformatr'   )	selfargsupdate_masklake_refdataplex_clientmessageupdate_req_opr+   r,   s	            r   Runz
Update.RunE   s    ))$/K
;!$$
U  }}!!'')H#557O,,.G#<<BB::&&(++yy-&-&G&G ,, --!DD 22 E 4$1155t= 'H '>	 	; 
	?@M D/59M	jj9:T8U+F
M*	(,FGJJ;BB-$$& 'r   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrM    r   r   r   r      sO    ( 	- - -, 54457"'7"'r   r   N)rQ   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r3   googlecloudsdk.api_lib.utilr   rT   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rV   r   r   <module>rc      su    2 &  ' 0 A F ( . = < # D%%++T->->-A-ABI'T\\ I' CI'r   