
                            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,                  j.                         G d dej0                               Zy)z9`gcloud dataplex data-attribute-bindings update` command.    )absolute_import)division)unicode_literals)data_taxonomy)util)
exceptions)arg_parsers)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 Data Attribute Binding.EXAMPLESa?  
          To Update Data Attribute Binding `test-attribute-binding` in project
          `test-dataplex` at location `us-central1` with resource attributes
          a1 and a2. Test column 'testColumn1' attached to attribute 'a1' and 'testColumn2' attached to attribute 'a2' , run:

            $ {command} test-attribute-binding --project=test-dataplex --location=us-central1
            --resource-attributes='a1,a2'
            --paths=name=testColumn1,attributes=a1
            --paths=name=testColumn2,attributes=a2
            --etag=Etag_Received_From_Get

          c                    t        j                  | d       | j                  ddd       | j                  ddd       | j                  dd	d
       | j                  ddg dt        j                         d       | j                  d	d      }|j                  ddddt        j                  t        t        j                         dddg      d       |j                  dd       | j                  dddgd !       | j                  d	d"      }|j                  d#d$dd%&       t        j                  j                  |       t        j                  |        y )'Nz
to update.z--descriptionFz*Description of the Data Attribute Binding.)requiredhelpz--display-namez+Display Name of the Data Attribute Binding.z--etagTz2etag value of the Data Attribute Binding resource.z--resource-attributes
ATTRIBUTESz:List of Data Attributes to be associated with the resource)metavardefaultr   typer   zCreation options.)mutexr   z--pathsPATHappend)name
attributesr   r   )specrequired_keysaO  The list of paths for items within the associated resource (eg. columns within a table) along with attribute bindings. The args can be passed as key value pair. Supported Keys are --path=name=value1,attributes=value2 ,See https://cloud.google.com/sdk/gcloud/reference/topic/escaping for details on using a delimiter other than a comma.)r   actionr   r   r   z--path-file-namez=The name of the JSON or YAML file to define Path config from.)r   z--path-file-formatjsonyamlzThe format of the file to create the path. Specify either yaml or json. Defaults to yaml if not specified. Will be ignored if --file-name is not specified.)choicesr   )r   r   z--validate-only
store_truez:Validate the update action, but don't actually perform it.)r   r   r   )r   "AddDataAttributeBindingResourceArgadd_argumentr	   ArgList	add_groupArgDictstrr
   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parsergroupasync_groups      6lib/surface/dataplex/data_attribute_bindings/update.pyArgszUpdate.Args5   s   44V5AC
9  ; :  < A  C   "I  K 4.ABE	  )113 "<0
0  1& 
  
  ?	  A "" # K J	  L
 	OO,$$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                         dj                  |      |j                   t        j"                  |                  }t%        |dd      }|r t&        j(                  j+                  d       y t%        |dd      }|s.t        j,                  |      }t'        j.                  |d	
       |S t&        j(                  j+                  dj1                  ||j2                               |S )N   zIUpdate commands must specify at least one additional parameter to change.,)r   
updateMaskvalidateOnly)googleCloudDataplexV1DataAttributeBindingvalidate_onlyFzValidation complete.async_zOperation was successful.)detailsz;Updating Data Attribute Binding [{0}] with operation [{1}].)r   "GenerateAttributeBindingUpdateMasklenr   HttpExceptionCONCEPTSdata_attribute_bindingParsedataplex_utilGetClientInstance(projects_locations_dataAttributeBindingsPatchGetMessageModule:DataplexProjectsLocationsDataAttributeBindingsPatchRequestRelativeNamejoinr9   ,GenerateDataAttributeBindingForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourceformatr   )	selfargsupdate_maskattribute_binding_refdataplex_clientupdate_req_opr9   r:   responses	            r0   Runz
Update.Runz   s_     BB4HK
;!$$
U  !MM@@FFH#557O#LLRR&& 	

D
D&335yy-++6C99$7@	 E ABM D/59M	jj-.T8U+F//>h	/"=?oJJELL!=#5#5	78 r2   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr1   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrX    r2   r0   r   r       sR    1 -" B- B-H 54457!7!r2   r   N)r\   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   rB   googlecloudsdk.api_lib.utilr   r_   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHACommandr   ra   r2   r0   <module>rm      sj    @ &  ' 9 A F / ( . = < # D%%++,|T\\ | -|r2   