
    k                        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SKJr  SSKJr  SSKJr  S r\R0                  " \R2                  R4                  5       " S S\R6                  5      5       r\R0                  " \R2                  R:                  5       " S S\5      5       rg)z,Command to update a Dataplex asset resource.    )absolute_import)division)unicode_literals)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)Update1   !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.ArgsA   [    $$N % M %D
 ''  r   c                 .    [         R                  " U5      $ N)r   GenerateUpdateMaskselfargss     r   r5   Update.GenerateUpdateMaskV   s    ##D))r   c                 .    [         R                  " U5      $ r4   )r   GenerateAssetForUpdateRequestr6   s     r   GenerateUpdateRequestUpdate.GenerateUpdateRequestY   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}].)r5   lenr   HttpExceptionCONCEPTSr   Parsedataplex_utilGetClientInstanceGetMessageModule%projects_locations_lakes_zones_assetsPatch5DataplexProjectsLocationsLakesZonesAssetsPatchRequestRelativeNamerE   joinr<   getattrr   statusPrintWaitForOperationUpdatedResourceformatrA   )	r7   r8   update_mask	asset_refdataplex_clientmessageupdate_req_oprE   rF   s	            r   Run
Update.Run\   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staticmethodr0   r5   r<   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr_   __static_attributes__ra   r   r   r   r   1   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   r0   UpdateAlpha.Args   r2   r   c                 .    [         R                  " U5      $ r4   )r   GenerateUpdateMaskAlphar6   s     r   r5   UpdateAlpha.GenerateUpdateMask   s    ((..r   c                 .    [         R                  " U5      $ r4   )r   "GenerateAssetForUpdateRequestAlphar6   s     r   r<   !UpdateAlpha.GenerateUpdateRequest   s    33D99r   ra   N)rb   rc   rd   re   rf   rg   rh   r0   r5   r<   rk   ra   r   r   rm   rm      s4    )  	-  (/:r   rm   N)rf   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   rL   googlecloudsdk.api_lib.utilr   ri   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   r   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   ReleaseTracksReleaseTrackGACommandr   ALPHArm   ra   r   r   <module>r      s    3 &  ' 1 A F ( . 5 = : < #+  D%%(()L(T\\ L( *L(^ D%%++,':& ': -':r   