
                         8   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  ej(                  ej*                  j,                        ej.                  ej0                   G d dej2                                             Zy)z2`gcloud dataplex governance-rules create` 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)CreatezeCreate a Dataplex Governance Rule.

  Governance Rule is a template for creating Governance Rules.
  EXAMPLESa  
          To create 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'
            --rule-metadata-file='file.json'

          c                 `   t        j                  | 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 create.z--descriptionFz#Description of the Governance Rule.)requiredhelpz--display-namez$Display name of the Governance Rule.z--rule-metadata-fileTz:The name of the JSON or YAML file to define rule metadata.)mutexr   z--validate-only
store_truez:Validate the create 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/create.pyArgszCreate.Args5   s    ..v|D
2  
 3  
 I   !!u!=JI	   	OO
+$$V,    z-Status code: {status_code}. {status_message}.c           
      *   |j                   j                  j                         }t        j                         }|j
                  j                  t        j                         j                  |j                         |j                         j                         |j                  t        j                  |                  }t        |dd      }|r t        j                   j#                  d       y t        |dd      }|s\t        j$                  |      }t        j&                  |j(                  dj+                  |j,                  |j.                               |S t        j                   j#                  dj+                  ||j(                               |S )	N)governanceRuleIdparentvalidateOnly#googleCloudDataplexV1GovernanceRulevalidate_onlyFzValidation complete.async_z<Governance Rule created in project [{0}] with location [{1}])detailsz4Creating Governance Rule [{0}] with operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstance"projects_locations_governanceRulesr   GetMessageModule5DataplexProjectsLocationsGovernanceRulesCreateRequestNameParentRelativeNamer'   &GenerateGovernanceRuleForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourcenameformat
projectsIdlocationsId)selfargsgovernance_rule_refdataplex_clientcreate_req_opr'   r(   responses           r   Runz
Create.RunR   sQ    --77==?#557O#FFMM&&(^^0557&--/<<>++0?0f0f1	 	_ 	
	M D/59M	jj-.T8U+F 11-@h	
--Lv%00%11		 oJJ>EE!3!3	

 r!   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr    gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrD    r!   r   r   r      sQ      	- - -8 5445''r!   r   N)rH   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r,   googlecloudsdk.api_lib.utilr   rK   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHADefaultUniverseOnlyHiddenCommandr   rM   r!   r   <module>r[      s    9 '  ' ; A F ( = < # D%%++,ZT\\ Z   -Zr!   