
                             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  \	R                   " \	R"                  R$                  \	R"                  R&                  5      \	R(                   " S	 S
\	R*                  5      5       5       rg)z8`gcloud dataplex datascans create data-quality` command.    )datascan)util)
exceptions)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	)
DataQuality   zCreate a Dataplex data quality scan job.

Represents a user-visible job which provides the insights for the
related data source and generates queries based on the rules and runs
against the data to get data quality check results.
EXAMPLESa  
          To create a data quality scan `data-quality-datascan`
          in project `test-project` located in `us-central1` on bigquery resource table `test-table` in dataset `test-dataset` with data spec file `data-quality-spec.json`, run:

            $ {command} data-quality-datascan --project=test-project --location=us-central1 --data-source-resource="//bigquery.googleapis.com/projects/test-project/datasets/test-dataset/tables/test-table" --data-quality-spec-file="data-quality-spec.json"
          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nUR                  SSS9  UR                  SSS9  U R                  SSSS9  U R                  SS9nUR                  SSS9  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 quality scan for.z--descriptionFz%Description of the data quality scan.)requiredhelpz--display-namez&Display name of the data quality scan.Tz&Data source for the data quality scan.)mutexr   r   z--data-source-entityzDataplex entity that contains the data for the data quality scan, of the form: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.)r   z--data-source-resourcezFully-qualified service resource name of the cloud resource that contains the data for the data quality scan, of the form: `//bigquery.googleapis.com/projects/{project_number}/datasets/{dataset_id}/tables/{table_id}`.z--data-quality-spec-filea.  Path to the JSON/YAML file containing the spec for the data quality scan. The JSON representation reference: https://cloud.google.com/dataplex/docs/reference/rest/v1/DataQualitySpec The YAML representation reference: https://cloud.google.com/dataplex/docs/use-auto-data-quality#create-scan-using-gcloudz%Data quality scan execution settings.z--incremental-fieldzRField that contains values that monotonically increase over time (e.g. timestamp).z1Data quality scan scheduling and trigger settings)r   r   z--on-demandzHIf set, the scan runs one-time shortly after data quality scan creation.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.z,Data quality scan one-time trigger settings.z
--one-time
store_truezeIf set, the data quality scan runs once, and auto deleted once the ttl_after_scan_completion expires.)actiondefaultr   z--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_groupr   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserdata_sourceexecution_spectriggerone_time_triggerasync_groups         5lib/surface/dataplex/datascans/create/data_quality.pyArgsDataQuality.Args/   s   ((4 4  
 5  
 ""T(P # K y    n   "e	  
 %%3 & N
 !    &&L ' G    C   ((; )  !!C "  !!%A "  ""I # K
 I	   	OO,$$V,    z-Status code: {status_code}. {status_message}.c           	      :   UR                   R                  R                  5       n[        R                  " 5       n[        USS5        UR                  R                  [        R                  " 5       R                  UR                  5       UR                  5       R                  5       [        R                  " U5      S95      n[        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R+                  UR,                  UR.                  5      S	9  U$ [        R                   R#                  S
R+                  X$R(                  5      5        U$ )N	scan_typeQUALITY)
dataScanIdparentgoogleCloudDataplexV1DataScanvalidate_onlyFz1Validation completed. Skipping resource creation.async_z>Data quality scan created in project [{0}] with location [{1}])detailsz?Creating Data quality scan with path [{0}] and operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstancesetattrprojects_locations_dataScansCreateGetMessageModule/DataplexProjectsLocationsDataScansCreateRequestNameParentRelativeName GenerateDatascanForCreateRequestgetattrr	   statusPrintWaitForOperationCreatedResourcenameformat
projectsIdlocationsId)selfargsdatascan_refdataplex_clientcreate_req_opr,   responses          r!   RunDataQuality.Run   sG    ==))//1L#557OD+y)#@@GG&&(XX#((*&&(557*2*S*S+ 	Y 	
M t_e,,	jjJKT8U+F**=9h	
--Nvl--|/G/GH	 oJJI	00	1 r$    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr"   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrJ   __static_attributes__rL   r$   r!   r   r      sQ      - u- u-n 445""r$   r   N)rQ   googlecloudsdk.api_lib.dataplexr   r   r0   googlecloudsdk.api_lib.utilr   rT   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer	   ReleaseTracksReleaseTrackALPHAGAUniverseCompatibleCommandr   rL   r$   r!   <module>rc      sw    ? 5 A F ( = < # D%%++T->->-A-ABo$,, o  Cor$   