
    y                     >   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.                  j0                  ej.                  j2                         G d dej4                               Zy)z)`gcloud dataplex content update` command.    )absolute_import)division)unicode_literals)content)util)
exceptions)base)resource_args)	arg_utils)labels_util)logc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)UpdatezAUpdate a Dataplex Content Resource with the given configurations.EXAMPLESa]  
          To update a Dataplex content `test-content` in project `test-project` within lake `test-lake` in location `us-central1` and
          change the description to `Updated Description`, run:

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

          c                    t        j                  | d       | j                  dd       | j                  dd       | j                  dd       | j                  d	d
      }|j                  d      }|j                  dddit        j
                  d       |j                  d      }|j                  dddit        j
                  d       | j                  dddd       t        j                  |        y )Nzto Update a Content to.z--descriptionzDescription of the Content)helpz--data-textzContent data in string formatz--pathzAThe path for the Content file, represented as directory structureTz.Sql script or notebook related configurations.)mutexr   z Notebook related configurations.z--kernel-typePYTHON3python3zKernel Type of the notebook.)choicestyper   z"Sql script related configurations.z--query-engineSPARKsparkz*Query Engine to be used for the Sql Query.z--validate-only
store_trueFz:Validate the update action, but don't actually perform it.)actiondefaultr   )r
   AddContentitemResourceArgadd_argument	add_groupr   ChoiceToEnumNamer   AddCreateLabelsFlags)parsersqlscript_or_notebooknotebook
sql_scripts       &lib/surface/dataplex/content/update.pyArgszUpdate.Args0   s1   ++F4MN
.JK
,KL
P  
 #,,I - K %../ / 1H I&''+	  - '001 1 3J '"''9	  ; J	  L
 $$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%        j*                  |       y )N   zIUpdate commands must specify at least one additional parameter to change.,)namevalidateOnly
updateMaskgoogleCloudDataplexV1Contentvalidate_onlyFzValidation complete.)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstance%projects_locations_lakes_contentitemsPatchGetMessageModule6DataplexProjectsLocationsLakesContentitemsPatchRequestRelativeNamer0   joinGenerateContentForUpdateRequestgetattrr   statusPrintUpdatedResource)selfargsupdate_maskcontent_refdataplex_clientr0   s         r&   Runz
Update.RunW   s     ,,T2K
;!$$
U  --''--/K#557O99??&& 	

@
@))+++yy-)0,,T*3	 A 45 D/59M	jj-.$r(   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr'   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrH    r(   r&   r   r       sP    I 
- $- $-L 54457%7%r(   r   N)rL   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r6   googlecloudsdk.api_lib.utilr   rO   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rQ   r(   r&   <module>r_      sx    0 &  ' 3 A F ( . = : < # D%%++T->->-A-ABN%T\\ N% CN%r(   