
    `                         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
 rS rS rS rS rg)zBHelpers for writing commands interacting with jobs and their IDs.
    )absolute_import)division)unicode_literals)actions)arg_parsers)dataflow_util)
properties)	resourcesc                 j    U R                  SSSS9  U R                  SSS[        R                  -   S9  g)	zRegister flags for specifying a single Job ID.

Args:
  parser: The argparse.ArgParser to configure with job-filtering arguments.
jobJOB_IDzJob ID to operate on.metavarhelp--region	REGION_IDz*Region ID of the job's regional endpoint. Nadd_argumentr   DEFAULT_REGION_MESSAGE)parsers    4lib/googlecloudsdk/command_lib/dataflow/job_utils.pyArgsForJobRefr      sD     	eX4KL9001  3    c                 t    U R                   "  SSSS.UD6  U R                  SSS[        R                  -   S9  g)	zRegister flags for specifying jobs using positional job IDs.

Args:
  parser: The argparse.ArgParser to configure with job ID arguments.
  **kwargs: Extra arguments to pass to the add_argument call.
r   zJob IDs to operate on.r   r   r   z*Region ID of the jobs' regional endpoint. N)jobsr   )r   kwargss     r   ArgsForJobRefsr   ,   sW     	I%=IAGI 	9001  3r   c                     U R                   n[        R                  " U 5      n[        R                  R                  U[        R                  R                  R                  R                  US.SS9$ )zExtract the Job Ref for a command. Used with ArgsForJobRef.

Args:
  args: The command line arguments.
Returns:
  A Job resource.
	projectIdlocation dataflow.projects.locations.jobsparams
collection)r   r   	GetRegionr
   REGISTRYParser	   VALUEScoreproject	GetOrFail)argsr   regions      r   ExtractJobRefr/   =   sf     	#""4(&				!	!	!((--55?? 4 
" 
5 5r   c           	         U R                   n[        R                  " U 5      nU Vs/ s HQ  n[        R                  R                  U[        R                  R                  R                  R                  US.SS9PMS     sn$ s  snf )zExtract the Job Refs for a command. Used with ArgsForJobRefs.

Args:
  args: The command line arguments that were provided to this invocation.
Returns:
  A list of job resources.
r   r"   r#   )r   r   r&   r
   r'   r(   r	   r)   r*   r+   r,   )r-   r   r.   r   s       r   ExtractJobRefsr1   P   s     
$""4(& EI
 EIS 
%,,1199CC  8  9 EI
  
s   ABc                    U R                  SSS9  U R                  S[        R                  " [        R                  R
                  R                  5      SS9  U R                  S[        SS	9  U R                  S
SS9  U R                  S[        SS	9  U R                  S[        R                  " SS5      SS	9  U R                  SSS9  U R                  SSS9  U R                  SSS9nUR                  S[        R                  " SS5      SS	9  UR                  S[        R                  " SS5      S S	9  UR                  S![        R                  " SS5      S [        R                  " S!S"S#S$9S%9  g&)'zyRegister flags applicable to all template launches.

Args:
  parser: argparse.ArgumentParser to register arguments with.
z--dataflow-kms-keyz/The Cloud KMS key to protect the job resources.)r   z--disable-public-ipsz<The Cloud Dataflow workers must not use public IP addresses.)actionr   z--max-workersz%The maximum number of workers to run.)typer   z	--networkzHThe Compute Engine network for launching instances to run your pipeline.z--num-workersz%The initial number of workers to use.z--service-account-emailz	.*@.*\..*z"must provide a valid email addressz*The service account to run the workers as.z--subnetworkzKThe Compute Engine subnetwork for launching instances to run your pipeline.z--worker-machine-typezEThe type of machine to use for workers. Defaults to server-specified.TzWorker location options.)mutexr   z--worker-regionz	\w+-\w+\dzmust provide a valid regionz!The region to run the workers in.z--worker-zonez\w+-\w+\d-\wzmust provide a valid zonezThe zone to run the workers in.z--zonezSThe {flag_name} option is deprecated; use --worker-region or --worker-zone instead.F)warnremoved)r4   r   r3   N)r   r   StoreBooleanPropertyr	   r)   dataflowdisable_public_ipsintr   RegexpValidator	add_groupDeprecationAction)r   groups     r   
CommonArgsr@   e   s    	<  > 	))



$
$
7
79I	  K 	C&M  O 	  
 	C&M  O 	&&|'KM7	  9 	  
 	  
 

,F

G%&&|'DF.	  0 &&'BD,	  . &&'BD,&&
@	  	r   N)__doc__
__future__r   r   r   googlecloudsdk.callioper   r   #googlecloudsdk.command_lib.dataflowr   googlecloudsdk.corer	   r
   r   r   r/   r1   r@    r   r   <module>rG      s>    '  ' + / = * )33"5&*Br   