
    "                     ^   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 r\	R(                  " \	R*                  R,                  5       " S S\	R.                  5      5       r\	R(                  " \	R*                  R2                  5       " S S\5      5       rg)z,Command to create a Dataplex asset resource.    )asset)util)
exceptions)base)flags)resource_args)	arg_utils)labels_util)logc                 ,   [         R                  " U S5        U R                  SSSSS9  U R                  SSS	9  U R                  S
SS	9  [        R                  " U 5        [
        R                  R                  U 5        [        R                  " U 5        g)zCreate a common args.z
to create.z--validate-only
store_trueFz:Validate the create action, but don't actually perform it.)actiondefaulthelpz--descriptionzDescription of the assetr   z--display-namezDisplay name of the assetN)
r   AddAssetResourceArgadd_argumentr   AddDiscoveryArgsr   
ASYNC_FLAGAddToParserr
   AddCreateLabelsFlags)parsers    %lib/surface/dataplex/assets/create.py_CommonArgsr      s    ##FL9G	   	o,FG&-HI //f%""6*    c                   f    \ rS rSrSrSS0r\S 5       rS r\	R                  " S5      S 5       rS	rg
)Create-     Create a Dataplex asset resource.

An asset represents a cloud resource that is being managed within a lake as a
member of a zone.

This asset ID will be used to generate names such as table names when
publishing metadata to Hive Metastore and BigQuery.
 * Must contain only lowercase letters, numbers, and hyphens.
 * Must start with a letter.
 * Must end with a number or a letter.
 * Must be between 1-63 characters.
 * Must be unique within the zone.
EXAMPLES            To create a Dataplex asset with name `test-asset`, within zone
          `test-zone`, in lake `test-lake`, in location `us-central1`, with
          resource type `STORAGE_BUCKET`, with resource name
          `projects/test-project/buckets/test-bucket`, run:

            $ {command} test-asset --location=us-central --lake=test-lake --zone=test-zone --resource-type=STORAGE_BUCKET --resource-name=projects/test-project/buckets/test-bucket

          To create a Dataplex asset with name `test-asset`, within zone
          `test-zone`, in lake `test-lake`, in location `us-central1`, with
          resource type `STORAGE_BUCKET`, with resource name
          `projects/test-project/buckets/test-bucket`, with discovery-enabled,
          and discovery schedule `0 * * * *`, run:

            $ {command} test-asset --location=us-central --lake=test-lake --zone=test-zone --resource-type=STORAGE_BUCKET --resource-name=projects/test-project/buckets/test-bucket --discovery-enabled --discovery-schedule="0 * * * *"
          c                     [        U 5        U R                  SSS9nUR                  SSS9  UR                  SSSS	S
.[        R                  SS9  UR                  SSSSS.[        R                  SS9  g NTz?Specification of the resource that is referenced by this asset.)requiredr   z--resource-namez"Relative name of the cloud resource that contains the data that
                 is being managed within a lake. For example:
                 `projects/{project_number}/buckets/{bucket_id}` or  `projects/{project_number}/datasets/{dataset_id}`r   z--resource-typezCloud Storage BucketzBigQuery Dataset)STORAGE_BUCKETBIGQUERY_DATASETType)r$   choicestyper   z--resource-read-access-modeFz,Data is accessed directly using storage APIszAData is accessed through a managed interface using BigQuery APIs.)DIRECTMANAGEDzRead access moder   	add_groupr   r	   ChoiceToEnumNamer   resource_specs     r   ArgsCreate.ArgsQ       $$N % M z   4 2
 ''  	 %D
 ''  r   c                 .    [         R                  " U5      $ N)r   GenerateAssetForCreateRequestselfargss     r   GenerateRequestCreate.GenerateRequestv   s    ..t44r   z-Status code: {status_code}. {status_message}.c           
      B   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                  U 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(       de  [        R$                  " U5        [        R&                  " UR                  5       SR)                  UR                  5       R                  5       5      S9  g [        R                   R#                  SR)                  X$R*                  5      5        g )	N)assetIdparentvalidateOnlygoogleCloudDataplexV1Assetvalidate_onlyFzValidation complete.async_zAsset created in [{0}])detailsz$Creating [{0}] with operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstance%projects_locations_lakes_zones_assetsr   GetMessageModule6DataplexProjectsLocationsLakesZonesAssetsCreateRequestNameParentRelativeNamerA   r:   getattrr   statusPrintWaitForOperationCreatedResourceformatname)r8   r9   	asset_refdataplex_clientcreate_req_oprA   rB   s          r   Run
Create.Runy   s@    ##))+I#557O#IIPP&&(__NN$##%224++'+';';D'A	 	` 	
M D/59M	jj-.T8U+F]+	
..
*6)""$11346 JJ;BB%%' (r    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr1   r:   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrX   __static_attributes__rZ   r   r   r   r   -   sT     -( " "H5 4457(7(r   r   c                   6    \ rS rSrSrSS0rS r\S 5       rSr	g)	CreateAlpha   r   r    r!   c                 .    [         R                  " U5      $ r5   )r   "GenerateAssetForCreateRequestAlphar7   s     r   r:   CreateAlpha.GenerateRequest   s    33D99r   c                     [        U 5        U R                  SSS9nUR                  SSS9  UR                  SSSS	S
.[        R                  SS9  UR                  SSSSS.[        R                  SS9  g r#   r,   r/   s     r   r1   CreateAlpha.Args   r3   r   rZ   N)
r[   r\   r]   r^   r_   r`   r:   ra   r1   rd   rZ   r   r   rf   rf      s1      -&: " "r   rf   N)r_   googlecloudsdk.api_lib.dataplexr   r   rF   googlecloudsdk.api_lib.utilr   rb   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   r   $googlecloudsdk.command_lib.util.apisr	   $googlecloudsdk.command_lib.util.argsr
   googlecloudsdk.corer   r   ReleaseTracksReleaseTrackGACommandr   ALPHArf   rZ   r   r   <module>ry      s    3 2 A F ( 5 = : < #+  D%%(()g(T\\ g( *g(T D%%++,H& H -Hr   