
                             d Z ddl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	 Zd
 Zd Zd Zd ZddZd Zd Zy)z>Utilities for flags for `gcloud cloudlocationfinder` commands.    N)arg_parsers)base)concepts)deps)concept_parsers)presentation_specsc                  ^    t        j                  ddt        j                  d d      g      S )zReturns the attribute config for a Cloud location.

  Returns:
    concepts.ResourceParameterAttributeConfig: Attribute config for a Cloud
      location.
  locationz&The Cloud location for the {resource}.c                       y)Nglobal r       ;lib/googlecloudsdk/command_lib/cloudlocationfinder/flags.py<lambda>z)LocationAttributeConfig.<locals>.<lambda>&   s    8r   zlocation is always global)name	help_textfallthroughs)r    ResourceParameterAttributeConfigr   Fallthroughr   r   r   LocationAttributeConfigr      s4     
	2	28


+-H
I
 r   c                  `    t        j                  ddt               t         j                        S )z}Returns the resource spec for a Cloud location.

  Returns:
    concepts.ResourceSpec: Resource spec for a Cloud location.
  z&cloudlocationfinder.projects.locationsr
   )resource_collectionresource_namelocationsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r   GetLocationResourceSpecr   +   s,     
		B)+::	
 r   c                  0    t        j                  dd      S )zReturns the attribute config for a source Cloud location.

  Returns:
    concepts.ResourceParameterAttributeConfig: Attribute config for a source
      Cloud location.
  cloud_locationThe source Cloud location.)r   r   )r   r   r   r   r   "SourceCloudLocationAttributeConfigr"   9   s     
	2	2'C
 r   c                  r    t        j                  ddt               t         j                  t	                     S )zReturns the resource spec for a source Cloud location.

  Returns:
    concepts.ResourceSpec: Resource spec for a source Cloud location.
  z5cloudlocationfinder.projects.locations.cloudLocationssource_cloud_location)r   r   r   r   cloudLocationsId)r   r   r   r   r"   r   r   r   "GetSourceCloudLocationResourceSpecr&   E   s2     
		
A+)+::9;
 r   c                 x    t         j                  j                  dt               dd      j	                  |        y)z]Adds a flag for specifying a location.

  Args:
    parser: The parser to add the flag to.
  
--locationzThe resource location.F)r   resource_spec
group_helprequiredN)r   ConceptParserForResourcer   AddToParserparsers    r   AddLocationFlagr1   V   s8     +++-)	 , 
 Kr   c           	          t        j                  t        j                  dt	               dd|      gddgi      j                  |        y)	zAdds a flag for specifying a source Cloud location.

  Args:
    parser: The parser to add the flag to.
    flag_name_overrides: A dictionary of flag name overrides.
  z--source-cloud-locationr!   T)r   concept_specr*   r+   flag_name_overridesz --source-cloud-location.locationr(   )command_level_fallthroughsN)r   r,   r   ResourcePresentationSpecr&   r.   )r0   r4   s     r   AddSourceCloudLocationFlagr7   d   sQ     

5
5,=?5"5 -|n" Kr   c                 X    t         j                  j                  |        t        |        y)zrAdds flags for listing Cloudlocations to the given parser.

  Args:
    parser: The parser to add the flags to.
  N)r   SORT_BY_FLAGRemoveFromParserr1   r/   s    r   AddListFlagsr;   {   s      $$V,&r   c                 >   t        |        t        | ddi       | j                  dd       | j                  dt        j                  dt
        j                  d	
      d       | j                  dt        j                  dt
        j                  d	
      d       y)ztAdds flags for searching Cloudlocations to the given parser.

  Args:
    parser: The parser to add the flags to.
  r
    )r4   z--queryz*Query to use for searching Cloudlocations.)helpz--limit   T)	unlimitedz&Maximum number of resources to return.)typer>   z--page-sizez%Maximum number of resources per page.N)r1   r7   add_argumentr   
BoundedIntsysmaxsizer/   s    r   AddSearchFlagsrF      s     &V*b9IJ7   	!!!S[[DA3  
 	!!!S[[DA2  r   )N)__doc__rD   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r"   r&   r1   r7   r;   rF   r   r   r   <module>rK      sH    E 
 / ( 5 1 D G 	".r   