
    6,                        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 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)0z3Flags and helpers for the compute related commands.    )absolute_import)division)unicode_literals)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   AddCreatePipelineFlagsr5   @       &&v.r   c                 6    [        5       R                  U 5        g r0   r1   r3   s    r   AddUpdatePipelineFlagsr8   D   r6   r   c                 6    [        5       R                  U 5        g r0   r1   r3   s    r   AddDescribePipelineFlagsr:   H   r6   r   c                 6    [        5       R                  U 5        g r0   r1   r3   s    r   AddDeletePipelineFlagsr<   L   r6   r   c                 6    [        5       R                  U 5        g r0   r1   r3   s    r   AddStopPipelineFlagsr>   P   r6   r   c                 6    [        5       R                  U 5        g r0   r1   r3   s    r   AddRunPipelineFlagsr@   T   r6   r   c                 4    [        SS9R                  U 5        g )NF)r-   r1   r3   s    r   AddListJobsFlagsrB   X   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,   r2   )r4   verbregion_resource_specs      r   AddRegionResourceArgrF   \   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,   )rH   r)   s     r   GetDisplayNameArgrK   r   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)   rO   s     r   GetPipelineTypeArgrT   y   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')rO   r)   defaultrP   rQ   rS   s     r   GetTemplateTypeArgrZ      s3    */' 
		`
 r   c                 0    [         R                  " SU S SS9$ )Nz
--schedulez?Unix-cron format of the schedule for scheduling recurrent jobs.r)   rY   rI   r   rJ   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.r\   r]   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)   rY   typerI   r   rJ   r   RegexpValidatorr(   s    r   GetTemplateFileGcsLocationArgrh      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)   rY   metavarre   actionrI   r   rJ   r   ArgDictUpdateActionr(   s    r   GetParametersArgrq      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.rd   r   rJ   intr(   s    r   GetMaxWorkersArgru      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.rd   rs   r(   s    r   GetNumWorkersArgrw      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'.r\   r]   r(   s    r   GetNetworkArgry      s"    	 X	
 r   c                 0    [         R                  " SU S SS9$ )Nz--subnetworkzODefault Compute Engine subnetwork for launching instances to run your pipeline.r\   r]   r(   s    r   GetSubnetworkArgr{      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.r\   r]   r(   s    r   GetWorkerMachineTypeArgr}      s    	w	
 r   c           	      \    [         R                  " SU S [        R                  " SS5      SS9$ )Nz--temp-locationrb   rc   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://'.)rd   rf   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.r\   r]   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)   rY   rm   rI   )r   rJ   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.r\   r]   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.r\   r]   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   rJ   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.rk   )r   rJ   r   ArgListrp   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.rk   rn   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.r\   z--worker-zonezBDefault Compute Engine zone in which worker processing will occur.)r   ArgumentGroupAddArgumentrJ   )r)   worker_region_argss     r   GetWorkerRegionArgsr   ;  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)   rY   rI   rO   r]   r(   s    r   GetFlexRsGoalArgr   O  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)   rm   rI   z--transform-name-mappingsNTRANSFORM_NAME_MAPPINGSz5Transform name mappings for the streaming update job.rk   )r   r   r   rJ   r   StoreTrueFalseActionro   rp   )r)   streaming_update_argss     r   GetStreamingUpdateArgsr   X  s    ,,h?##
mm
11@	BC ##
mm
%+""$))JLM 
r   )r   NTT)F)T)0__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r    googlecloudsdk.calliope.conceptsr	   (googlecloudsdk.command_lib.util.conceptsr
   googlecloudsdk.corer   r   r.   r5   r8   r:   r<   r>   r@   rB   rF   rK   rT   rZ   r^   r`   rh   rq   ru   rw   ry   r{   r}   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   