
    k                     ,   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z ddlmZ dd	lmZ dd
lmZ ddlmZ  ej(                  ddd       ej*                  ej,                  j.                         G d dej0                                      Zy)z*`gcloud dataplex datascan create` command.    )absolute_import)division)unicode_literals)datascan)util)
exceptions)base)resource_args)labels_util)logFzThis command is deprecated. Please use `gcloud alpha dataplex datascans create data-profile` instead to create a data profile scan and use `gcloud alpha dataplex datascans create data-quality` to create a data quality scan.zThis command has been removed. Please use `gcloud alpha dataplex datascans create data-profile` instead to create a data profile scan and use `gcloud alpha dataplex datascans create data-quality` to create a data quality scan.)
is_removedwarningerrorc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)CreatezCreate a Dataplex Datascan.EXAMPLESa  
            Create a Dataplex datascan job.

            Represents a user-visible job which provides the insights for the
            related data source. For example:
            - Data Quality: generates queries based on the rules and run against the
              data to get data quality check results.
            - Data Profile: analyzes the data in table(s) and generates insights about the
              structure, content and relationships (such as null percent, cardinality,
              min/max/mean, etc).

          c                 Z   t        j                  | d       | j                  ddd       | j                  ddd       | j                  dd	d
gdd       | j                  ddd      }|j                  dd       |j                  dd       | j                  dd      }|j                  d      }|j                  dd       |j                  d      }|j                  dd       | j                  d      }|j                  dd       |j                  d       }|j                  d!t        d"#       |j                  d$d%       | j                  ddd&      }|j                  d'd(dd)*       t
        j                  j                  |       t        j                  |        y )+Nzto create a Datascan for.z--descriptionFzDescription of the Datascan)requiredhelpz--display-namezDisplay name of the Datascanz--scan-typePROFILEQUALITYTzSpecify the type of scan)choicesr   r   zData source for the Datascan.)mutexr   r   z--data-source-entityzDataplex entity that contains the data for the Datascan, of the form: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.)r   z--data-source-resourcezService-qualified full resource name of the cloud resource that contains the data for the Datascan, of the form: `//bigquery.googleapis.com/projects/{project_number}/datasets/{dataset_id}/tables/{table_id}`.z0Additional configuration arguments for the scan.)r   r   z DataQualityScan related setting.z--data-quality-spec-filezPpath to the JSON file containing the Data Quality Spec for the Data Quality Scanz DataProfileScan related setting.z--data-profile-spec-filezPpath to the JSON file containing the Data Profile Spec for the Data Profile ScanzaDatascan execution settings. If not specified, the fields under it will use their default values.z--fieldzRField that contains values that monotonically increase over time (e.g. timestamp).z(Datascan scheduling and trigger settingsz--on-demandz?If set, the scan runs one-time shortly after Datascan 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_qualitydata_profileexecution_spectriggerasync_groups           'lib/surface/dataplex/datascan/create.pyArgszCreate.ArgsB   s=   ((1LM
%.K   5/M   I&'	   ""T(G # K y    n     ? ! I &&,N&OL"!   &&,N&OL"!   %%. & N !    &&7 ' G N  
 C   ""I # K
 I	   	OO,$$V,    z-Status code: {status_code}. {status_message}.c           	         |j                   j                  j                         }t        j                         }|j
                  j                  t        j                         j                  |j                         |j                         j                         t        j                  |                  }t        |dd      }|r t        j                  j!                  d       y t        |dd      }|s\t        j"                  |      }t        j$                  |j&                  dj)                  |j*                  |j,                               |S t        j                  j!                  dj)                  ||j&                               |S )	N)
dataScanIdparentgoogleCloudDataplexV1DataScanvalidate_onlyFzValidation complete.async_z5Datascan created in project [{0}] with location [{1}])detailsz6Creating Datascan with path [{0}] and operation [{1}].)CONCEPTSr   Parsedataplex_utilGetClientInstanceprojects_locations_dataScansr   GetMessageModule/DataplexProjectsLocationsDataScansCreateRequestNameParentRelativeName GenerateDatascanForCreateRequestgetattrr   statusPrintWaitForOperationCreatedResourcenameformat
projectsIdlocationsId)selfargsdatascan_refdataplex_clientcreate_req_opr4   r5   responses           r-   Runz
Create.Run   sG    ==))//1L#557O#@@GG&&(XX#((*&&(557*2*S*S+ 	Y 	
M D/59M	jj-.T8U+F**=9h	
--ELL))<+C+C oJJ@GG-,,	

 r/   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr.   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrQ    r/   r-   r   r      sT    $ $  -  c- c-J 5445$$r/   r   N)rU   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r9   googlecloudsdk.api_lib.utilr   rX   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   	DeprecateReleaseTracksReleaseTrackALPHACommandr   rZ   r/   r-   <module>rg      s    1 &  ' 4 A F ( = < # 	*	*  D%%++,`T\\ ` -!"`r/   