
    q                        S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSK	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  SSKrSrSrSrS r S r!S r"S#S jr# " S S5      r$ " S S5      r% " S S5      r& " S S5      r' " S S 5      r( " S! S"5      r)g)$z4Helpers for interacting with the Cloud Dataflow API.    )absolute_import)division)unicode_literalsN)encoding)
exceptions)cloudbuild_util)storage_api)storage_util)apis)submit_util)log)
properties)filesdataflowv1b3zus-central1c                  @    [         R                  " [        [        5      $ N)r   GetMessagesModuleDATAFLOW_API_NAMEDATAFLOW_API_VERSION     +lib/googlecloudsdk/api_lib/dataflow/apis.pyr   r   .       			 13G	HHr   c                  @    [         R                  " [        [        5      $ r   )r   GetClientInstancer   r   r   r   r   r   r   2   r   r   c                  d    [         R                  R                  R                  R	                  SS9$ )NT)required)r   VALUEScoreprojectGetr   r   r   
GetProjectr#   6   s(    						'	'	+	+T	+	::r   c                 (    U(       d  SU  S3$ SU  S3$ )z/Returns full the image path of the given image.zgcr.io/dataflow-templates-base/z-template-launcher-base:latestz)-template-launcher-base-distroless:latestr   )imageis_distrolesss     r   _GetBaseImagePathr'   :   s)    	
)%0NO +5'1Z	[[r   c                   @   \ rS rSrSr\" 5       R                  r\" 5       R                  r	\" 5       R                  r\" 5       R                  r\S 5       r\SS j5       r\SS j5       r\      SS j5       r\SS j5       r\  SS	 j5       r\    SS
 j5       rSrg)JobsC   z'The Jobs set of Dataflow API functions.c                  *    [        5       R                  $ r   r   projects_locations_jobsr   r   r   
GetServiceJobs.GetServiceM       666r   Nc                 "   U=(       d
    [        5       nU=(       d    [        n[        5       R                  XXS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a3  Calls the Dataflow Jobs.Get method.

Args:
  job_id: Identifies a single job.
  project_id: The project which owns the job.
  region_id: The regional endpoint where the job lives.
  view: (DataflowProjectsJobsGetRequest.ViewValueValuesEnum) Level of
    information requested in response.

Returns:
  (Job)
)jobIdlocation	projectIdviewN)r#   DATAFLOW_API_DEFAULT_REGIONr   'DataflowProjectsLocationsJobsGetRequestr)   r.   r"   apitools_exceptions	HttpErrorr   HttpException)job_id
project_id	region_idr5   requesterrors         r   r"   Jobs.GetQ   s~     +z|J88I!IIJ J KG,__""7++(( ,$$U++,   "A B3B		Bc                 H   U=(       d
    [        5       nU=(       d    [        nSnU(       aL  [        5       R                  R	                  [        5       R                  R                  R                  SSS9/S9n[        5       R                  U[        5       R                  R                  R                  S9n[        5       R                  XX%S9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCancels a job by calling the Jobs.Update method.

Args:
  job_id: Identifies a single job.
  force: True to forcibly cancel the job.
  project_id: The project which owns the job.
  region_id: The regional endpoint where the job lives.

Returns:
  (Job)
Nforce_cancel_jobtruekeyvalueadditionalProperties)labelsrequestedStater2   r3   r4   job)r#   r6   r   JobLabelsValueAdditionalPropertyRequestedStateValueValuesEnumJOB_STATE_CANCELLED*DataflowProjectsLocationsJobsUpdateRequestr)   r.   Updater8   r9   r   r:   )r;   forcer<   r=   rJ   rM   r>   r?   s           r   CancelJobs.Canceli   s    +z|J88IF "&&22


!
!
-
-
@
@$F A 4I2 	f 

!
!)+//MM,, " /C  !LLJ M IG,__%%g..(( ,$$U++,s   "C2 2D!DD!c                 B   U=(       d
    [        5       nU=(       d    [        n[        5       R                  [        5       R	                  UUU(       a  SOUS9S9n/ nUb  UR                  S5        Ub  UR                  S5        Uc  U(       a  UR                  S5        SR                  U5      n	[        5       R                  U UUUU	S9n
 [        R                  5       R                  U
5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)	a  Update pipeline options on a running job.

You should specify at-least one (or both) of min_num_workers and
max_num_workers.

Args:
  job_id: ID of job to update
  project_id: Project of the job
  region_id: Region the job is in
  min_num_workers: Lower-bound for worker autoscaling
  max_num_workers: Upper-bound for worker autoscaling
  worker_utilization_hint: Target CPU utilization for worker autoscaling
  unset_worker_utilization_hint: Unsets worker_utilization_hint value

Returns:
  The updated Job
N)minNumWorkersmaxNumWorkersworkerUtilizationHint)runtimeUpdatableParamsz(runtime_updatable_params.min_num_workersz(runtime_updatable_params.max_num_workersz0runtime_updatable_params.worker_utilization_hint,)r2   r3   r4   rM   
updateMask)r#   r6   r   rN   RuntimeUpdatableParamsappendjoinrS   r)   r.   rT   r8   r9   r   r:   )r;   r<   r=   min_num_workersmax_num_workersworker_utilization_hintunset_worker_utilization_hintrM   update_mask_piecesupdate_maskr>   r?   s               r   UpdateOptionsJobs.UpdateOptions   s&   8 +z|J88I


!
!02II)) 1 ,  J  
 " 
C " JK" JK+(
< ((-.K!LL M G,__%%g..(( ,$$U++,s   "C/ /DDDc                    U=(       d
    [        5       nU=(       d    [        n[        5       R                  [        5       R                  R                  R
                  S9n[        5       R                  XXS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zDrains a job by calling the Jobs.Update method.

Args:
  job_id: Identifies a single job.
  project_id: The project which owns the job.
  region_id: The regional endpoint where the job lives.

Returns:
  (Job)
)rK   rL   N)r#   r6   r   rN   rQ   JOB_STATE_DRAINEDrS   r)   r.   rT   r8   r9   r   r:   )r;   r<   r=   rM   r>   r?   s         r   Drain
Jobs.Drain   s     +z|J88I


!
!)+//MM** " -C  !LLJ M IG,__%%g..(( ,$$U++,s   9"B C0CCc                    U=(       d
    [        5       nU=(       d    [        n[        5       R                  U/S9n[        5       R	                  US9n[        5       R                  XX%S9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a5  Resumes a job by calling the Jobs.Update method.

Args:
  job_id: Identifies a single job.
  experiment_with_token: The resume token unique to the job prefixed with
    the experiment key.
  project_id: The project which owns the job.
  region_id: The regional endpoint where the job lives.

Returns:
  (Job)
)experiments)environmentrL   N)r#   r6   r   EnvironmentrN   rS   r)   r.   rT   r8   r9   r   r:   )r;   experiment_with_tokenr<   r=   rp   rM   r>   r?   s           r   ResumeUnsupportedSDKJobs.ResumeUnsupportedSDK   s    " +z|J88I#%11*+ 2 -K


!
!k
!
:C!LLJ M IG,__%%g..(( ,$$U++,s   +"B B="B88B=c                 R   U=(       d
    [        5       nU=(       d    [        n[        5       R                  U UU[        5       R	                  X#US9S9n [
        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a>  Takes a snapshot of a job via the Jobs.Snapshot method.

Args:
  job_id: Identifies a single job.
  project_id: The project which owns the job.
  region_id: The regional endpoint where the job lives.
  ttl: The ttl for the snapshot.
  snapshot_sources: If true, the sources will be snapshotted.

Returns:
  (Snapshot)
)r3   ttlsnapshotSources)r2   r3   r4   snapshotJobRequestN)r#   r6   r   ,DataflowProjectsLocationsJobsSnapshotRequestSnapshotJobRequestr)   r.   Snapshotr8   r9   r   r:   )r;   r<   r=   rv   snapshot_sourcesr>   r?   s          r   r{   Jobs.Snapshot  s    $ +z|J88I!NN,.AA9I B K	 O G,__''00(( ,$$U++,s   "A7 7B&B!!B&r   NNN)FNN)NNNNNN)NN)NN604800sF)__name__
__module____qualname____firstlineno____doc__r   r7   GET_REQUEST(DataflowProjectsLocationsJobsListRequestLIST_REQUEST%DataflowProjectsJobsAggregatedRequestAGGREGATED_LIST_REQUESTrS   UPDATE_REQUESTstaticmethodr.   r"   rV   rh   rl   rs   r{   __static_attributes__r   r   r   r)   r)   C   s    /!#KK+"$MM,- )) $ ..  7 7 , ,. , ,@  "$(A, A,F , ,0  '+%), ,8  %	, ,r   r)   c                   ^    \ rS rSrSr\" 5       R                  r\S 5       r	\SS j5       r
Srg)Metricsi&  z*The Metrics set of Dataflow API functions.c                  *    [        5       R                  $ r   r,   r   r   r   r.   Metrics.GetService,  r0   r   Nc                 &   U=(       d
    [        5       nU=(       d    [        n[        5       R                  U UUUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a]  Calls the Dataflow Metrics.Get method.

Args:
  job_id: The job to get messages for.
  project_id: The project which owns the job.
  region_id: The regional endpoint of the job.
  start_time: Return only metric data that has changed since this time.
    Default is to return all information about all metrics for the job.

Returns:
  (MetricUpdate)
)r2   r3   r4   	startTimeN)r#   r6   r   .DataflowProjectsLocationsJobsGetMetricsRequestr   r.   
GetMetricsr8   r9   r   r:   )r;   r<   r=   
start_timer>   r?   s         r   r"   Metrics.Get0  s     +z|J88I 44	 5  ,!,,W55(( ,$$U++,s   "A! !B5BBr   r~   )r   r   r   r   r   r   r   r   r   r.   r"   r   r   r   r   r   r   &  s@    2! 22  7 7 , ,r   r   c                       \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr                          SS jrSr g)TemplateArgumentsiM  z%Wrapper class for template arguments.Nc                 R   Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        g r   )r<   r=   job_namegcs_locationzonemax_workersnum_workersnetwork
subnetworkworker_machine_typelauncher_machine_typestaging_locationtemp_locationkms_key_namedisable_public_ips
parametersservice_account_emailworker_regionworker_zoneenable_streaming_engineadditional_experimentsadditional_pipeline_optionsadditional_user_labelsstreaming_updatetransform_name_mappingsflexrs_goal)selfr<   r=   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s                              r   __init__TemplateArguments.__init__k  s    6 !ONM$I""L O2!6,&$0 DO!6D&D"D#:D "8D'BD$"8D,D#:D "Dr   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r<   r=   r   r   r   r   r   r   r   r   r   r   )NNNNNNNNNNNNNNNNNNNNNNNNNN)!r   r   r   r   r   r<   r=   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   M  s    -*),(	$++'*-,*-+  $ +  #'%) $! "&%)!'+&*+/&* $'+54#r   r   c                      \ rS rSrSr\" 5       R                  r\" 5       R                  r	\	R                  r\" 5       R                  r\R                  r\" 5       R                  r\R"                  r\	R&                  r\" 5       R*                  r\R                  r\R0                  r\" 5       R                  R4                  r\" 5       R                  R8                  r\" 5       R<                  r\" 5       R@                  r!\" 5       R@                  RD                  r#\" 5       RH                  r%\&" S5      r'\&" S5      r(\&" S5      r)\&" S5      r*\&" SS5      r+\&" SS5      r,\&" SS5      r-\&" SS5      r.\&" S5      r/\&" S	5      r0\&" S	S5      r1S
r2\3Rh                  \3Rj                  -  \3Rl                  -  r7\3Rp                  \3Rr                  -  \3Rt                  -  \3Rv                  -  r<\3Rh                  \3Rz                  -  \3Rt                  -  \3R|                  -  \3Rv                  -  r?\@S 5       rA\@S 5       rB\@S#S j5       rC\@S#S j5       rD\@S 5       rE\@S 5       rF\@S 5       rG\@S 5       rH\@S 5       rI\@S 5       rJ\@S 5       rK\@S 5       rL\@S 5       rM\@S 5       rN\@S 5       rO\@S 5       rP\@S 5       rQ\@    S$S j5       rR\@S 5       rS\@S 5       rT\@S  5       rU\@S#S! j5       rVS"rWg)%	Templatesi  z,The Templates set of Dataflow API functions.java11java17java21java25Tpython3goz4gs://dataflow-templates-{}/latest/flex/Yaml_Templatec                  *    [        5       R                  $ r   )r   projects_locations_templatesr   r   r   r.   Templates.GetService      ;;;r   c                  *    [        5       R                  $ r   )r    projects_locations_flexTemplatesr   r   r   GetFlexTemplateService Templates.GetFlexTemplateService      ???r   Nc                 V   / nU R                   nU(       a  [        R                  " U5      O0  H1  u  p4UR                  [        R
                  R                  X4S95        M3     U R                  =(       d    [        n[        5       R                  R                  nUR                  nU R                  (       a  UOSn[        5       R                  R                  n	[        R                  U R                   U	5      n
[        R#                  U R$                  U R&                  U[        5       R                  U R(                  U R*                  U R,                  U R.                  U R0                  U R2                  U R4                  U R6                  U R8                  UU R:                  U R<                  U R>                  U
(       a  U	" U
S9OSU R@                  (       a  U R@                  O/ U RB                  (       a  U RB                  O/ S9U(       a  [        R                  US9OSS9n[        5       RE                  U RF                  =(       d
    [I        5       UUS9n [        RK                  5       RM                  U5      $ ! [N        RP                   a  n[R        RT                  " U5      eSnAff = f)z|Calls the Dataflow Templates.CreateFromJob method.

Args:
  template_args: Arguments for create template.

Returns:
  (Job)
rE   NrH   )serviceAccountEmailr   
maxWorkers
numWorkersr   r   machineTypetempLocation
kmsKeyNameipConfigurationworkerRegion
workerZoneenableStreamingEngineadditionalUserLabelsadditionalExperimentsadditionalPipelineOptions)gcsPathjobNamer3   rp   r   )r4   r3   createJobFromTemplateRequest)+r   six	iteritemsr`   r   PARAMETERS_VALUErP   r=   r6   r   RuntimeEnvironmentIpConfigurationValueValuesEnumWORKER_IP_PRIVATEr   AdditionalUserLabelsValue _Templates__ConvertDictArgumentsr   CREATE_REQUESTr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   /DataflowProjectsLocationsTemplatesCreateRequestr<   r#   r.   Creater8   r9   r   r:   )template_argsparams_listr   kvr=   ip_configuration_enum
ip_privateip_configurationuser_labels_valueuser_labels_listbodyr>   r?   s                 r   r   Templates.Create  sj    K))J-7j)R?

$
$
7
7A
7
GI @
 ''F+FI- 77 &88J%2%E%Ez4) 22  77,, ##**&&%':: - C C##$00$00!))$//%99&77$11,&44$00"/"G"G   "3%5"7%) !77 44 !<< 993 ; 8 2< --!, . .AEA $  GDB   55**:jl%) 6 + ,!!#**733(( ,$$U++,s   "I9 9J(J##J(c                 X   / nU R                   nU(       a  [        R                  " U5      O0  H1  u  p4UR                  [        R
                  R                  X4S95        M3     [        R                  U R                  [        R                  5      nSnSnU R                  (       a&  U R                  nU(       a  [        R                  US9nU R                  =(       d    [        n[        5       R                  R                  n	U	R                   n
U R"                  (       a  U
OSn[        R%                  [        5       R                  U R&                  U R(                  U R*                  U R,                  U R.                  U R0                  U R2                  U R4                  U R6                  UU R8                  U R:                  U R<                  U R>                  (       a  U R>                  O/ S9U R@                  U(       a  [        R                  US9OSUUS9n[        5       RC                  U RD                  UUU RF                  =(       d
    [I        5       SS9n [        RK                  5       RM                  U5      $ ! [N        RP                   a  n[R        RT                  " U5      eSnAff = f)zCalls the Dataflow Templates.LaunchTemplate method on a dynamic template.

Args:
  template_args: Arguments to create template. gcs_location must point to a
    Json serialized DynamicTemplateFileSpec.

Returns:
  (LaunchTemplateResponse)
rE   NrH   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rp   r   r   updatetransformNameMappingF)r   r3   launchTemplateParametersr4   validateOnly)+r   r   r   r`   r    LAUNCH_TEMPLATE_PARAMETERS_VALUErP   r   r   -DYNAMIC_TEMPLATE_TRANSFORM_NAME_MAPPING_VALUEr   r=   r6   r   r   r   r   r   LAUNCH_TEMPLATE_PARAMETERSr   r   r   r   r   r   r   r   r   r   r   r   r   r   /DataflowProjectsLocationsTemplatesLaunchRequestr   r<   r#   r.   Launchr8   r9   r   r:   )r   r   r   r   r   transform_mapping_listtransform_mappingsr   r=   r   r   r   r   r>   r?   s                  r   LaunchDynamicTemplateTemplates.LaunchDynamicTemplate(  sr    K))J-7j)R?

4
4
G
G H  @
 '==--?? %%&77	CC%; D  	 ''F+FI- 77 &88J%2%E%Ez4//%':: - C C##$00$00!))$//%99&77$11,&44$00"/"G"G !77 44# ; 
( &&1< ==!, > .BF/3 0 D8 	KK!..%)#..>*, 	L 	
 ,!!#**733(( ,$$U++,s   "I: :J)J$$J)c                     / nU (       a=  [         R                  " U 5       H#  u  p4UR                  UR                  X4S95        M%     U$ )zConvert dictionary arguments to parameter list .

Args:
  arguments: Arguments for create job using template.
  value_message: the value message of the arguments

Returns:
  List of value_message.AdditionalProperty
rE   )r   r   r`   rP   )	argumentsvalue_messager   r   r   s        r   __ConvertDictArguments Templates.__ConvertDictArguments{  sE     K--	*$!=;;;KL + r   c                    SnSnSUS'   [        UR                  5       5       VVs/ s H  u  pVSR                  XV5      PM     nnnSR                  U5      nSR                  U5      n	SR                  U	5      n
[        R
                  " U5      R                  [        R                  U 5      UU
SR                  U5      S	9nU$ s  snnf )
a*  Builds Dockerfile contents for java flex template image.

Args:
  flex_template_base_image: SDK version or base image to use.
  pipeline_paths: List of paths to pipelines and dependencies.
  env: Dictionary of env variables to set in the container image.

Returns:
  Dockerfile contents as string.
B
    FROM {base_image}

    {env}

    {copy}

    {commands}
     z/template/*FLEX_TEMPLATE_JAVA_CLASSPATH	ENV {}={}
 COPY {} /template/
base_imageenvcopycommands)sorteditemsformatra   textwrapdedentr   _GetFlexTemplateBaseImage)flex_template_base_imagepipeline_pathsr
  dockerfile_templater  r   r   envsenv_listpathscopy_commanddockerfile_contentss               r   BuildJavaImageDockerfile"Templates.BuildJavaImageDockerfile  s     H*7C&'17		1DE1DKq$1DDEyyHHH^$E'..u5L"//*=>EE66$&8$ F &  Fs   Cc           	      $   Sn/ SQnSUS    3US'   SU;   ai  US   R                  S5      nU(       aN  U Vs/ s H  nSU 3PM
     nnSR                  U5      US'   SR                  U5      nUR                  SU 35        S	U;   a3  SUS	    3US	'   UR                  S
US	    35        UR                  S5        SU;   a  SUS    3US'   [        UR	                  5       5       V	V
s/ s H  u  pSR                  X5      PM     nn	n
SR                  U5      nSR                  U5      nSR                  U5      n[        R                  " U5      R                  [        R                  U 5      UUSSR                  U5      -   S9nU$ s  snf s  sn
n	f )a,  Builds Dockerfile contents for python flex template image.

Args:
  flex_template_base_image: SDK version or base image to use.
  pipeline_paths: List of paths to pipelines and dependencies.
  env: Dictionary of env variables to set in the container image.

Returns:
  Dockerfile contents as string.
r  )zapt-get updatez!apt-get install -y libffi-dev gitzrm -rf /var/lib/apt/lists/*z
/template/FLEX_TEMPLATE_PYTHON_PY_FILE#FLEX_TEMPLATE_PYTHON_EXTRA_PACKAGESr]   r  zpip install &FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILEz!pip install --no-cache-dir -U -r a  (pip check || (e=$?; echo "Building a container with incompatible dependencies is prevented by default. If you are sure you want to proceed, you need to create your own container image. See: https://cloud.google.com/dataflow/docs/guides/templates/configuring-flex-templates"; exit $e))FLEX_TEMPLATE_PYTHON_SETUP_FILEr  r  r  zRUN z && r  )
splitra   r`   r  r  r  r  r  r   r  )r  r  r
  r  r  package_listpackagepackages_pathpackage_argr   r   r  r  r  r  r  s                   r   BuildPythonImageDockerfile$Templates.BuildPythonImageDockerfile  s   H S789: &' -3>?EEcJl	?KL|G:gY/|L58XXm5L12hh}-;-(	
 036sCDE
F 

23 oo:;<> oo )C/s<=>
? 

+, 28		1DE1DKq$1DDEyyHHH^$E'..u5L"//*=>EE66$&&++h// F 1 K M4 Fs   F'Fc                    SnSR                  US   5      US'   SR                  U5      nSR                  U5      n[        UR                  5       5       VVs/ s H  u  pgSR                  Xg5      PM     nnnSR                  U5      n	[        R
                  " U5      R                  [        R                  U 5      U	US9n
U
$ s  snnf )	a  Builds Dockerfile contents for go flex template image.

Args:
  flex_template_base_image: SDK version or base image to use.
  pipeline_paths: Path to pipeline binary.
  env: Dictionary of env variables to set in the container image.

Returns:
  Dockerfile contents as string.
z2
    FROM {base_image}

    {env}

    {copy}
    z/template/{}FLEX_TEMPLATE_GO_BINARYr  r  r  r  )r	  r
  r  )r  ra   r  r  r  r  r   r  )r  r  r
  r  r  r  varvalr  r  r  s              r   BuildGoImageDockerfile Templates.BuildGoImageDockerfile  s     &4%:%:%&&(C!"HH^$E'..u5L 6<CIIK5H5H3$5H 	  yyH"//*=>EE66$&	 F  s   Cc                     US:X  a  [         R                  U X5      $ US:X  a  [         R                  U X5      $ US:X  a  [         R                  U X5      $ g)aX  Builds Dockerfile contents for flex template image.

Args:
  flex_template_base_image: SDK version or base image to use.
  pipeline_paths: List of paths to pipelines and dependencies.
  env: Dictionary of env variables to set in the container image.
  sdk_language: SDK language of the flex template.

Returns:
  Dockerfile contents as string.
JAVAPYTHONGON)r   r  r'  r-  )r  r  r
  sdk_languages       r   BuildDockerfileTemplates.BuildDockerfile$  sr     v//0H0>E E		!112J2@G G		--.F.<C C 
r   c                    U  H  nUR                   (       d  [        SR                  U5      5      eUR                  (       d  [        SR                  U5      5      eUR                  (       a  Ml  [        SR                  U5      5      e   g)zValidates ParameterMetadata objects in template metadata.

Args:
  parameters: List of ParameterMetadata objects.

Raises:
  ValueError: If is any of the required field is not set.
zGInvalid template metadata. Parameter name field is empty. Parameter: {}zHInvalid template metadata. Parameter label field is empty. Parameter: {}zKInvalid template metadata. Parameter helpText field is empty. Parameter: {}N)name
ValueErrorr  labelhelpText)r   	parameters     r   _ValidateTemplateParameters%Templates._ValidateTemplateParameters<  s      	^^#VI.0 	0 __#VI.0 	0 #VI.0 	0  r   c                     US:X  a  SU ;  a  [        S5      eUS:X  a  SU ;  a  [        S5      eUS:X  a  SU ;  a  [        S	5      eg
)a  Builds and validates Flex template environment values.

Args:
  env: Dictionary of env variables to set in the container image.
  sdk_language: SDK language of the flex template.

Returns:
  True on valid env values.

Raises:
  ValueError: If is any of parameter value is invalid.
r0  FLEX_TEMPLATE_JAVA_MAIN_CLASSzXFLEX_TEMPLATE_JAVA_MAIN_CLASS environment variable should be provided for all JAVA jobs.r1  r  zYFLEX_TEMPLATE_PYTHON_PY_FILE environment variable should be provided for all PYTHON jobs.r2  r*  zPFLEX_TEMPLATE_GO_BINARY environment variable should be provided for all GO jobs.T)r8  )r
  r3  s     r   __ValidateFlexTemplateEnv#Templates.__ValidateFlexTemplateEnvT  su     v"A"L @ B B		!&DC&O B D D		";3"F > @ @r   c                    [         R                  " [        R                  U 5      n[        R                  5       nUR                  (       d  [        SR                  U5      5      eUR                  Ul        UR                  (       a  UR                  Ul        UR                  (       a0  [        R                  UR                  5        UR                  Ul        UR                  (       a  UR                  Ul
        U$ )zBuilds and validates TemplateMetadata object.

Args:
  template_metadata_json: Template metadata in json format.

Returns:
  TemplateMetadata object on success.

Raises:
  ValueError: If is any of the required field is not set.
zEInvalid template metadata. Name field is empty. Template Metadata: {})r   JsonToMessager   TEMPLATE_METADATAr7  r8  r  descriptionr   r<  yamlDefinition)template_metadata_jsontemplate_metadatatemplate_metadata_objs      r   _BuildTemplateMetadata Templates._BuildTemplateMetadatam  s     !..y/J/J/EG%779!! 0067H0IK K!2!7!7$$*;*G*G'##++,=,H,HI):)E)E&''->-M-M*  r   c                 >   U R                   (       a  U R                   $ U R                  (       a  U R                  $ U R                  (       a    [        R	                  U R                  5      $ [        R	                  [        5      $ ! [
        R                   a     N/f = f)+Returns the image path for a YAML template.)r%   
yaml_imager   r   _ExtractYamlTemplateImager   r:   r6   )argss    r   GetYamlTemplateImageTemplates.GetYamlTemplateImage  s{     zzZZ	__ 2243E3EFF ../JKK %% s   B BBc                 n   [         R                  R                  U 5      n[        R                  " 5       n[
        R                  R                  U5      n [        R                  " UR                  U5      5      nUS   $ ! [         a+  n[        R                  " SR                  U5      5      UeSnAff = f)rM  zSUnable to read file {0} due to incorrect file path or insufficient read permissionsNr%   )r   YAML_TEMPLATE_GCS_LOCATIONr  r	   StorageClientr
   ObjectReferenceFromUrljsonload
ReadObject	Exceptionr   r:   )r=   yaml_gcl_template_pathstorage_clientobj_refgeneric_template_definitiones         r   rO  #Templates._ExtractYamlTemplateImage  s     'AAHH !..0N**223IJG$(II

#
#G
,%! 'w//  $$$f%;< s   %A? ?
B4	&B//B4c                 B   U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R
                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S	:X  a&  [        R                  " S
5        [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U $ )a  Returns latest base image for given sdk version.

Args:
    flex_template_base_image: SDK version or base image to use.

Returns:
  If a custom base image value is given, returns the same value. Else,
  returns the latest base image for the given sdk version.
JAVA11JAVA17JAVA21JAVA25JAVA11_DISTROLESSJAVA17_DISTROLESSJAVA21_DISTROLESSJAVA25_DISTROLESSJAVA8z]JAVA8 is deprecated and redirected to JAVA11. This option will be removed in a future releasePYTHON3r2  GO_DISTROLESS)r   FLEX_TEMPLATE_JAVA11_BASE_IMAGEFLEX_TEMPLATE_JAVA17_BASE_IMAGEFLEX_TEMPLATE_JAVA21_BASE_IMAGEFLEX_TEMPLATE_JAVA25_BASE_IMAGE*FLEX_TEMPLATE_JAVA11_DISTROLESS_BASE_IMAGE*FLEX_TEMPLATE_JAVA17_DISTROLESS_BASE_IMAGE*FLEX_TEMPLATE_JAVA21_DISTROLESS_BASE_IMAGE*FLEX_TEMPLATE_JAVA25_DISTROLESS_BASE_IMAGEr   warning FLEX_TEMPLATE_PYTHON3_BASE_IMAGEFLEX_TEMPLATE_GO_BASE_IMAGE&FLEX_TEMPLATE_GO_DISTROLESS_BASE_IMAGE)r  s    r   r  #Templates._GetFlexTemplateBaseImage  s     8+666	!X	-666	!X	-666	!X	-666	!%8	8AAA	!%8	8AAA	!%8	8AAA	!%8	8AAA	!W	,	kk0 666	!Y	.777	!T	)222	!_	4===##r   c                    U S:X  a+  [         R                  [         R                  R                  S9$ U S:X  a+  [         R                  [         R                  R                  S9$ U S:X  a+  [         R                  [         R                  R
                  S9$ U S:X  a+  [         R                  [         R                  R                  S9$ g)zlBuilds SDKInfo object.

Args:
  sdk_language: SDK language of the flex template.

Returns:
  SDKInfo object
r0  )languager1  YAMLr2  N)r   SDK_INFOSDK_LANGUAGEr0  r1  r}  r2  )r3  s    r   _BuildSDKInfoTemplates._BuildSDKInfo  s     v)?)?)D)DEE		!)?)?)F)FGG		)?)?)D)DEE		)?)?)B)BCC 
r   c                 V   [         R                  " 5        n[        R                  R	                  US5      n[         R
                  " X1SS9  [        R                  " 5       n[        R                  R                  U 5      nUR                  X55      sSSS5        $ ! , (       d  f       g= f)a"  Stores flex template container spec file in GCS.

Args:
  template_file_gcs_location: GCS location to store the template file.
  container_spec_json: Container spec in json format.

Returns:
  Returns the stored flex template file gcs object on success.
  Propagates the error on failures.
ztemplate-file.jsonr  )newlineN)r   TemporaryDirectoryospathra   WriteFileContentsr	   rU  r
   rV  rW  CopyFileToGCS)template_file_gcs_locationcontainer_spec_jsontemp_dir
local_pathr]  r^  s         r   _StoreFlexTemplateFile Templates._StoreFlexTemplateFile  sv     
	!	!	#x77<<*>?jjtL"002n,,445OPg))*> 
$	#	#s   A:B
B(c	                    Sn	U(       a  [         R                  U5      n	[         R                  U5      n
SnU(       GaU  [         R                  UR                  [         R
                  5      n[         R                  R                  nUR                  (       a  UOSnUR                  (       a  SOSn[         R                  UR                  UR                  UR                  UR                  UR                  UR                   UR"                  (       a  UR"                  OUR$                  UR$                  UR&                  UUR(                  UR*                  UUR,                  (       a  UR,                  O/ U(       a  [         R                  US9OSS9n[         R/                  UU	U
UUUUS9n[0        R2                  " U5      n[4        R6                  " [4        R8                  " U5      SSSS9nU(       a  U$  [         R;                  U U5        [<        R>                  RA                  S	RC                  U U5      5        g! [D        RF                   a  n[H        RJ                  " U5      eSnAff = f)
a  Builds container spec and stores it in the flex template file in GCS.

Args:
  template_file_gcs_location: GCS location to store the template file.
  image: Path to the container image.
  template_metadata_json: Template metadata in json format.
  sdk_language: SDK language of the flex template.
  print_only: Only prints the container spec and skips write to GCS.
  template_args: Default runtime parameters specified by template authors.
  image_repository_username_secret_id: Secret manager secret id for username
    to authenticate to private registry.
  image_repository_password_secret_id: Secret manager secret id for password
    to authenticate to private registry.
  image_repository_cert_path: The full URL to self-signed certificate of
    private registry in Cloud Storage.

Returns:
  Container spec json if print_only is set. A success message with template
  file GCS path and container spec otherewise.
NTrH   )r   r   r   r   r   r   r   stagingLocationr   r   r   r   r   r   r   )r%   metadatasdkInfodefaultEnvironmentimageRepositoryUsernameSecretIdimageRepositoryPasswordSecretIdimageRepositoryCertPath   )r]   z: )	sort_keysindent
separatorszkSuccessfully saved container spec in flex template file.
Template File GCS Location: {}
Container Spec:

{})&r   rJ  r  r   r   FLEX_TEMPLATE_USER_LABELS_VALUEIP_CONFIGURATION_ENUM_VALUEr   r   r   FLEX_TEMPLATE_ENVIRONMENTr   r   r   r   r   r   r   r   r   r   r   r   CONTAINER_SPECr   MessageToJsonrX  dumpsloadsr  r   statusPrintr  r8   r9   r   r:   )r  r%   rG  r3  
print_onlyr   #image_repository_username_secret_id#image_repository_password_secret_idimage_repository_cert_pathrH  sdk_infodefault_environmentr   r   r   r   container_specr  container_spec_pretty_jsonr?   s                       r   BuildAndStoreFlexTemplateFile'Templates.BuildAndStoreFlexTemplateFile  s>   < #::
 "&&|4H"99

.
.

3
35 88JJj%88*d   77$T  &??+AA".."..''"--#77(( %22.;.L.L'88"//*$22".. 7!.!E!E "/!E!EKM   )HH#3  I  5#'' @ )( --".(K(K : . <N #00@!%

&'	" 
 ''	,&&'A'AC	jj v02LM	O
 (( ,$$U++,s   7AH= =I,I''I,c                     [         R                  " U 5      R                  [        R                  -  U-  n[         R
                  " X5        g)zAdds the given permissions to a file or directory.

Args:
  path: The path to the file or directory.
  permissions: The permissions to add.

Raises:
  OSError: If the chmod fails.
N)r  statst_moder   ALL_PERMISSIONS_MASKchmod)r  permissionss     r   _AddPermissionsTemplates._AddPermissionsa  s8     		 > >>K HHTr   c                     [         R                  " U 5       Ht  u  pn[        R                  U[        R                  5        U HD  n[        R                  [         R
                  R                  X5      [        R                  5        MF     Mv     g)zWalks a dir to chmod itself and its contents with the configured access.

Args:
  top_dir_path: The path to the top-level directory.

Raises:
  OSError: If the chmod fails.
N)r  walkr   r  DIR_PERMISSIONS_MASKr  ra   FILE_PERMISSIONS_MASK)top_dir_pathdirpath_	filenamesfilenames        r   _ChmodRWorldReadableTemplates._ChmodRWorldReadableq  sb     "$!6I)G)GH(!!GGLL+Y-L-L	
   "7r   c	                    [         R                  XV5        [        R                  " 5        n	[        R
                  R                  SR                  U	5      5        / n
UnU(       a  UnO
U(       a  U/nU GH  n[        R                  R                  U5      n[        R                  R                  U5      (       a<  [        R                  " X5      n [         R                  U[         R                  5        Oh[        R$                  " U[        R                  R'                  U	[        R                  R)                  U5      5      5      n [         R+                  U5        U
R-                  [        R                  R/                  U5      S   5        GM     [        R
                  R                  S5        [         R1                  UXU5      n[        R                  R'                  U	S5      n[        R2                  " UU5        [        R
                  R                  SR                  U5      5        [4        R6                  " 5       n[8        R:                  " S!0 SU _S	S
_SU_SS_SS_SS_SS
_SU	_SS_SS_SU_SS_SS_SS_SS_SS_SS_SS_SU(       a  UOS_SS_6n[        R
                  R                  S 5        [8        R<                  " US
U5         SSS5        g! [          a)    [        R"                  " SR                  U5      5         GNf = f! [          a)    [        R"                  " SR                  U5      5         GNf = f! , (       d  f       g= f)"a(  Builds the flex template docker container image and stores it in GCR.

Args:
  image_gcr_path: GCR location to store the flex template container image.
  flex_template_base_image: SDK version or base image to use.
  jar_paths: List of jar paths to pipelines and dependencies.
  py_paths: List of python paths to pipelines and dependencies.
  go_binary_path: Path to compiled Go pipeline binary.
  env: Dictionary of env variables to set in the container image.
  sdk_language: SDK language of the flex template.
  gcs_log_dir: Path to Google Cloud Storage directory to store build logs.
  cloud_build_service_account: Service account to be used by Cloud
    Build to build the image.

Returns:
  True if container is built and store successfully.

Raises:
  ValueError: If the parameters values are invalid.
z$Copying files to a temp directory {}z/Could not adjust permissions for copied file {}z4Could not adjust permissions for copied directory {}   zCGenerating dockerfile to build the flex template container image...
Dockerfilez"Generated Dockerfile. Contents: {}tagno_cacheFmessagessubstitutionsN
arg_configzcloudbuild.yamlis_specified_sourceT	no_sourcesourcegcs_source_staging_dirignore_filearg_gcs_log_dirarg_machine_typearg_disk_sizearg_worker_poolarg_dirarg_revisionarg_git_source_dirarg_git_source_revisionarg_service_account	buildpackz/Pushing flex template container image to GCR...r   )r   #_Templates__ValidateFlexTemplateEnvr   r  r   r  r  r  r  r  abspathisfileshutilcopy2r  r  OSErrorrv  copytreera   basenamer  r`   r"  r4  r  r   r   r   CreateBuildConfigBuild)image_gcr_pathr  	jar_pathspy_pathsgo_binary_pathr
  r3  gcs_log_dircloud_build_service_accountr  pipeline_filesr  r  	absl_path	copy_filecopy_dirr  dockerfile_pathr  build_configs                       r   BuildAndStoreFlexTemplateImage(Templates.BuildAndStoreFlexTemplateImage  s!   @ '':		!	!	#x	jj=DDXNOne	 $GGOOD)	77>>)$$ll97)	%%9:: __ggll8RWW%5%5i%@A(
**84 	bggmmI6q9:; > 
jj
OQ%556N6D6BD X|<oo/BC	jj
.
5
56I
JL !224h 22   	
 ' #   "&  &       !" "#$ #'%* - *-0 1l4 
jjHI%6e 
$	#&  KKAHH  KKFMMC 
$	#sV   B&M$K6AM
LE7M/LMLM/MMMM
Mc                    [         R                  U R                  [         R                  5      n[         R                  U R                  [         R
                  5      nSnSnU R                  (       a&  U R                  nU(       a  [         R                  US9n[         R                  U R                  [         R                  5      nU R                  =(       d    [        n[         R                  R                  nU R                  (       a  UOSnSn	U R                  (       aU  U R                  S:X  a  [         R                  R                   n	O*U R                  S:X  a  [         R                  R"                  n	[         R%                  [         R'                  U R(                  U R*                  [         R-                  U R.                  U R0                  U R2                  U R4                  U R6                  U R8                  U R:                  U R<                  (       a  U R<                  OU R>                  U R>                  U R@                  UU RB                  U RD                  U RF                  U	U RH                  (       a  U RH                  O/ U(       a  [         R                  US9OSU RJ                  (       a  U RJ                  O/ S9UUU(       a  [         R                  US9OSS9S9n
[M        5       RO                  U RP                  =(       d
    [S        5       UU
S9n [         RU                  5       RW                  U5      $ ! [X        RZ                   a  n[\        R^                  " U5      eSnAff = f)	zwCalls the create job from flex template APIs.

Args:
  template_args: Arguments for create template.

Returns:
  (Job)
NrH   SPEED_OPTIMIZEDCOST_OPTIMIZED)r   r   r   r   r   r   launcherMachineTyper   r  r   r   r   r   r   
flexrsGoalr   r   r   )r   containerSpecGcsPathrp   r   transformNameMappingsr   )launchParameter)r4   r3   launchFlexTemplateRequest)0r   r   r   FLEX_TEMPLATE_PARAMETERS_VALUEr   *FLEX_TEMPLATE_TRANSFORM_NAME_MAPPING_VALUEr   r   r  r=   r6   r  r   r   r   FLEXRS_GOAL_ENUM_VALUEFLEXRS_SPEED_OPTIMIZEDFLEXRS_COST_OPTIMIZEDLAUNCH_FLEX_TEMPLATE_REQUESTFLEX_TEMPLATE_PARAMETERr   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   3DataflowProjectsLocationsFlexTemplatesLaunchRequestr<   r#   r   r   r8   r9   r   r:   )r   r   r   r   r   r   r=   r   r   r   r   r>   r?   s                r   CreateJobFromFlexTemplate#Templates.CreateJobFromFlexTemplate  s    22  )"J"JLK&==--<<> %%&77	@@%; A  	 !77,,113
 ''F+FI66HHJ%2%E%Ez4K  		"	"&7	766MM$$(8866LL11!99!**!.!;!;!;;$1$G$G(44(44%--(33)==$1$G$G<I=]88$1$B$B - > >(55 0*88(44&3&K&K&<I++=,M8813 & &/%N%N)9 &O &+/ %@@ "==5 < 8 $"45@ !??%0 @ 2FJE : "L 2 #MDH   99**:jl"& : ( 
,--/66w??(( ,$$U++,s   "L: :M)M$$M)r   r   )NNNN)Xr   r   r   r   r   r   CreateJobFromTemplateRequestr   LaunchTemplateParametersr   ParametersValuer   LaunchFlexTemplateRequestr  r   FlexTemplateRuntimeEnvironmentr  r   r  TransformNameMappingValuer   LaunchFlexTemplateParameterr  r  TransformNameMappingsValuer  r   r  FlexrsGoalValueValuesEnumr  TemplateMetadatarD  SDKInfor~  LanguageValueValuesEnumr  ContainerSpecr  r'   rn  ro  rp  rq  rr  rs  rt  ru  rw  rx  ry  rT  r  S_IRWXUS_IRWXGS_IRWXOr  S_IWUSRS_IRUSRS_IRGRPS_IROTHr  S_IXGRPS_IXOTHr  r   r.   r   r   r   r   r  r'  r-  r4  r<  r  rJ  rQ  rO  r  r  r  r  r  r  r  r  r   r   r   r   r   r     s   4$&CC.02KK%?%O%O"!2!4!N!N#33/1PP99 " !:: 0 ./KK#:#J#J 88 - !2 !""#A#A , ""#<#< '):: ((("$,,DD,$&44.$5h$?!$5h$?!$5h$?!$5h$?!/@4/P,/@4/P,/@4/P,/@4/P,%6y%A" 1$ 7+<T4+H(<  llT\\!DLL0  llT\\!DLL04<<? 
 llT\\!DLL04<<?$,,N  < < @ @ F, F,P P, P,d  " ! !F E EV $ $L C C. 0 0.  0 ! !B L L  0 0$ &$ &$P D D$ ? ?&  37HLHL?C[, [,z     
 
  r rh W, W,r   r   c                   l    \ rS rSrSr\" 5       R                  r\S 5       r	\       SS j5       r
Srg)MessagesiR  z+The Messages set of Dataflow API functions.c                  *    [        5       R                  $ r   )r    projects_locations_jobs_messagesr   r   r   r.   Messages.GetServiceX  r   r   Nc                 .   U=(       d
    [        5       nU=(       d    [        n[        5       R                  U UUUUUUUS9n [        R                  5       R                  U5      $ ! [        R                   a  n	[        R                  " U	5      eSn	A	ff = f)a  Calls the Dataflow Metrics.Get method.

Args:
  job_id: The job to get messages about.
  project_id: The project which owns the job.
  region_id: The regional endpoint of the job.
  minimum_importance: Filter to only get messages with importance >= level
  start_time: If specified, return only messages with timestamps >=
    start_time. The default is the job creation time (i.e. beginning of
    messages).
  end_time: Return only messages with timestamps < end_time. The default is
    now (i.e. return up to the latest messages available).
  page_size: If specified, determines the maximum number of messages to
    return.  If unspecified, the service may choose an appropriate default,
    or may return an arbitrarily large number of results.
  page_token: If supplied, this should be the value of next_page_token
    returned by an earlier call. This will cause the next page of results to
    be returned.

Returns:
  (ListJobMessagesResponse)
)r2   r3   r4   r   endTimeminimumImportancepageSize	pageTokenN)r#   r6   r   0DataflowProjectsLocationsJobsMessagesListRequestr  r.   Listr8   r9   r   r:   )
r;   r<   r=   minimum_importancer   end_time	page_size
page_tokenr>   r?   s
             r   r$  Messages.List\  s    > +z|J88I 66, 7  ,  "''00(( ,$$U++,s   "A% %B9BBr   )NNNNNNN)r   r   r   r   r   r   r#  r   r   r.   r$  r   r   r   r   r  r  R  sW    3" 44  @ @ "., .,r   r  c                   d    \ rS rSrSr\S 5       r\S	S j5       r\S	S j5       r\S	S j5       r	Sr
g)
	Snapshotsi  zCloud Dataflow snapshots api.c                  *    [        5       R                  $ r   )r   projects_locations_snapshotsr   r   r   r.   Snapshots.GetService  r   r   Nc                 "   U=(       d
    [        5       nU=(       d    [        n[        5       R                  XUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Dataflow Snapshots.Delete method.

Args:
  snapshot_id: The id of the snapshot to delete.
  project_id: The project that owns the snapshot.
  region_id: The regional endpoint of the snapshot.

Returns:
  (DeleteSnapshotResponse)

snapshotIdr3   r4   N)r#   r6   r   /DataflowProjectsLocationsSnapshotsDeleteRequestr+  r.   Deleter8   r9   r   r:   snapshot_idr<   r=   r>   r?   s        r   r3  Snapshots.Delete  s     +z|J88I 55j 6 J ,!!#**733(( ,$$U++,rA   c                 "   U=(       d
    [        5       nU=(       d    [        n[        5       R                  XUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Dataflow Snapshots.Get method.

Args:
  snapshot_id: The id of the snapshot to get.
  project_id: The project that owns the snapshot.
  region_id: The regional endpoint of the snapshot.

Returns:
  (GetSnapshotResponse)
r0  N)r#   r6   r   ,DataflowProjectsLocationsSnapshotsGetRequestr+  r.   r"   r8   r9   r   r:   r4  s        r   r"   Snapshots.Get  s     +z|J88I!NNj O JG,!!#''00(( ,$$U++,rA   c                 "   U=(       d
    [        5       nU=(       d    [        n[        5       R                  XUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a  Calls the Dataflow Snapshots.List method.

Args:
  job_id: If specified, only snapshots associated with the job will be
    returned.
  project_id: The project that owns the snapshot.
  region_id: The regional endpoint of the snapshot.

Returns:
  (ListSnapshotsResponse)
)r2   r3   r4   N)r#   r6   r   -DataflowProjectsLocationsSnapshotsListRequestr+  r.   r$  r8   r9   r   r:   )r;   r<   r=   r>   r?   s        r   r$  Snapshots.List  s     +z|J88I!OOJ P @G,!!#((11(( ,$$U++,rA   r   r~   )r   r   r   r   r   r   r.   r3  r"   r$  r   r   r   r   r+  r+    sS    %< < , ,, , ,* , ,r   r+  )F)*r   
__future__r   r   r   rX  r  r  r  r  apitools.base.pyr   r   r8   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.api_lib.storager	   r
   googlecloudsdk.api_lib.utilr   !googlecloudsdk.command_lib.buildsr   googlecloudsdk.corer   r   googlecloudsdk.core.utilr   r   r   r   r6   r   r   r#   r'   r)   r   r   r   r  r+  r   r   r   <module>rE     s    ; &  '  	    % > = 6 7 , 2 9 # * * 
  + II;\`, `,F$, $,NR# R#jm, m,`9, 9,xI, I,r   