
                         j   S r SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJr  SSK
Jr  SSK
Jr  SSKJr  SS	KJr  SS
KJr  S r\	R(                  " \	R*                  R,                  5       " S S\	R.                  5      5       r\	R(                  " \	R*                  R2                  5       " S S\5      5       rg)z,Command to update a Dataplex asset resource.    )asset)util)
exceptions)base)flags)resource_args)	arg_utils)labels_util)logc                 ,   [         R                  " U S5        U R                  SSSSS9  U R                  SSS	9  U R                  S
SS	9  [        R                  " U 5        [
        R                  R                  U 5        [        R                  " U 5        g)zCreate a common args.z
to update.z--validate-only
store_trueFz:Validate the update action, but don't actually perform it.)actiondefaulthelpz--descriptionzDescription of the asset)r   z--display-namezDisplay NameN)
r   AddAssetResourceArgadd_argumentr   AddDiscoveryArgsr   
ASYNC_FLAGAddToParserr
   AddCreateLabelsFlags)parsers    %lib/surface/dataplex/assets/update.py_CommonArgsr      s    ##FL9G	   	o,FG&^< //f%""6*    c                   l    \ rS rSrSrSS0r\S 5       rS rS r	\
R                  " S5      S	 5       rS
rg)Update.   !Update a Dataplex asset resource.EXAMPLES            To update a Dataplex asset `test-asset` in zone `test-zone` in lake
          `test-lake` in location `us-central1` to have the display name
          `first-dataplex-asset` and discovery include patterns `abc`, `def`,
          run:

            $ {command} test-asset --location=us-central1 --lake=test-lake --zone=test-zone --display-name="first-dataplex-asset" --discovery-include-patterns=abc,def
          c                     [        U 5        U R                  SSS9nUR                  SSSSS.[        R                  SS	9  g 
NFz?Specification of the resource that is referenced by this asset.)requiredr   z--resource-read-access-modez,Data is accessed directly using storage APIszAData is accessed through a managed interface using BigQuery APIs.)DIRECTMANAGEDzRead access mode)r#   choicestyper   r   	add_groupr   r	   ChoiceToEnumNamer   resource_specs     r   ArgsUpdate.Args>   [    $$N % M %D
 ''  r   c                 .    [         R                  " U5      $ N)r   GenerateUpdateMaskselfargss     r   r2   Update.GenerateUpdateMaskS   s    ##D))r   c                 .    [         R                  " U5      $ r1   )r   GenerateAssetForUpdateRequestr3   s     r   GenerateUpdateRequestUpdate.GenerateUpdateRequestV   s    ..t44r   z-Status code: {status_code}. {status_message}.c           
      &   U R                  U5      n[        U5      S:  a  [        R                  " S5      eUR                  R
                  R                  5       n[        R                  " 5       n[        R                  " 5       nUR                  R                  UR                  UR                  5       UR                  SR                  U5      U R!                  U5      S95      n[#        USS5      nU(       a   [$        R&                  R)                  S5        g [#        USS5      nU(       d,  [
        R*                  " U5        [$        R,                  " US	S
9  g [$        R&                  R)                  SR/                  X6R0                  5      5        g )N   zIUpdate commands must specify at least one additional parameter to change.,)namevalidateOnly
updateMaskgoogleCloudDataplexV1Assetvalidate_onlyFzValidation complete.async_zOperation was sucessful.)detailsz$Updating [{0}] with operation [{1}].)r2   lenr   HttpExceptionCONCEPTSr   Parsedataplex_utilGetClientInstanceGetMessageModule%projects_locations_lakes_zones_assetsPatch5DataplexProjectsLocationsLakesZonesAssetsPatchRequestRelativeNamerB   joinr9   getattrr   statusPrintWaitForOperationUpdatedResourceformatr>   )	r4   r5   update_mask	asset_refdataplex_clientmessageupdate_req_oprB   rC   s	            r   Run
Update.RunY   sM    ))$/K
;!$$ 
 ##))+I#557O,,.G#IIOOEE'')++xx,'+'A'A$'G	 	F 	
M D/59M	jj-.T8U+F]+	)-GHJJ;BB%%' (r    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr-   r2   r9   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr\   __static_attributes__r^   r   r   r   r   .   sV    ) 
-  (*5 445((r   r   c                   <    \ rS rSrSrSS0r\S 5       rS rS r	Sr
g	)
UpdateAlpha~   r   r   r    c                     [        U 5        U R                  SSS9nUR                  SSSSS.[        R                  SS	9  g r"   r(   r+   s     r   r-   UpdateAlpha.Args   r/   r   c                 .    [         R                  " U5      $ r1   )r   GenerateUpdateMaskAlphar3   s     r   r2   UpdateAlpha.GenerateUpdateMask   s    ((..r   c                 .    [         R                  " U5      $ r1   )r   "GenerateAssetForUpdateRequestAlphar3   s     r   r9   !UpdateAlpha.GenerateUpdateRequest   s    33D99r   r^   N)r_   r`   ra   rb   rc   rd   re   r-   r2   r9   rh   r^   r   r   rj   rj   ~   s4    )  	-  (/:r   rj   N)rc   googlecloudsdk.api_lib.dataplexr   r   rI   googlecloudsdk.api_lib.utilr   rf   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   r   $googlecloudsdk.command_lib.util.apisr	   $googlecloudsdk.command_lib.util.argsr
   googlecloudsdk.corer   r   ReleaseTracksReleaseTrackGACommandr   ALPHArj   r^   r   r   <module>r      s    3 2 A F ( . 5 = : < #+  D%%(()L(T\\ L( *L(^ D%%++,':& ': -':r   