
    }                        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  \R*                  " \R,                  R.                  5       " S S\R0                  5      5       rg)z=`gcloud dataplex data-taxonomies atttributes update` command.    )absolute_import)division)unicode_literals)data_taxonomy)util)
exceptions)arg_parsers)base)resource_args)labels_util)logc                   `    \ rS rSrSrSS0r\S 5       r\R                  " S5      S 5       r
Srg	)
Update!   z!Update a Dataplex Data Attribute.EXAMPLESa  
          To update Data Attribute `test-attribute` for Data Taxonomy `test-datataxonomy` in project `test-dataplex`
          at location `us-central1` with description as `test description` ,  display name as `displayName`,
          resource-readers as user:test@google.com, resource-writers as user:test@google.com, resource-owner as user:test@google.com run:
          data-readers as user:test@google.com and parent as `test-attribute-parent`, run:

              $ {command} test-attribute --location=us-central1 --project=test-dataplex'
              --data_taxonomy=test-datataxonomy --description='test description'
              --display-name='displayName' --resource-readers='user:test@google.com'
              --resource-writers='user:test@google.com' --resource-owners='user:test@google.com'
              --data-readers='user:test@google.com'
              --parent='test-attribute-parent'

          c           	         [         R                  " U S5        U R                  SSSS9  U R                  SSSS9  U R                  SSS	S9  U R                  S
SSS9  U R                  SSS9nUR                  SS/ S[        R
                  " 5       SS9  UR                  SS/ S[        R
                  " 5       SS9  UR                  SS/ S[        R
                  " 5       SS9  U R                  SSS9nUR                  SS/ S[        R
                  " 5       SS9  U R                  SSSS9nUR                  SSSSS 9  [        R                  R                  U5        [        R                  " U 5        g )!Nz
to update.z--descriptionFz"Description of the Data Attribute.)requiredhelpz--display-namez#Display Name of the Data Attribute.z--etagz*etag value of the Data Attribute resource.z--parentzqParent Data Attribute for the defined Data Attribute. It can be attribute name or fully qualified attribute name.zSpec related to Dataplex Resource.Specified when applied to a resource (eg: Google Cloud Storage bucket, BigQuery, dataset, BigQuery table).z--resource-readersRESOURCE_READERSzThe set of principals to be granted reader role on the resource. Expected principal formats are user:$userEmail, group:$groupEmail)metavardefaultr   typer   z--resource-writersRESOURCE_WRITERSzThe set of principals to be granted writer role on the resource. Expected principal formats are user:$userEmail, group:$groupEmailz--resource-ownersRESOURCE_OWNERSzThe set of principals to be granted owner role on the resource. Expected principal formats are user:$userEmail, group:$groupEmailz\Specified when applied to data stored on the resource (eg: rows,columns in BigQuery Tables).z--data-readersDATA_READERSTz:At most one of --async | --validate-only can be specified.)mutexr   r   z--validate-only
store_truez:Validate the update action, but don't actually perform it.)actionr   r   )r   AddAttributeResourceArgadd_argument	add_groupr	   ArgListr
   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserresource_acces_sepcdataacces_sepcasync_groups       9lib/surface/dataplex/data_taxonomies/attributes/update.pyArgsUpdate.Args8   s   ))&,?
1  3 2  4 9  ;  A  B !** \ +  $$"  " R % 
 $$"  " R % 
 $$!  " Q % 
 %%k & N   " R    ""I # KK J	  L
 	OO,$$V,    z-Status code: {status_code}. {status_message}.c                 :   [         R                  " U5      n[        U5      S:  a  [        R                  " S5      eUR
                  R                  R                  5       n[        R                  " 5       nUR                  R                  [        R                  " 5       R                  UR                  5       SR                  U5      UR                   [         R"                  " X15      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      n[&        R.                  " US	S
9  U$ [&        R(                  R+                  SR1                  X5R2                  5      5        U$ )N   zIUpdate commands must specify at least one additional parameter to change.,)name
updateMaskvalidateOnly"googleCloudDataplexV1DataAttributevalidate_onlyFzValidation complete.async_zOperation was successful.)detailsz3Updating Data Attribute [{0}] with operation [{1}].)r   GenerateAttributeUpdateMasklenr   HttpExceptionCONCEPTSdata_attributeParsedataplex_utilGetClientInstance,projects_locations_dataTaxonomies_attributesPatchGetMessageModule=DataplexProjectsLocationsDataTaxonomiesAttributesPatchRequestRelativeNamejoinr5   %GenerateDataAttributeForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourceformatr1   )	selfargsupdate_maskdata_attribute_refdataplex_clientupdate_req_opr5   r6   responses	            r*   Run
Update.Run   sc     ;;DAK
;!$$
U  55;;=#557O#PPVV&& 	

G
G#002yy-++/<22033E0M	 H NOM D/59M	jj-.T8U+F//>h	,"=?oJJ=DD 2 2	45 r-    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr+   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrT   __static_attributes__rV   r-   r*   r   r   !   sO    ) -& D- D-L 4457!7!r-   r   N)r[   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r>   googlecloudsdk.api_lib.utilr   r^   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHACommandr   rV   r-   r*   <module>rl      sh    D &  ' 9 A F / ( . = < # D%%++,@T\\ @ -@r-   