Ë
    €Ïð  ã                   ó€   — 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	lZ	 	 dd
„Z	 	 	 	 dd„Zy	)z%Module for resource_args API support.é    )Úabsolute_import)Údivision)Úunicode_literals)Úconcepts)Ú	yaml_data)Úconcept_parsers)Úpresentation_specsNc                 ó$  — t         j                  j                  |«      }t        j                  j                  |j                  «       «      }t        j                  j                  |r|n|j                  «       |||¬«      j                  | «       y)a¢  Adds a resource argument in a python command.

  Args:
    parser: the parser for the command.
    resource_path: string, the resource_path which refers to the resources.yaml.
    help_text: string, the help text of the resource argument.
    name: string, the default is the name specified in the resources.yaml file.
    required: boolean, the default is True because in most cases resource arg is
      required.
  )ÚnameÚresource_specÚ
group_helpÚrequiredN)r   ÚResourceYAMLDataÚFromPathr   ÚResourceSpecÚFromYamlÚGetDatar   ÚConceptParserÚForResourceÚ
GetArgNameÚAddToParser)ÚparserÚresource_pathÚ	help_textr   r   Úresource_yaml_datar   s          ú9lib/googlecloudsdk/command_lib/util/args/resource_args.pyÚAddResourceArgToParserr      sz   € ô !×1Ñ1×:Ñ:¸=ÓIÐÜ×'Ñ'×0Ñ0Ð1C×1KÑ1KÓ1MÓN€-Ü×Ñ×+Ñ+Ù‰DÐ0×;Ñ;Ó=Ø!ØØð	 ,ó ÷ %™ VÕ,ó    c                 ó  — |r| nd| z   }|j                  || ¬«      }	|r5t        j                  |«      D ]  \  }
}|d   D ]  }|d   |
k(  sŒ||d<   Œ Œ t        j                  |t
        j                  j                  |«      |	||¬«      S )a³  Build ResourcePresentationSpec for a Resource.

  Args:
    name: string, name of resource anchor argument.
    verb: string, the verb to describe the resource, such as 'to create'.
    resource_data: dict, the parsed data from a resources.yaml file under
        command_lib/.
    attribute_overrides: dict{string:string}, map of resource attribute names to
      override in the generated resrouce spec.
    help_text: string, the help text for the entire resource arg group. Should
      have 2 format format specifiers (`{name}`, `{verb}`) to insert the
      name and verb repectively.
    required: bool, whether or not this resource arg is required.
    prefixes: bool, if True the resource name will be used as a prefix for
      the flags in the resource group.
    positional: bool, if True, means that the resource arg is a positional
      rather than a flag.
  Returns:
    ResourcePresentationSpec, presentation spec for resource.
  z--)Úverbr   Ú
attributesÚattribute_name)r   Úprefixes)ÚformatÚsixÚ	iteritemsr	   ÚResourcePresentationSpecr   r   r   )r   r    Úresource_dataÚattribute_overridesr   r   r#   Ú
positionalÚarg_nameÚarg_helpr"   ÚvalueÚattrs                r   ÚGetResourcePresentationSpecr/   6   s    € ñ2  ‰T T¨D¡[€(Ø×Ñ 4¨dÐÓ3€(áÜ!$§¡Ð/BÖ!CÑˆ˜Ø Ô-ˆ$ØÐ Ñ! ^Ó3Ø#(ˆ$ÐÒ
 ñ .ð "Dô
 
×	4Ñ	4ØÜ×Ñ×$Ñ$ ]Ó3ØØØô
ð r   )NT)NzThe {name} {verb}.FTF)Ú__doc__Ú
__future__r   r   r   Ú googlecloudsdk.calliope.conceptsr   Ú$googlecloudsdk.command_lib.util.apisr   Ú(googlecloudsdk.command_lib.util.conceptsr   r	   r%   r   r/   © r   r   Ú<module>r6      sD   ðñ ,å &Ý Ý 'å 5Ý :Ý DÝ Gó ð !%Ø$(ó	-ð2 59Ø*>Ø9=Ø+0ô	(r   