
    k                     D   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  ej(                  ej*                  j,                        ej.                  ej0                   G d dej2                                             Zy)z2`gcloud dataplex governance-rules update` command.    )absolute_import)division)unicode_literals)governance_rule)util)
exceptions)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)UpdatezeUpdate a Dataplex Governance Rule.

  Governance Rule is a template for creating Governance Rules.
  EXAMPLESa  
          To update Governance Rule `test-governance-rule` in project `test-dataplex` at location `us-central1`,
          with description `test description`, displayName `test display name` and ruleMetaDataFile `file.json`, run:

            $ {command} test-governance-rule --location=us-central1 --project=test-project --description='test description'
            --display-name='test display name'

          c                    t        j                  | d       | j                  ddd       | j                  ddd       | j                  ddd	       | j                  d
dd       | j                  dd      }|j                  dddd       t        j
                  j                  |       t        j                  |        y )Nz
to update.z--descriptionFz#Description of the Governance Rule.)requiredhelpz--display-namez$Display name of the Governance Rule.z--rule-metadata-filez:The name of the JSON or YAML file to define rule metadata.z--etagz*etag value for particular Governance Rule.T)mutexr   z--validate-only
store_truez:Validate the update action, but don't actually perform it.)actiondefaultr   )	r
   AddGovernanceRuleResourceArgadd_argument	add_groupr	   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parser
async_types     /lib/surface/dataplex/governance_rules/update.pyArgszUpdate.Args5   s    ..v|D
2  
 3  
 I  
 9   !!u!=JI	   	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                         |j                  d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j/                  ||j0                               |S )N   zIUpdate commands must specify at least one additional parameter to change.,)namevalidateOnly
updateMask#googleCloudDataplexV1GovernanceRulevalidate_onlyFzValidation complete.async_zOperation was successful.)detailsz4Updating Governance Rule [{0}] with operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstance"projects_locations_governanceRulesPatchGetMessageModule4DataplexProjectsLocationsGovernanceRulesPatchRequestRelativeNamer)   join&GenerateGovernanceRuleForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourceformatr%   )selfargsupdate_maskgovernance_rule_refdataplex_clientupdate_req_opr)   responses           r   Runz
Update.RunW   sZ    "44T:K
;!$$ 
 --77==?#557O#FFLL&&(]]$113++xx,0?0f0f1	 	^ 	
	M D/59M	jj-.45) 11-@h	
'B oJJ>EE!3!3	

 r!   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr    gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrG    r!   r   r   r       sR      
- - -B 5445&&r!   r   N)rK   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r1   googlecloudsdk.api_lib.utilr   rN   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHADefaultUniverseOnlyHiddenCommandr   rP   r!   r   <module>r^      s    9 '  ' ; A F ( . = < # D%%++,]T\\ ]   -]r!   