
                         ,   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  \	R                   " \	R"                  R$                  \	R"                  R&                  5      \	R(                   " S	 S
\	R*                  5      5       5       rg)z+`gcloud dataplex datascans update` 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   zUpdate 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 update description of a data quality scan `data-quality-datascan`
          in project `test-project` located in `us-central1`, run:

            $ {command} data-quality-datascan --project=test-project --location=us-central1 --description="Description is updated."

          c                    [         R                  " U S5        U R                  SSSS9  U R                  S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SS9nUR                  SSSSS9  [
        R                  R                  U5        [        R                  " U 5        g )Nz"to update a data quality scan for.z--descriptionFz$Description of the data quality scan)requiredhelpz--display-namez%Display name of the data quality scanz--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-gcloud)r   z%Data quality scan execution settings.Tz1Data quality scan scheduling and trigger settings)mutexr   z--on-demandzHIf set, the scan runs one-time shortly after data quality scan updation.)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.)r   r   r   z--validate-only
store_truez:Validate the update action, but don't actually perform it.)actiondefaultr   )
r   AddDatascanResourceArgadd_argument	add_groupboolr   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserexecution_spectriggerasync_groups       5lib/surface/dataplex/datascans/update/data_quality.pyArgsDataQuality.Args1   sH   ((4 3  
 4  
 "e  	 %%4 & N &&L ' G 	   C   ""I # K
 I	   	OO,$$V,    z-Status code: {status_code}. {status_message}.c           
         [         R                  " U5      n[        U5      S:  a  [        R                  " S5      eUR
                  R                   R                  5       n[        R                  " 5       n[        R                  " 5       n[        USS5        UR                  R                  UR                  UR                  5       UR                  SR!                  U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R0                  SR3                  UR4                  UR6                  5      S9  U$ [&        R(                  R+                  SR3                  X6R0                  5      5        U$ )N   zIUpdate commands must specify at least one additional parameter to change.	scan_typeQUALITY,)namevalidateOnly
updateMaskgoogleCloudDataplexV1DataScanvalidate_onlyFz/Validation completed. Skipping resource update.async_z>Data quality scan updated in project [{0}] with location [{1}])detailsz?Updating data quality scan with path [{0}] and operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstanceGetMessageModulesetattrprojects_locations_dataScansPatch.DataplexProjectsLocationsDataScansPatchRequestRelativeNamer.   join GenerateDatascanForUpdateRequestgetattrr	   statusPrintWaitForOperationUpdatedResourcer*   format
projectsIdlocationsId)	selfargsupdate_maskdatascan_refdataplex_clientmessageupdate_req_opr/   responses	            r!   RunDataQuality.Runr   s    --d3K
;!$$  ==))//1L#557O,,.GD+y)#@@FF>>**,++xx,*2*S*S+	 	? 	
	M t_e,,	jjHI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      sO      	- >- >-@ 445**r$   r   N)rW   googlecloudsdk.api_lib.dataplexr   r   r6   googlecloudsdk.api_lib.utilr   rZ   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer	   ReleaseTracksReleaseTrackALPHAGAUniverseCompatibleCommandr   rR   r$   r!   <module>ri      sz    2 5 A F ( . = < # D%%++T->->-A-ABA$,, A  CAr$   