
    3                         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mZ  G d
 de
j                        Zy)z#The configs variables list command.    )absolute_import)division)unicode_literals)
list_pager)util)base)flags)logc                   8    e Zd ZdZdZddiZed        Zd Zd Z	y)	ListzList variable resources within a configuration.

  This command lists the variable resources within a specified configuration.
  d   EXAMPLESat            To list all variables within the configuration named "my-config", run:

            $ {command} --config-name=my-config

          The --filter parameter can be used to filter results based on content.
          For example, to list all variables under the path 'status/', run:

            $ {command} --config-name=my-config --filter='name=status/*'
          c                     t        j                  |        | j                  ddd       | j                  j	                  d       y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    z--values
store_truezQList the variables for which you have Get IAM permission along with their values.)actionhelpz'table(name, updateTime, value:optional)N)r	   AddRequiredConfigFlagadd_argumentdisplay_info	AddFormat)parsers    4lib/surface/runtime_config/configs/variables/list.pyArgsz	List.Args3   sG     
'
8  :
 !!"KL    c              #     K   t        j                         }t        j                         }t        j                  t        j                  |            }|j
                  | _        |j                  |j                         | j                        }|j                  xs | j                  }t        j                  ||dd|j                  |      }|D ]$  }t        j                  || j                         & yw)a(  Run 'runtime-configs variables list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Yields:
      The list of variables.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    )parentreturnValues	variablespageSize)fieldbatch_size_attributelimit
batch_sizeN)r   VariableClientMessagesParseConfigName
ConfigNamevalues_display_values0RuntimeconfigProjectsConfigsVariablesListRequestRelativeName	page_sizeDEFAULT_PAGE_SIZEr   YieldFromListr"   FormatVariable)	selfargsvariable_clientmessagesconfig_resourcerequestr,   resultsresults	            r   RunzList.RunE   s      ))+O}}H**4??4+@AO;;DGG++-)) H +G 8$"8"8I&&'tzzG (<(<== s   C6C8c                 b    |r-| j                   r t        j                  j                  d       y y y )NzWith --values flag specified, only those variables for which you have Get IAM permission will be returned along with their values.
To see all the variables for which you have List IAM permission, please run the command without the --values flag.
)r)   r
   statusPrint)r0   resources_were_displayeds     r   EpilogzList.Epilogi   s,    D$8$8	jj   %9r   N)
__name__
__module____qualname____doc__r-   detailed_helpstaticmethodr   r8   r=    r   r   r   r      sA    
   	- M M"">Hr   r   N)rA   
__future__r   r   r   apitools.base.pyr   %googlecloudsdk.api_lib.runtime_configr   googlecloudsdk.callioper   )googlecloudsdk.command_lib.runtime_configr	   googlecloudsdk.corer
   ListCommandr   rD   r   r   <module>rL      s6     * &  ' ' 6 ( ; #P4 Pr   