
                              d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd
ZddZddZddZddZddZddZddZddZddZd dZ	 	 d!dZ	 	 d"dZ	 	 d#dZd dZd Zy	)$z3Shared resource args for Cloud API Gateway surface.    )absolute_import)division)unicode_literals)concepts)deps)concept_parsers)presentation_specsNc                       } dk(  rd}g } r7|j                  t        j                   fddj                  |                   t	        j
                  d|d      S )z"Creates location attribute config.-z
a wildcardc                       S N defaults   ;lib/googlecloudsdk/command_lib/api_gateway/resource_args.py<lambda>z)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                 0    t        j                  | d      S )NzName for API Gatewayr   r   r   r   r   s    r   GatewayAttributeConfigr#   0   s    		2	2&
( (r   c                     g }|r&|j                  t        j                  d d             t        j                  | |d      S )Nc                       y)Nr   r   r   r   r   r   z$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                 0    t        j                  | d      S )NzAPI Config ID.r    r!   r"   s    r   ApiConfigAttributeConfigr)   D   s    		2	2 
" "r   c                 0    t        j                  | d      S )Nz&The name for the API Gateway operationr    r!   r"   s    r   OperationAttributeConfigr+   J   s    		2	28
: :r   c                 d    t        j                  d| t        |      t         j                        S )Nzapigateway.projects.locationsr   )resource_namelocationsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIG)r-   r   s     r   GetLocationResourceSpecr2   P   s,    			%!)':::	
< <r   c                 r    t        j                  d| t               t               t         j                        S )Nz&apigateway.projects.locations.gateways)r-   
gatewaysIdr.   r/   )r   r0   r#   r   r1   r-   s    r   GetGatewayResourceSpecr6   X   s0    			.!'))+::
< <r   c                 z    t        j                  d| t        |      t        d      t         j                        S )Nz"apigateway.projects.locations.apisr&   globalr   )r-   apisIdr.   r/   )r   r0   r'   r   r1   )r-   r&   s     r   GetApiResourceSpecr;   a   s4    			*!2)(;::
< <r   c           	          t        j                  d| t               t               t	        d      t         j
                        S )Nz*apigateway.projects.locations.apis.configsr9   r   )r-   	configsIdr:   r.   r/   )r   r0   r)   r'   r   r1   r5   s    r   GetApiConfigResourceSpecr>   j   s8    			2!(*!)(;::
< <r   c                 r    t        j                  d| t               t               t         j                        S )Nz(apigateway.projects.locations.operations)r-   operationsIdr.   r/   )r   r0   r+   r   r1   r5   s    r   GetOperationResourceSpecrA   t   s0    			0!+-)+::
< <r   c                     |rd}nd}t         j                  j                  |t               dj	                  |      |      j                  |        y)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ForResourcer6   r   AddToParserparserverb
positionalrF   r   s        r   AddGatewayResourceArgrN   }   sP     DD++
*11$7	 ,  %V,r   c           
          t        j                  t        j                  dt	               dj                  |      |      t        j                  dt               dddi|      g      j                  |        y	)
a?  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
  rC   rD   rE   --api-configz2Resource name for API config the gateway will use.r    flag_name_overridesrF   N)r   rG   r	   ResourcePresentationSpecr6   r   r>   rI   )rK   rL   gateway_requiredapi_config_requireds       r   AddGatewayApiConfigResourceArgsrW      sr     

5
5$&299$?'	)
 
5
5&(B#-r"2*,	 
V	r   c                     |rd}nd}d}|dk(  rddi}t         j                  j                  |t        |      dj	                  |      ||      j                  |        y)	aM  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
--locationNr9   rQ   r   zParent location which {}.rR   )r   rG   rH   r2   r   rI   )rK   rL   rM   r   rF   r   overrides          r   AddLocationResourceArgrZ      sl     DD(BH++
g.!((." , 
 %V,r   c                     |rd}nd}t         j                  j                  |t        |      dj	                  |      ddi|      j                  |        y)	a[  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--apir8   zName for API which {}.r   rQ   rR   N)r   rG   rH   r;   r   rI   )rK   rL   rM   rF   r&   r   s         r   AddApiResourceArgr]      sZ     DD++
(+%%d+%r* , 
 %V,r   c                     |rd}nd}t         j                  j                  |t               dj	                  |      ddi|      j                  |        y)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_configrP   z%Name for API Config which will be {}.r   rQ   rR   N)r   rG   rH   r>   r   rI   rJ   s        r   AddApiConfigResourceArgr`      sX     DD++
 -44T:%r* , 
 %V,r   c                     t         j                  j                  dt               dj	                  |      d      j                  |        y )N	operationz The name of the operation to {}.TrE   )r   rG   rH   rA   r   rI   )rK   rL   s     r   AddOperationResourceArgsrc     sA    ++ (//5	 ,  ![(r   r   )rC   )r\   F)z
api-config)rb   )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+   r2   r6   r;   r>   rA   rN   rW   rZ   r]   r`   rc   r   r   r   <module>rh      s     : &  ' 5 1 D G2((":<<<<<-. DH8<: DH$(-> @D$-4-0)r   