
    >                         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-Command to list Apigee API proxy deployments.    )absolute_import)division)unicode_literals)apigee)base)
exceptions)defaults)resource_argsc                   0    e Zd ZdZdddZed        Zd Zy)Listz"List Apigee API proxy deployments.z          {description}

          `{command}` lists deployments of API proxies, optionally filtered by
          environment, proxy name, proxy revision, or a combination of these.
          aS  
          To list all deployments for the active Cloud Platform project, run:

              $ {command}

          To list all deployments in an Apigee organization called ``my-org'',
          run:

              $ {command} --organization=my-org

          To list all deployments of an API proxy called ``my-proxy'' in the
          active Cloud Platform project, run:

              $ {command} --api=my-proxy

          To list all deployments to the ``test'' environment of the active
          Cloud Platform project, formatted as a JSON array, run:

              $ {command} --environment=test --format=json

          To list all deployments of ``my-proxy'' to the ``test'' environment in
          an Apigee organization called ``my-org'', run:

              $ {command} --organization=my-org --api=my-proxy --environment=test
          )DESCRIPTIONEXAMPLESc           	      6   dddd}t        j                         t        j                  dd      t        j                  dt              t        j                  dt              g}t	        j
                  | d	d
dd||       | j                  j                  d       y )NzThe API proxy whose deployments should be listed. If not provided, all proxies will be listed. To get a list of existing API proxies, run `{{grandparent_command}} apis list`.zThe environment whose deployments should be listed. If not provided, all environments will be listed. To get a list of available environments, run `{{grandparent_command}} environments list`.zThe organization whose deployments should be listed.If unspecified, the Cloud Platform project's associated organization will be used.)apienvironmentorganizationrevisionallr   r   z%organization.environment.api.revisionzAPI proxy revision and environment whose deployments should be listed. Providing a REVISION is only valid if API is also specified. If no REVISION is provided, all deployed revisions that match the other arguments will be included.FT)
positionalrequiredfallthroughs
help_textsz$table(environment,apiProxy,revision))r	   !GCPProductOrganizationFallthroughStaticFallthroughr   r
   AddSingleResourceArgumentdisplay_info	AddFormat)parser	help_textr   s      &lib/surface/apigee/deployments/list.pyArgsz	List.ArgsB   s    7GAI6 	224
 	"":u5
 	""=#6""5#.L ++/	, !
 !!"HI    c                 .   |j                   j                  j                         j                         }|d   t        u r!|d   dk7  rt        j                  dd      |d= |d   t        u r|d= |d   dk(  r|d= t        j                  j                  |      S )zRun the list command.apisIdrevisionsIdr   z--apiz2Filtering by revision requires specifying its API.environmentsId)
CONCEPTSr   ParseAsDictr   r   RequiredArgumentExceptionr   DeploymentsClientr   )selfargsidentifierss      r    RunzList.Runy   s    --((..0779K8#	]	#u	,22IK 	K
h
#$+
&
'=!U*
m
$##((55r"   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr!   r/    r"   r    r   r      s3    *"-H 4J 4Jl6r"   r   N)r3   
__future__r   r   r   googlecloudsdk.api_libr   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.apigeer	   r
   ListCommandr   r6   r"   r    <module>r<      s6    4 &  ' ) ( . 6 ;k64 k6r"   