
    +                     ~   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 r    S*S
 jrS rS rS rS rS rS rS rS rS+S jrS,S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jrS+S jr S+S jr!S+S  jr"S+S! jr#S+S" jr$S+S# jr%S+S$ jr&S+S% jr'S+S& jr(S+S' jr)S+S( jr*S+S) jr+g	)-z3Flags and helpers for the compute related commands.    )actions)arg_parsers)base)concepts)concept_parsers)
propertiesc                  ,    [         R                  " SSS9$ )Nregionz$The Cloud region for the {resource}.name	help_textr    ResourceParameterAttributeConfig     5lib/googlecloudsdk/command_lib/datapipelines/flags.pyRegionAttributeConfigr      s    		2	2E
G Gr   Nc                    ^ ^ U U4S jnT=(       d    Sm[         R                  R                  SR                  U(       a  SOST 5      U" 5       TUS9$ )z6Constructs and returns the Pipeline Resource Argument.c            	      z   > UU4S jn [         R                  " SSU " 5       [        5       [         R                  SS9$ )z?Constructs and returns the Resource specification for Pipeline.c                  .   > [         R                  " T TS9$ )Nr   r   )arg_namer   s   r   PipelineAttributeConfigXGetPipelineResourceArg.<locals>.GetPipelineResourceSpec.<locals>.PipelineAttributeConfig(   s    669. .r   z*datapipelines.projects.locations.pipelinespipelineF)resource_namepipelinesIdlocationsId
projectsIddisable_auto_completers)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIG)r   r   r   s    r   GetPipelineResourceSpec7GetPipelineResourceArg.<locals>.GetPipelineResourceSpec%   s;    .   4 +-)+<< %' 'r   z%Name for the Data Pipelines Pipeline.z{}{} z--required)r   ConceptParserForResourceformat)r   r   
positionalr&   r"   s   ``   r   GetPipelineResourceArgr+      sQ    ' BB)		&	&	2	2mm*B$9	 
3 
 r   c                 6    [        5       R                  U 5        g Nr+   AddToParserparsers    r   AddCreatePipelineFlagsr2   =       &&v.r   c                 6    [        5       R                  U 5        g r-   r.   r0   s    r   AddUpdatePipelineFlagsr5   A   r3   r   c                 6    [        5       R                  U 5        g r-   r.   r0   s    r   AddDescribePipelineFlagsr7   E   r3   r   c                 6    [        5       R                  U 5        g r-   r.   r0   s    r   AddDeletePipelineFlagsr9   I   r3   r   c                 6    [        5       R                  U 5        g r-   r.   r0   s    r   AddStopPipelineFlagsr;   M   r3   r   c                 6    [        5       R                  U 5        g r-   r.   r0   s    r   AddRunPipelineFlagsr=   Q   r3   r   c                 4    [        SS9R                  U 5        g )NF)r*   r.   r0   s    r   AddListJobsFlagsr?   U   s    E*66v>r   c                     [         R                  " SS[        5       [         R                  S9n[        R
                  R                  SUSR                  U5      SS9R                  U 5        g)	zAdd a resource argument for a Vertex AI region.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
z datapipelines.projects.locationsr
   )r   r   r   z--regionzCloud region {}.Tr%   N)	r   r    r   r!   r   r'   r(   r)   r/   )r1   verbregion_resource_specs      r   AddRegionResourceArgrC   Y   sh     "..(')::	< ++%	 ,  ![(r   c                 H    [         R                  " SUSR                  U S9S9$ )Nz--display-namezDisplay name of the {noun}.)noun)r&   help)r   Argumentr)   )rE   r&   s     r   GetDisplayNameArgrH   o   s*    	(//T/:
< <r   c                 :    SSS.n[         R                  " SUU SS9$ )NzSpecifies a Batch pipeline.zSpecifies a Streaming pipeline.)batch	streamingz--pipeline-typez4Type of the pipeline. One of 'BATCH' or 'STREAMING'.)choicesr&   help_strr   ChoiceArgumentr&   rL   s     r   GetPipelineTypeArgrQ   v   s2    ,4' 
		I	
K Kr   c                 <    SSS.n[         R                  " SUU SSS9$ )NzSpecifies a Flex template.zSpecifies a Classic template)flexclassicz--template-typeFLEXzKType of the template. Defaults to flex template. One of 'FLEX' or 'CLASSIC')rL   r&   defaultrM   rN   rP   s     r   GetTemplateTypeArgrW      s3    */' 
		`
 r   c                 0    [         R                  " SU S SS9$ )Nz
--schedulez?Unix-cron format of the schedule for scheduling recurrent jobs.r&   rV   rF   r   rG   r%   s    r   GetScheduleArgr[      s    	P	
 r   c                 0    [         R                  " SU S SS9$ )Nz--time-zonezKTimezone ID. This matches the timezone IDs used by the Cloud Scheduler API.rY   rZ   r%   s    r   GetTimeZoneArgr]      s    	\	
 r   c           	      \    [         R                  " SU S [        R                  " SS5      SS9$ )Nz--template-file-gcs-location^gs://.*Must begin with 'gs://'zMLocation of the template file or container spec file in Google Cloud Storage.r&   rV   typerF   r   rG   r   RegexpValidatorr%   s    r   GetTemplateFileGcsLocationArgre      s3    	$&&{'BD^
 r   c           
      x    [         R                  " SU S S[        R                  " 5       [        R                  SS9$ )Nz--parameters
PARAMETERSz)User defined parameters for the template.r&   rV   metavarrb   actionrF   r   rG   r   ArgDictUpdateActionr%   s    r   GetParametersArgrn      s7    	 %%:
< <r   c                 :    [         R                  " SU S [        SS9$ )Nz--max-workerszHMaximum number of workers to run by default. Must be between 1 and 1000.ra   r   rG   intr%   s    r   GetMaxWorkersArgrr      s"    	Y
 r   c                 :    [         R                  " SU S [        SS9$ )Nz--num-workerszInitial number of workers to run by default. Must be between 1 and 1000. If not specified here, defaults to server-specified value.ra   rp   r%   s    r   GetNumWorkersArgrt      s%    	 U
 r   c                 0    [         R                  " SU S SS9$ )Nz	--networkzDefault Compute Engine network for launching instances to run your pipeline. If not specified here, defaults to the network 'default'.rY   rZ   r%   s    r   GetNetworkArgrv      s"    	 X	
 r   c                 0    [         R                  " SU S SS9$ )Nz--subnetworkzODefault Compute Engine subnetwork for launching instances to run your pipeline.rY   rZ   r%   s    r   GetSubnetworkArgrx      s    	`	
 r   c                 0    [         R                  " SU S SS9$ )Nz--worker-machine-typezfDefault type of machine to use for workers. If not specified here, defaults to server-specified value.rY   rZ   r%   s    r   GetWorkerMachineTypeArgrz      s    	w	
 r   c           	      \    [         R                  " SU S [        R                  " SS5      SS9$ )Nz--temp-locationr_   r`   zDefault Google Cloud Storage location to stage temporary files. If not set, defaults to the value for staging-location (Must be a URL beginning with 'gs://'.)ra   rc   r%   s    r   GetTempLocationArgr|      s6    	&&{'BD p
 r   c                 0    [         R                  " SU S SS9$ )Nz--dataflow-kms-keyz`Default Cloud KMS key to protect the job resources. The key must be in same location as the job.rY   rZ   r%   s    r   GetDataflowKmsKeyArgr~      s    	q	
 r   c                     [         R                  " SU S [        R                  " [        R
                  R                  R                  5      SS9$ )Nz--disable-public-ipszRSpecifies that Cloud Dataflow workers must not use public IP addresses by default.r&   rV   rj   rF   )r   rG   r   StoreBooleanPropertyr   VALUESdatapipelinesdisable_public_ipsr%   s    r   GetDisablePublicIpsArgr      sB    	))



)
)
<
<>c
 r   c                 0    [         R                  " SU S SS9$ )Nz --dataflow-service-account-emailz7Default service account to run the dataflow workers as.rY   rZ   r%   s    r   !GetDataflowServiceAccountEmailArgr     s!    	(H	
J Jr   c                 0    [         R                  " SU S SS9$ )Nz!--scheduler-service-account-emailzKDefault service account used by the Cloud Scheduler job for launching jobs.rY   rZ   r%   s    r   "GetSchedulerServiceAccountEmailArgr     s!    	)\	
^ ^r   c                     [         R                  " SU S [        R                  " [        R
                  R                  R                  5      SS9$ )Nz--enable-streaming-enginez@Specifies that enabling Streaming Engine for the job by default.r   )r   rG   r   r   r   r   r   enable_streaming_enginer%   s    r   GetEnableStreamingEngineArgr     sC    	!))



)
)
A
ACQ
 r   c           
      x    [         R                  " SU S S[        R                  " 5       [        R                  SS9$ )Nz--additional-experimentsADDITIONAL_EXPERIMENTSz%Default experiment flags for the job.rh   )r   rG   r   ArgListrm   r%   s    r   GetAdditionalExperimentsArgr   !  s7    	 & %%6
8 8r   c           
      x    [         R                  " SU S S[        R                  " 5       [        R                  SS9$ )Nz--additional-user-labelsADDITIONAL_USER_LABELSzDefault user labels to be specified for the job. Keys and values must follow the restrictions specified in https://cloud.google.com/compute/docs/labeling-resources#restrictions.rh   rk   r%   s    r   GetAdditionalUserLabelsArgr   ,  s:    	 & %% C
 r   c           	          [         R                  " U SS9nUR                  [         R                  " SU SSS95        UR                  [         R                  " SU SSS95        U$ )	3Defines the Streaming Update Args for the Pipeline.T)r&   mutexz--worker-regionNzDDefault Compute Engine region in which worker processing will occur.rY   z--worker-zonezBDefault Compute Engine zone in which worker processing will occur.)r   ArgumentGroupAddArgumentrG   )r&   worker_region_argss     r   GetWorkerRegionArgsr   8  sk    ))84H  
mm
Y		   
mm
W		 
r   c                 6    [         R                  " SU S SSS/S9$ )Nz--flexrs-goalz&FlexRS goal for the flex template job.COST_OPTIMIZEDSPEED_OPTIMIZED)r&   rV   rF   rL   rZ   r%   s    r   GetFlexRsGoalArgr   L  s(    	7!23
5 5r   c                 *   [         R                  " U S9nUR                  [         R                  " SU [        R
                  SS95        UR                  [         R                  " SU SS[        R                  " 5       [        R                  SS	95        U$ )
r   r%   z--updatez+Set this to true for streaming update jobs.)r&   rj   rF   z--transform-name-mappingsNTRANSFORM_NAME_MAPPINGSz5Transform name mappings for the streaming update job.rh   )r   r   r   rG   r   StoreTrueFalseActionrl   rm   )r&   streaming_update_argss     r   GetStreamingUpdateArgsr   U  s    ,,h?##
mm
11@	BC ##
mm
%+""$))JLM 
r   )r   NTT)F)T),__doc__googlecloudsdk.callioper   r   r    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   r+   r2   r5   r7   r9   r;   r=   r?   rC   rH   rQ   rW   r[   r]   re   rn   rr   rt   rv   rx   rz   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    : , / ( 5 D *G
 %/%)&*$(<//////?),<	K<J^8	(5r   