
                             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
 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 rg	)$z3Shared resource args for Cloud API Gateway surface.    )absolute_import)division)unicode_literals)concepts)deps)concept_parsers)presentation_specsNc                    ^  T nT S:X  a  Sn/ nT (       a9  UR                  [        R                  " U 4S jSR                  U5      5      5        [        R
                  " SUSS9$ )z"Creates location attribute config.-z
a wildcardc                     > T $ N defaults   ;lib/googlecloudsdk/command_lib/api_gateway/resource_args.py<lambda>)LocationAttributeConfig.<locals>.<lambda>&   s    G    z0Location for API and API Configs. Defaults to {}locationzCloud location for {resource}.namefallthroughs	help_text)appendr   Fallthroughformatr    ResourceParameterAttributeConfig)r   default_keywordr   s   `  r   LocationAttributeConfigr      sj    /^"O,>EE!	"# 
	2	20
2 2r   c                 ,    [         R                  " U SS9$ )NzName for API Gatewayr   r   r   r   r   s    r   GatewayAttributeConfigr$   0   s    		2	2&
( (r   c                     / nU(       a'  UR                  [        R                  " S S5      5        [        R                  " U USS9$ )Nc                      g)Nr   r   r   r   r   r   $ApiAttributeConfig.<locals>.<lambda>;   s    Cr   z!Defaults to wildcard for all APIszAPI ID.r   )r   r   r   r   r   )r   wildcardr   s      r   ApiAttributeConfigr)   6   sJ    ,/	12
 
	2	2
 r   c                 ,    [         R                  " U SS9$ )NzAPI Config ID.r!   r"   r#   s    r   ApiConfigAttributeConfigr+   D   s    		2	2 
" "r   c                 ,    [         R                  " U SS9$ )Nz&The name for the API Gateway operationr!   r"   r#   s    r   OperationAttributeConfigr-   J   s    		2	28
: :r   c                 Z    [         R                  " SU [        US9[         R                  S9$ )Nzapigateway.projects.locationsr   )resource_namelocationsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIG)r/   r   s     r   GetLocationResourceSpecr4   P   s,    			%!)':::	
< <r   c                 n    [         R                  " SU [        5       [        5       [         R                  S9$ )Nz&apigateway.projects.locations.gateways)r/   
gatewaysIdr0   r1   )r   r2   r$   r   r3   r/   s    r   GetGatewayResourceSpecr8   X   s0    			.!'))+::
< <r   c           	      j    [         R                  " SU [        US9[        SS9[         R                  S9$ )Nz"apigateway.projects.locations.apisr(   globalr   )r/   apisIdr0   r1   )r   r2   r)   r   r3   )r/   r(   s     r   GetApiResourceSpecr=   a   s4    			*!2)(;::
< <r   c           
      ~    [         R                  " SU [        5       [        5       [	        SS9[         R
                  S9$ )Nz*apigateway.projects.locations.apis.configsr;   r   )r/   	configsIdr<   r0   r1   )r   r2   r+   r)   r   r3   r7   s    r   GetApiConfigResourceSpecr@   j   s8    			2!(*!)(;::
< <r   c                 n    [         R                  " SU [        5       [        5       [         R                  S9$ )Nz(apigateway.projects.locations.operations)r/   operationsIdr0   r1   )r   r2   r-   r   r3   r7   s    r   GetOperationResourceSpecrC   t   s0    			0!+-)+::
< <r   c                     U(       a  SnOSn[         R                  R                  U[        5       SR	                  U5      US9R                  U 5        g)a  Adds Gateway resource argument to parser.

Args:
  parser: parser to add arg to
  verb: action being taken with the Gateway
  positional: Boolean indicating if argument is positional, default False
  required: Boolean for if this is required, default is True

Returns: None
gatewayz	--gateway"Name for gateway which will be {}.requiredN)r   ConceptParserForResourcer8   r   AddToParserparserverb
positionalrH   r   s        r   AddGatewayResourceArgrP   }   sP     DD++
*11$7	 ,  %V,r   c                     [         R                  " [        R                  " S[	        5       SR                  U5      US9[        R                  " S[        5       SSS0US9/5      R                  U 5        g	)
a1  Adds Gateway and API Config resource arguments to parser.

Args:
  parser: parser to add arg to
  verb: action being taken with the Gateway
  gateway_required: Boolean for if Gateway is required, default is True
  api_config_required: Boolean for if API Config is required, default is True

Returns: None
rE   rF   rG   --api-configz2Resource name for API config the gateway will use.r    flag_name_overridesrH   N)r   rI   r	   ResourcePresentationSpecr8   r   r@   rK   )rM   rN   gateway_requiredapi_config_requireds       r   AddGatewayApiConfigResourceArgsrY      sr     

5
5$&299$?'	)
 
5
5&(B#-r"2*,	 
V	r   c                     U(       a  SnOSnSnUS:X  a  SS0n[         R                  R                  U[        US9SR	                  U5      UUS9R                  U 5        g)	a=  Adds location resource argument to parser.

Args:
  parser: parser to add arg to
  verb: action being taken with the location
  positional: Optional boolean indiicating if argument is positional
  default: Optional default value for the arg
  required: Boolean for if this is required, default is True

Returns: None
r   z
--locationNr;   rS   r   zParent location which {}.rT   )r   rI   rJ   r4   r   rK   )rM   rN   rO   r   rH   r   overrides          r   AddLocationResourceArgr\      sl     DD(BH++
g.!((." , 
 %V,r   c                     U(       a  SnOSn[         R                  R                  U[        US9SR	                  U5      SS0US9R                  U 5        g)	aK  Adds API resource argument to parser.

Args:
  parser: parser to add arg to
  verb: action being taken with the API
  positional: Optional boolean indiicating if argument is positional
  required: Boolean for if this is required, default is True
  wildcard: Boolean. Does arg have a default wildcard? default: False

Returns: None
apiz--apir:   zName for API which {}.r   rS   rT   N)r   rI   rJ   r=   r   rK   )rM   rN   rO   rH   r(   r   s         r   AddApiResourceArgr_      sZ     DD++
(+%%d+%r* , 
 %V,r   c                     U(       a  SnOSn[         R                  R                  U[        5       SR	                  U5      SS0US9R                  U 5        g)a  Adds API Config resource argument to parser.

Args:
  parser: parser to add arg to
  verb: action being taken with the API Config
  positional: Boolean indicating if argument is positional, default False
  required: Boolean for if this is required, default is True

Returns: None

api_configrR   z%Name for API Config which will be {}.r   rS   rT   N)r   rI   rJ   r@   r   rK   rL   s        r   AddApiConfigResourceArgrb      sX     DD++
 -44T:%r* , 
 %V,r   c                     [         R                  R                  S[        5       SR	                  U5      SS9R                  U 5        g )N	operationz The name of the operation to {}.TrG   )r   rI   rJ   rC   r   rK   )rM   rN   s     r   AddOperationResourceArgsre     sA    ++ (//5	 ,  ![(r   r   )rE   )r^   F)z
api-config)rd   )r   N)FT)TT)FNT)FTF)__doc__
__future__r   r   r    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr   r	   r   r$   r)   r+   r-   r4   r8   r=   r@   rC   rP   rY   r\   r_   rb   re   r   r   r   <module>rj      s     : &  ' 5 1 D G2((":<<<<<-. DH8<: DH$(-> @D$-4-0)r   