
                             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
\	R                  5      rg)z+Parameter info lib for resource completers.    )absolute_import)division)unicode_literals)deps)util)parameter_info_lib)
propertiesc                   T   ^  \ rS rSrSrU 4S jrS	S jrS rS
S jr  SS jr	Sr
U =r$ )ResourceParameterInfo   z+Gets parameter info for resource arguments.c                 >   > Xl         [        [        U ]  " UU40 UD6  g)zInitializes.N)resource_infosuperr   __init__)selfr   parsed_argsargumentkwargs	__class__s        Glib/googlecloudsdk/command_lib/util/concepts/resource_parameter_info.pyr   ResourceParameterInfo.__init__   s)    &	
/     c                    AU R                   R                  R                  U5      n[        R                  R
                  R                  R                  5       n[        R                  R
                  R                  R                  S5         U(       a8  [        R                  " UU R                   R                  5       U R                  S9OS [        R                  R
                  R                  R                  U5        $ ! [        R                   a6     [        R                  R
                  R                  R                  U5        gf = f! [        R                  R
                  R                  R                  U5        f = f)zReturns the program state value for parameter_name.

Args:
  parameter_name: The parameter name.
  check_properties: bool, whether to check the properties (unused).

Returns:
  The program state value for parameter_name.
T)r   N)r   resource_specAttributeNamer	   VALUEScoredisable_promptsGetBoolSetr   GetBuildFullFallthroughsMapr   AttributeNotFoundError)r   parameter_namecheck_propertiesattribute_namecurrents        r   GetValueResourceParameterInfo.GetValue&   s*    	((66~F $$44<<>G **..t4: ,: XX




5
5
7&&( @DD ,,009 && ,,009 ,,009s%   A D EE EE 5Fc                 L    U R                   R                  R                  U5      $ )zCHelper function to get the corresponding attribute for a parameter.)r   r   r   )r   r$   s     r   _AttributeName$ResourceParameterInfo._AttributeNameB   s    ++99.IIr   c                     AU R                  U5      nU R                  R                  R                  US5      nU(       d  g[        R
                  " U5      $ )zReturns the argument parser dest name for parameter_name with prefix.

Args:
  parameter_name: The resource parameter name.
  prefix: The prefix name for parameter_name if not None.

Returns:
  The argument parser dest name for parameter_name.
N)r+   r   attribute_to_args_mapgetr   NamespaceFormat)r   r$   prefixr&   	flag_names        r   GetDestResourceParameterInfo.GetDestF   sP     	((8N""88<<^=ACI	**r   c                    AU R                  U5      nU R                  R                  R                  US5      nU(       d
  US:X  a  SnOgU R	                  U5      nX':w  a"  Uc  UnU(       a  USL a  U$ SR                  XbS9$ g)aG  Returns the command line flag for parameter.

If the flag is already present in program values, returns None.
If the user needs to specify it, returns a string in the form
'--flag-name=value'. If the flag is boolean and True, returns '--flag-name'.

Args:
  parameter_name: The parameter name.
  parameter_value: The parameter value if not None. Otherwise
    GetValue() is used to get the value.
  check_properties: Check property values if parsed_args don't help.
  for_update: Return flag for a cache update command.

Returns:
  The command line flag  for the parameter, or None.
Nprojectz	--projectTz{name}={value})namevalue)r+   r   r.   r/   r(   format)r   r$   parameter_valuer%   
for_updater&   r2   program_values           r   GetFlagResourceParameterInfo.GetFlagX   s    $ 	((8N""88<<I 
9	$	MM.1M'		 '	d"
&&I&MMr   )r   )T)N)NTF)__name__
__module____qualname____firstlineno____doc__r   r(   r+   r3   r=   __static_attributes____classcell__)r   s   @r   r   r      s-    3:8J+$ 5905& &r   r   N)rC   
__future__r   r   r    googlecloudsdk.calliope.conceptsr   r   googlecloudsdk.command_lib.utilr   googlecloudsdk.corer	   ParameterInfoByConventionr    r   r   <module>rL      s4    2 &  ' 1 1 > *c.HH cr   