
                          &   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  \R(                  " \R*                  R,                  \R*                  R.                  5       " S S\R0                  5      5       rg)z8`gcloud dataplex datascans create data-profile` command.    )absolute_import)division)unicode_literals)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	)
DataProfile   zCreate a Dataplex data profile scan job.

Represents a user-visible job which provides the insights for the
related data source about the structure, content and relationships
(such as null percent, cardinality, min/max/mean, etc).
EXAMPLESa  
          To create a data profile scan `data-profile-datascan`
          in project `test-project` located in `us-central1` on bigquery resource table `test-table` in dataset `test-dataset`, run:

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

          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9nUR                  SSS9  UR                  SS9nUR                  SSS9  UR                  SSS9  UR                  SSS9  UR                  SSS9  UR                  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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 profile scan for.z--descriptionFz%Description of the data profile scan.)requiredhelpz--display-namez&Display name of the data profile scan.Tz&Data source for the data profile scan.)mutexr   r   z--data-source-entityzDataplex entity that contains the data for the data profile 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 profile scan, of the form: `//bigquery.googleapis.com/projects/{project_number}/datasets/{dataset_id}/tables/{table_id}`.z$Data spec for the data profile scan.)r   r   z--data-profile-spec-filezpath to the JSON/YAML file containing the spec for the data profile scan. The JSON representation reference: https://cloud.google.com/dataplex/docs/reference/rest/v1/DataProfileSpecz6Command line spec arguments for the data profile scan.z--row-filterz?A filter applied to all rows in a single data profile scan job.z--sampling-percentzTThe percentage of the records to be selected from the dataset for data profile scan.z--include-field-nameszNames of the fields to include in data profile. If not specified, all fields at the time of profile scan job execution are included. The fields listed in the `--exclude-field-names` flag are excluded.z--exclude-field-nameszNames of the fields to exclude from data profile. If specified, the respective fields will be excluded from data profile, regardless of the fields specified in the `--include-field-names` flag.z--export-results-tablezpath to the resource table to export data profile scan results, of the form: `//bigquery.googleapis.com/projects/{project_number}/datasets/{dataset_id}/tables/{table_id}`. The table will be created if not present.z%Data profile scan execution settings.z--incremental-fieldzRField that contains values that monotonically increase over time (e.g. timestamp).z2Data profile scan scheduling and trigger settings.z--on-demandzHIf set, the scan runs one-time shortly after data profile 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.z:At most one of --async | --validate-only can be specified.z--validate-only
store_truez:Validate the create action, but don't actually perform it.)actiondefaultr   )
r
   AddDatascanResourceArgadd_argument	add_groupboolr	   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserdata_source	data_specdata_spec_argexecution_spectriggerasync_groups          5lib/surface/dataplex/datascans/create/data_profile.pyArgsDataProfile.Args2   s   ((4 4  
 5  
 ""5 # K
 y    n     3 ! I "X   ''E ( M N   "   "   -    9   %%3 & N
 !    &&M ' G 	   C   ""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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PROFILE)
dataScanIdparentgoogleCloudDataplexV1DataScanvalidate_onlyFz1Validation completed. Skipping resource creation.async_z>Data profile scan created in project [{0}] with location [{1}])detailsz?Creating data profile scan with path [{0}] and operation [{1}].)CONCEPTSr   Parsesetattrdataplex_utilGetClientInstance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_opr2   responses          r'   RunDataProfile.Run   sG    ==))//1LD+y)#557O#@@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 CatchHTTPErrorRaiseHTTPExceptionrP   __static_attributes__rR   r*   r'   r   r      sQ      	- H- H-T 445""r*   r   N)rW   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r7   googlecloudsdk.api_lib.utilr   rZ   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rR   r*   r'   <module>ri      sp    ? &  ' 4 A F ( = < # D%%++T->->-A-ABC$,, C CCr*   