
                         2   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  SSKJr  \R(                  " \R*                  R,                  \R*                  R.                  5       " S S\R0                  5      5       rg)z+`gcloud dataplex datascans update` 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   zUpdate 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 update description of a data profile scan `data-profile-datascan`
          in project `test-project` located in `us-central1`, run:

            $ {command} data-profile-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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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 profile scan for.z--descriptionFz$Description of the data profile scan)requiredhelpz--display-namez%Display name of the data profile scanTz$Data spec for the data profile scan.)mutexr   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/DataProfileSpec)r   z6Command 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%Data profile scan execution settings.z1Data profile scan scheduling and trigger settingsz--on-demandzHIf set, the scan runs one-time shortly after data profile 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	data_specdata_spec_argexecution_spectriggerasync_groups         5lib/surface/dataplex/datascans/update/data_profile.pyArgsDataProfile.Args3   s   ((4 3  
 4  
   3 ! I "X   ''E ( M N   "   "   -   %%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PROFILE,)namevalidateOnly
updateMaskgoogleCloudDataplexV1DataScanvalidate_onlyFz/Validation completed. Skipping resource update.async_z>Data profile scan updated in project [{0}] with location [{1}])detailsz?Updating data profile scan with path [{0}] and operation [{1}].)r   GenerateUpdateMasklenr   HttpExceptionCONCEPTSParsedataplex_utilGetClientInstanceGetMessageModulesetattrprojects_locations_dataScansPatch.DataplexProjectsLocationsDataScansPatchRequestRelativeNamer3   join GenerateDatascanForUpdateRequestgetattrr   statusPrintWaitForOperationUpdatedResourcer/   format
projectsIdlocationsId)	selfargsupdate_maskdatascan_refdataplex_clientmessageupdate_req_opr4   responses	            r&   RunDataProfile.Run   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 CatchHTTPErrorRaiseHTTPExceptionrU   __static_attributes__rW   r)   r&   r   r      sQ      	- `- `-D 445**r)   r   N)r\   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r;   googlecloudsdk.api_lib.utilr   r_   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rW   r)   r&   <module>rn      ss    2 &  ' 4 A F ( . = < # D%%++T->->-A-ABc$,, c Ccr)   