
                         8   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  \	R"                  \	R$                  " \	R&                  R(                  \	R&                  R*                  5       " S
 S\	R,                  5      5       5       rg)z>`gcloud dataplex datascans create data-documentation` command.    )datascan)util)
exceptions)base)resource_args)labels_util)log)
propertiesc                       \ rS rSrSr\R                  R                  R                  R                  5       rSS0r
\S 5       r\R                  " S5      S 5       rSrg	)
DataDocumentation   zuCreate a Dataplex data documentation scan job.

Allows users to generate documentation for Dataplex BigQuery tables.
EXAMPLESa  
          To create a data documentation scan `data-documentation-datascan`
          in project `test-project` located in `us-central1` on entity `test-entity`, run:

            $ {command} data-documentation-datascan --project=test-project --location=us-central1 --data-source-resource="//bigquery.{universe_domain}/projects/test-project/datasets/test-dataset/tables/test-table"

          c                 r   [         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nUR                  SSS9  UR                  SSS9  U R                  SS9nUR                  SSS9nUR                  S[        SS9  UR                  SSS9  UR                  SS9nUR                  SSSSS9  UR                  SSS9  U R                  SSSS
9nUR                  S SSS!S9  [
        R                  R                  U5        [        R                  " U 5        g )"Nz(to create a data documentation scan for.z--descriptionFz+Description of the data documentation scan.)requiredhelpz--display-namez,Display name of the data documentation scan.Tz,Data source for the data documentation scan.)mutexr   r   z--data-source-entityzThe Dataplex entity that contains the data for the data documentation scan, of the form: projects/{project_id_or_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}. Currently only BigQuery table is supported.)r   z--data-source-resourcezFully-qualified service resource name of the cloud resource that contains the data for the data documentation scan, of the form: //bigquery.{universe_domain}/projects/{project_id_or_number}/datasets/{dataset_id}/tables/{table_id}.z+Data documentation scan execution settings.z)Data documentation scan trigger settings.)r   r   z--on-demandzNIf set, the scan runs one-time shortly after data documentation scan creation.)typer   z
--schedulea  Cron schedule (https://en.wikipedia.org/wiki/Cron) for running scans periodically. To explicitly set a timezone to the cron tab, apply a prefix in the cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}". The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone database. For example, `CRON_TZ=America/New_York 1 * * * *` or `TZ=America/New_York 1 * * * *`. This field is required for RECURRING scans. The argument is only valid when --on-demand is not set.z2Data documentation scan one-time trigger settings.z
--one-time
store_trueznIf set, the data documentation scan runs once, and is auto-deleted once the ttl_after_scan_completion expires.)actiondefaultr   --ttl-after-scan-completiona  The time to live for one-time scans. Default value is 24 hours, minimum value is 0 seconds, and maximum value is 365 days. The time is calculated from the data scan job completion time. If value is set as 0 seconds, the scan will be immediately deleted upon job completion, regardless of whether the job succeeded or failed. The value should be a number followed by a unit suffix "s". Example: "100s" for 100 seconds. The argument is only valid when --one-time is set.z:At most one of --async | --validate-only can be specified.z--validate-onlyz:Validate the create action, but don't actually perform it.)
r   AddDatascanResourceArgadd_argument	add_groupboolr   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserdata_source_groupexecution_spectriggerone_time_triggerasync_groups         ;lib/surface/dataplex/datascans/create/data_documentation.pyArgsDataDocumentation.Args1   s   ((: :  
 ;  
 ((; ) 
 ""; #  "" u #  %%: & N &&D ' G 	   :   ((A )  !!; "  !!%& "  ""I # K
 I	   	OO,$$V,    z-Status code: {status_code}. {status_message}.c           	         UR                   R                  R                  5       n[        USS5        [        R
                  " 5       nUR                  R                  [        R                  " 5       R                  UR                  5       UR                  5       R                  5       [        R                  " U5      S95      nUR                  S5      (       a-  UR                  S5      (       d  [        R                   " SS5      e[#        USS	5      (       a   [$        R&                  R)                  S
5        g [#        USS	5      nU(       d[  [        R*                  " U5      n[$        R,                  " UR.                  SR1                  UR2                  UR4                  5      S9  U$ [$        R&                  R)                  SR1                  X$R.                  5      5        U$ )N	scan_typeDOCUMENTATION)
dataScanIdparentgoogleCloudDataplexV1DataScanttl_after_scan_completionone_timer   z-can only be specified when --one-time is set.validate_onlyFz1Validation completed. Skipping resource creation.async_zDData documentation scan created in project [{0}] with location [{1}])detailszECreating data documentation scan with path [{0}] and operation [{1}].)CONCEPTSr   Parsesetattrdataplex_utilGetClientInstanceprojects_locations_dataScansCreateGetMessageModule/DataplexProjectsLocationsDataScansCreateRequestNameParentRelativeName GenerateDatascanForCreateRequestIsSpecifiedr   InvalidArgumentExceptiongetattrr	   statusPrintWaitForOperationCreatedResourcenameformat
projectsIdlocationsId)selfargsdatascan_refdataplex_clientcreate_req_opr2   responses          r%   RunDataDocumentation.Run   s    ==))//1LD+/#557O#@@GG&&(XX#((*&&(557*2*S*S+ 	Y 	
M 	455  ,,//
'
9; ; t_e,,	jjJKT8U+F**=9h	
--vl55|7O7OP	 oJJO	00	1 r(    N)__name__
__module____qualname____firstlineno____doc__r
   VALUEScoreuniverse_domainGetdetailed_helpstaticmethodr&   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrR   __static_attributes__rT   r(   r%   r   r      sq    
 %%**::>>@/ 	- d- d-L 445''r(   r   N)rY   googlecloudsdk.api_lib.dataplexr   r   r7   googlecloudsdk.api_lib.utilr   r`   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer	   r
   UniverseCompatibleReleaseTracksReleaseTrackALPHAGACommandr   rT   r(   r%   <module>ro      s~    E 5 A F ( . = < # * D%%++T->->-A-ABc c C cr(   