
                            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  \R*                  " \R,                  R.                  5       " S S\R0                  5      5       rg)z=`gcloud dataplex data-taxonomies atttributes create` 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	)
Create   z!Create a Dataplex Data Attribute.EXAMPLESa  
          To create 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,
          data-readers as user:test@google.com and parent as `test-attribute-parent`, run:

              $ {command} test-attribute-6 --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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9nUR                  SSSSS9  [        R                  R                  U5        [        R                  " U 5        g )Nz
to create.z--descriptionFz"Description of the Data Attribute.)requiredhelpz--display-namez#Display Name of the Data Attribute.z--parentzqParent Data Attribute for the created 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_READERST)mutexr   z--validate-only
store_truez:Validate the create 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/create.pyArgsCreate.Args6   s   ))&,?
1  3 2  4  A  B !** \ +  $$"  " R %  $$"  " R % 
 $$!  " Q % 
 %%k & N   " R    "" # K J	  L
 	OO,$$V,    z-Status code: {status_code}. {status_message}.c                    UR                   R                  R                  5       n[        R                  " 5       nUR
                  R                  [        R                  " 5       R                  UR                  5       UR                  5       R                  5       UR                  [        R                  " X!5      S95      n[        USS5      nU(       a   [         R"                  R%                  S5        g [        USS5      nU(       dF  [        R&                  " U5      n[         R(                  " UR*                  SR-                  U5      S9  U$ [         R"                  R%                  SR-                  X$R*                  5      5        U$ )	N)dataAttributeIdparentvalidateOnly"googleCloudDataplexV1DataAttributevalidate_onlyFzValidation complete.async_zData Attribute created [{0}])detailsz3Creating Data Attribute [{0}] with operation [{1}].)CONCEPTSdata_attributeParsedataplex_utilGetClientInstance,projects_locations_dataTaxonomies_attributesr   GetMessageModule>DataplexProjectsLocationsDataTaxonomiesAttributesCreateRequestNameParentRelativeNamer3   r   %GenerateDataAttributeForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourcenameformat)selfargsdata_attribute_refdataplex_clientcreate_req_opr3   r4   responses           r*   Run
Create.Runx   sH    55;;=#557O#PPWW&& 	

H
H.335%,,.;;=++/<22033E0M	 I NOM D/59M	jj-.T8U+F//>h	
--06$%' oJJ=DD 2 2	45 r-    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr+   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrO   __static_attributes__rQ   r-   r*   r   r      sM    ) -& ?- ?-B 44577r-   r   N)rV   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r9   googlecloudsdk.api_lib.utilr   rY   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHACommandr   rQ   r-   r*   <module>rg      se    D &  ' 9 A F / ( = < # D%%++,wT\\ w -wr-   