
    *                        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)z9`gcloud dataplex data-attribute-bindings 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 Binding.EXAMPLESa  
          To create Data Attribute Binding `test-attribute-binding` in project
          `test-dataplex` at location `us-central1` with resouce name 'testResource' and 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='projects/test-dataplex/locations/us-central1/lakes/my-lake/zones/test-zone/entities/testResource'
            --resource-attributes='a1,a2'
            --paths=name=testColumn1,attributes=a1
            --paths=name=testColumn2,attributes=a2

          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[        R                  " 5       SS9  U R                  SSS9nUR                  SSSS[        R                  " [        [        R                  " 5       S.SS/S9SS9  UR                  SSS9  U R                  SSS/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 Binding.)requiredhelpz--display-namez+Display Name of the Data Attribute Binding.z
--resourcezCThe resource name of the resource that is binded to Data Attribute.z--resource-attributes
ATTRIBUTESzbList of attributes to be associated with the resource. It should be fully qualified attribute name)metavardefaultr   typer   TzCreation options.)mutexr   z--pathsPATHappend)name
attributesr   r   )specrequired_keysa  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. Attribute name should be fully qualified attribute name.)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 json if not specified. Will be ignored if --file-name is not specified.)choicesr   )r   r   z--validate-only
store_truez:Validate the create 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/create.pyArgsCreate.Args4   s   44V5AC
9  ; :  < -  .
   "D  
 4.ABE	  )113 "<0
C  D( 
  
  ?	  A "" # 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                  " U5      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R*                  SR-                  UR.                  UR0                  5      S9  U$ [         R"                  R%                  SR-                  X$R*                  5      5        U$ )	N)dataAttributeBindingIdparentvalidateOnly)googleCloudDataplexV1DataAttributeBindingvalidate_onlyFzValidation complete.async_zCData Attribute Binding created in project [{0}] with location [{1}])detailsz;Creating Data Attribute Binding [{0}] with operation [{1}].)CONCEPTSdata_attribute_bindingParsedataplex_utilGetClientInstance(projects_locations_dataAttributeBindingsr   GetMessageModule;DataplexProjectsLocationsDataAttributeBindingsCreateRequestNameParentRelativeNamer:   r   ,GenerateDataAttributeBindingForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourcer   format
projectsIdlocationsId)selfargsattribute_binding_refdataplex_clientcreate_req_opr:   r;   responses           r1   Run
Create.Run}   sY    !MM@@FFH#557O#LLSS&& 	

E
E#8#=#=#?(//1>>@++6C997::>7@	 F ABM D/59M	jj-.T8U+F//>h	
--W6'22'3356
 oJJELL!#5#5	78 r4    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr2   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrW   __static_attributes__rY   r4   r1   r   r      sO    1 -" F- F-P 44577r4   r   N)r^   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r@   googlecloudsdk.api_lib.utilr   ra   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHACommandr   rY   r4   r1   <module>ro      se    @ &  ' 9 A F / ( = < # D%%++,}T\\ } -}r4   