
    w%                     J   S 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S	.r " S
 S\R                  5      r
 " S S\R                  5      r " S S\5      rS\S40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   S'S jrS(S  jrS! rS" rS# rS$ r S% r!g))z,Flags and helpers for the Managed Flink CLI.    N)arg_parsers)base)
completers)parameter_info_libz$The number of taskmanagers is fixed.zIThe number of taskmanagers is scaled automatically according to workload.)fixedelasticc                   6   ^  \ rS rSrSr   SU 4S jjrSrU =r$ )ListCommandParameterInfo"   z&Helper class for ListCommandCompleter.c                 ,   > [         [        U ]  UUUUS9$ )N)check_properties
for_update)superr
   GetFlag)selfparameter_nameparameter_valuer   r   	__class__s        5lib/googlecloudsdk/command_lib/managed_flink/flags.pyr    ListCommandParameterInfo.GetFlag%   s+     )48)	 9       )NTF)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__r   s   @r   r
   r
   "   s    .
  r   r
   c                       \ rS rSrSrS rSrg)ListCommandCompleter4   z%Helper class for DeploymentCompleter.c                 6    [        UUU R                  [        S9$ )N)updaters)r
   
collectionCOMPLETERS_BY_CONVENTION)r   parsed_args	argumentss      r   ParameterInfo"ListCommandCompleter.ParameterInfo7   s    #)	 r   r   N)r   r   r   r   r   r*   r   r   r   r   r"   r"   4   s
    -r   r"   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )DeploymentCompleter@   z"Completer for listing deployments.c                 4   > [         [        U ]
  " SSSS.UD6  g )Nz+managedflink.projects.locations.deploymentszmanaged-flink deployments list)r&   list_commandr   )r   r-   __init__)r   kwargsr   s     r   r1   DeploymentCompleter.__init__C   s(    	
t- @5 r   r   )r   r   r   r   r   r1   r   r   r    s   @r   r-   r-   @   s    * r   r-   
deploymentFc                 L    U R                  SSSSS9  U R                  SSSS	S9  g
)zAdds network config arguments.z--network-config-vpcNETWORKnetworkzThe network to use for the job.metavardesthelpz--network-config-subnetwork
SUBNETWORK
subnetworkz"The subnetwork to use for the job.Nadd_argumentparsers    r   AddNetworkConfigArgsrB   O   sB    ,	   	#/	  r   c                 (    U R                  SSSSS9  g)z Adds workload identity argument.z--workload-identityWORKLOAD_IDENTITYworkload_identityzpThe workload identity to use for the job. Managed Flink Default Workload Identity will be used if not specified.r8   Nr>   r@   s    r   AddWorkloadIdentityArgumentrF   _   s$    !F  r   c           	      V    [         R                  " SSSSS/SS9R                  U 5        g)	zCreates location argument.z
--locationLOCATIONTlocationz--regionzThe location to run the job in.)r9   requiredr:   suggestion_aliasesr;   Nr   ArgumentAddToParserr@   s    r   AddLocationArgumentrO   l   s.    --$, Kr   c                 V    [         R                  " SS/ SQSSS9R                  U 5        g)zJob type arguments.z
--job-typeJOB_TYPE)autojarpythonsqlrR   zdThe type of job to run. If "auto" will be selected based on the file extension for the job argument.)r9   choicesdefaultr;   NrL   r@   s    r   AddJobTypeArgumentrX   x   s+    --.-	 Kr   c                 N    [         R                  " SSSS9R                  U 5        g)zCreates the job argument.jobz
JAR|PY|SQLzLThe file containing the Flink job to run. Can be a jar, python, or sql file.r9   r;   NrL   r@   s    r   AddJobJarArgumentr\      s%    --	 Kr   c                 x    [         R                  " SS[        R                  " 5       SSS9R	                  U 5        g)z Creates the extra jars argument.z--jarsJAR
extra_jarszEThe extra jars to pass to the job. Can be a jar, python, or sql file.r9   typer:   r;   Nr   rM   r   ArgListrN   r@   s    r   AddExtraJarsArgumentrd      s4    -- 	 Kr   c           	      T    [         R                  " SSSSSSS9R                  U 5        g)zCreates dry run argument.z	--dry-run
store_truedry_runFz9Return command used to submit a job without invoking API.actionr:   rW   rJ   r;   NrL   r@   s    r   AddDryRunArgumentrj      s,    --F Kr   c                 P    [         R                  " SSSSS9R                  U 5        g)Creates main class argument.z--classCLASS
main_classzaThe main class of the Flink job. Required if the jar file manifest does not contain a main class.r8   NrL   r@   s    r   AddMainClassArgumentro      s(    --, Kr   c                 B    U R                  S[        R                  SS9  g)z0Collects extra arguments into the job_args list.job_argszThe job arguments to pass.)nargsr;   N)r?   argparse	REMAINDERr@   s    r   AddJobArgsCollectorru      s$    '  r   c                 R    [         R                  " SSSSSS9R                  U 5        g)zCreates name argument.z--nameNAMEnameFz@The name of the job. The Flink job name will be used if not set.r9   r:   rJ   r;   NrL   r@   s    r   AddNameArgumentrz      s)    --M Kr   c                 N    [         R                  " SSSS9R                  U 5        g)zCreates job id argument.job_idJOBIDzThe id of the job.r[   NrL   r@   s    r   AddJobIdArgumentr~      s#    -- Kr   c           	      T    [         R                  " SSSUSSS9R                  U 5        g)zCreates async argument.z--asyncrf   async_submitFz(Return immediately after job submission.rh   NrL   )rA   rW   s     r   AddAsyncArgumentr      s,    --5 Kr   c                 R    [         R                  " SSSSSS9R                  U 5        g)z"Creates staging location argument.z--staging-locationSTAGING_LOCATIONstaging_locationTzLThe Google Cloud Storage staging location for the job. Must start with gs://ry   NrL   r@   s    r   AddStagingLocationArgumentr      s+    -- 	 Kr   c           	          U(       a  UnOSnU(       a  SR                  X45      n[        R                  " SSUS[        US9R	                  U 5        g)zCreates deployment argument.z:
    The Flink Deployment to use for this invocation.
    z

z--deploymentDEPLOYMENT_NAMEr4   )r9   rJ   r:   	completerr;   N)joinr   rM   r-   rN   )rA   help_text_to_prependhelp_text_to_overwriterJ   	help_texts        r   AddDeploymentArgumentr      sT     &II 1=>I--# Kr   c           
      ^    [         R                  " SS[        UUSSS9R                  U 5        g)z!Creates autotuning mode argument.z--autotuning-modeAUTOTUNING_MODEautotuning_modez%Selects the autotuning mode for jobs.)r9   rV   rW   rJ   r:   r;   N)r   rM   _AUTOTUNING_MODESrN   )rA   rW   rJ   s      r   AddAutotuningModeArgumentr     s1     --2 Kr   c                 L    U R                  S[        R                  " SSS9SS9  g)z!Adds fixed parallelism arguments.z--parallelism   '  lower_boundupper_boundz;The parallelism of the job when in "fixed" autotuning mode.ra   r;   Nr?   r   
BoundedIntr@   s    r   AddFixedParallelismArgsr   '  s+    !!aUCH  r   c                     U R                  S[        R                  " SSS9SS9  U R                  S[        R                  " SSS9SS9  g	)
z#Adds elastic parallelism arguments.z--min-parallelismr   r   r   z{The minimum parallelism of the job when in "elastic" autotuning mode. This will also be the initial parallelism of the job.r   z--max-parallelismzEThe maximum parallelism of the job when in "elastic" autotuning mode.Nr   r@   s    r   AddElasticParallelismArgsr   0  s[    !!aUCI	   	!!aUC	  r   c           	      T    [         R                  " SSSSSSS9R                  U 5        g)zCreates show output argument.z--enable-outputrf   show_outputFz%Shows the output of the Flink client.rh   NrL   r@   s    r   AddShowOutputArgumentr   D  s,    --2 Kr   c                 x    [         R                  " SS[        R                  " 5       SSS9R	                  U 5        g)z$Creates the extra archives argument.z
--archivesZIParchivesz_The extra archives to pass to the job. Can be a zip file containing resource files for the job.r`   Nrb   r@   s    r   AddExtraArchivesArgumentr   P  s4    -- )	 Kr   c                 P    [         R                  " SSSSS9R                  U 5        g)rl   z--python-venvr   python_venvzThe path to the zip file to manage the virtualenv for Python dependencies. Required if the job type is python. Must start with gs://.r8   NrL   r@   s    r   AddPythonVirtualEnvArgumentr   ^  s(    --	 Kr   )F)NNF)r   F)"r   rs   googlecloudsdk.callioper   r   googlecloudsdk.command_lib.utilr   r   r   ParameterInfoByConventionr
   r"   r-   r'   rB   rF   rO   rX   r\   rd   rj   ro   ru   rz   r~   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    3  / ( 6 > 4	 1KK $	::: 	.  )+>*FG  
			2
	  	8(	r   