
    5                         d Z ddlmZ ddlmZ ddlmZ ddlmZ d Z	 d"dZ	d	 Z
d
 Zd Zd Zd Zd Zd Z	 d"dZ	 d"dZd Zd Zd Z	 d"dZd Z	 d"dZ	 d"dZ	 d"dZd Zd Zd Zd Z	 d"dZd Z d  Z!	 d"d!Z"y)#z8Resource flags and helpers for the deploy command group.    )concepts)deps)concept_parsers)
propertiesc                      t        j                  dt        j                  t	        j
                  d            gd      S )z1Creates the delivery pipeline resource attribute.zdelivery-pipelinezdeploy/delivery_pipelinezrThe delivery pipeline associated with the {resource}.  Alternatively, set the property [deploy/delivery-pipeline].)namefallthroughs	help_textr    ResourceParameterAttributeConfigr   PropertyFallthroughr   
FromString     6lib/googlecloudsdk/command_lib/deploy/resource_args.pyDeliveryPipelineAttributeConfigr      s@    		2	2

"
"##$>?I
 r   Nc                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd --release resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Release.releasez	--releaseFrequiredpluralN)r   ConceptParserForResourceGetReleaseResourceSpecAddToParserparserr
   
positionalr   s       r   AddReleaseResourceArgr   (   J     55)++i; , 
  K'r   c            	          t        j                  ddt               t               t         j                  t               d      S )HConstructs and returns the Resource specification for Delivery Pipeline.z9clouddeploy.projects.locations.deliveryPipelines.releasesr   F)resource_namedeliveryPipelinesId
releasesId
projectsIdlocationsIddisable_auto_completers)r   ResourceSpecr   ReleaseAttributeConfig DEFAULT_PROJECT_ATTRIBUTE_CONFIGLocationAttributeConfigr   r   r   r   r   =   s9    			A9;')::)+#
% %r   c                  0    t        j                  dd      S )z'Creates the release resource attribute.r   z+The release associated with the {resource}.r   r
   r   r   r   r   r   r*   r*   I       		2	2 M
O Or   c            	          t        j                  ddt        j                  t	        j
                  d            gd      S )z(Creates the location resource attribute.regionr'   zdeploy/regionzVThe Cloud region for the {resource}.  Alternatively, set the property [deploy/region].)r   parameter_namer	   r
   r   r   r   r   r,   r,   O   s>    		2	2"

"
":#8#8#I
J>

 
r   c                 x    t         j                  j                  dt               dd      j	                  |        y)zAdds a resource argument for a cloud deploy region.

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

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
  z--regionzThe Cloud region of {resource}.T)r   N)r   r   r   GetLocationResourceSpecr   )r   s    r   AddLocationResourceArgr6   ^   s8     ++'	 ,  ![(r   c                  `    t        j                  ddt               t         j                        S )z?Constructs and returns the Resource specification for location.zclouddeploy.projects.locationslocation)r#   r'   r&   )r   r)   r,   r+   r   r   r   r5   r5   m   s*    			&)+::	
 r   c                  0    t        j                  dd      S )z&Creates the target resource attribute.targetz*The target associated with the {resource}.r.   r/   r   r   r   TargetAttributeConfigr;   w   s    		2	2K
M Mr   c                  t    t        j                  ddt               t         j                  t	               d      S )z;Constructs and returns the target specification for Target.z&clouddeploy.projects.locations.targetsr:   F)r#   	targetsIdr&   r'   r(   )r   r)   r;   r+   r,   r   r   r   GetTargetResourceSpecr>   }   s3    			.%'::)+#
% %r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd target resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Target.r:   z--targetFr   N)r   r   r   r>   r   r   s       r   AddTargetResourceArgr@      sJ     44)++h* , 
  K'r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdds --delivery-pipeline resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  z"The name of the Delivery Pipeline.delivery_pipelinez--delivery-pipelineFr   N)r   r   r   GetDeliveryPipelineResourceSpecr   r   s       r   AddDeliveryPipelineResourceArgrD      sL     ??)++'-B%' , 
  K'r   c                  t    t        j                  ddt               t         j                  t	               d      S )r"   z0clouddeploy.projects.locations.deliveryPipelinesrB   Fr#   r$   r&   r'   r(   r   r)   r   r+   r,   r   r   r   rC   rC      s3    			8'9;::)+#
% %r   c                  0    t        j                  dd      S )z'Creates the rollout resource attribute.rolloutz+The rollout associated with the {resource}.r.   r/   r   r   r   RolloutAttributeConfigrJ      r0   r   c            
          t        j                  ddt               t               t	               t         j
                  t               d      S )z>Constructs and returns the resource specification for Rollout.zBclouddeploy.projects.locations.deliveryPipelines.releases.rolloutsrI   Fr#   r$   r%   
rolloutsIdr&   r'   r(   r   r)   r   r*   rJ   r+   r,   r   r   r   GetRolloutResourceSpecrO      s?    			J9;')')::)+#
% %r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd --rollout resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Rollout.rI   z	--rolloutFr   N)r   r   r   rO   r   r   s       r   AddRolloutResourceArgrQ      r    r   c            
          t        j                  ddt               t               t	               t         j
                  t               d      S )z>Constructs and returns the Resource specification for Job Run.zJclouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRunsjob_runFrL   rN   r   r   r   GetJobRunResourceSpecrT      s?    			R9;')')::)+#	
 	r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd --job-run resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Job Run.rS   z	--job-runFr   N)r   r   r   rT   r   r   s       r   AddJobRunResourceArgrV      sJ     55)++i; ,  Kr   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd --automation-run resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the AutomationRun.automation_runz--automation-runFr   N)r   r   r   GetAutomationRunResourceSpecr   r   s       r   AddAutomationRunResourceArgrZ   	  sL     ;;)++$*<"$ ,  Kr   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdd --automation resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Automation.
automationz--automationFr   N)r   r   r   GetAutomationResourceSpecr   r   s       r   AddAutomationResourceArgr^     sJ     88)++ ln! ,  Kr   c                  t    t        j                  ddt               t         j                  t	               d      S )zDConstructs and returns the Resource specification for AutomationRun.z?clouddeploy.projects.locations.deliveryPipelines.automationRunsrX   FrF   rG   r   r   r   rY   rY   5  s3    			G$9;::)+#
 r   c                  t    t        j                  ddt               t         j                  t	               d      S )zAConstructs and returns the Resource specification for Automation.z<clouddeploy.projects.locations.deliveryPipelines.automationsr\   FrF   rG   r   r   r   r]   r]   A  s3    			D 9;::)+#
 r   c                  0    t        j                  dd      S )z2Creates the Custom Target Type resource attribute.custom_target_typez6The Custom Target Type associated with the {resource}.r.   r/   r   r   r   CustomTargetTypeAttributeConfigrc   M  s    		2	2H
 r   c                  t    t        j                  ddt               t         j                  t	               d      S )zIConstructs and returns the Resource specification for Custom Target Type.z0clouddeploy.projects.locations.customTargetTypesrb   F)r#   customTargetTypesIdr&   r'   r(   )r   r)   rc   r+   r,   r   r   r   GetCustomTargetTypeResourceSpecrf   U  s3    			8(9;::)+#
 r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdds --custom-target-type resource argument to the parser.

  Args:
    parser: argparse.ArgumentPArser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  z#The name of the Custom Target Type.rb   z--custom-target-typeFr   N)r   r   r   rf   r   r   s       r   AddCustomTargetTypeResourceArgrh   a  sL     @@)++(.D%' ,  Kr   c                  0    t        j                  dd      S )z-Creates the Deploy Policy resource attribute.deploy_policyz1The Deploy Policy associated with the {resource}.r.   r/   r   r   r   DeployPolicyAttributeConfigrk   w  s    		2	2C
 r   c                  t    t        j                  ddt               t         j                  t	               d      S )zDConstructs and returns the Resource specification for Deploy Policy.z-clouddeploy.projects.locations.deployPolicieszdeploy policyF)r#   deployPoliciesIdr&   r'   r(   )r   r)   rk   r+   r,   r   r   r   GetDeployPolicyResourceSpecrn     s3    			5#24::)+#
 r   c                     |xs d}t         j                  j                  |rdndt               ||d      j	                  |        y)zAdds --deploy-policy resource argument to the parser.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: help text for this flag.
    positional: if it is a positional flag.
    required: if it is required.
  zThe name of the Deploy Policy.rj   z--deploy_policyFr   N)r   r   r   rn   r   r   s       r   AddDeployPolicyResourceArgrp     sK     ;;)++#o):!# ,  Kr   )NFT)#__doc__ googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   r   r   r*   r,   r6   r5   r;   r>   r@   rD   rC   rJ   rO   rQ   rT   rV   rZ   r^   rY   r]   rc   rf   rh   rk   rn   rp   r   r   r   <module>ru      s    ? 6 1 D *" 8<(*	%O)M% 8<(, 8<(*%O
% 8<(* 8<. 8<. 8<,			 8<,	 8<r   