
    &                        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j                  ej                  j                               Zd Z ej                  ej                  j                          G d	 d
ej"                               Z ej                  ej                  j&                         G d de             Zy)z!The `app instances list` command.    )absolute_import)division)unicode_literals)appengine_api_client)basez%https://appengine.googleapis.com/{0}/c                 z    	 t         | j                  j                  z   S # t        $ r t         | d   d   z   cY S w xY w)Ninstancename)APPENGINE_PATH_STARTr	   r
   AttributeError)resources    !lib/surface/app/instances/list.py_GetUrir      sB    ?("3"3"8"888	 ?(:"6v">>>?s    ::c                   .    e Zd ZdZddiZed        Zd Zy)ListBList the instances affiliated with the current App Engine project.EXAMPLESa+            To list all App Engine instances, run:

              $ {command}

          To list all App Engine instances for a given service, run:

              $ {command} -s myservice

          To list all App Engine instances for a given version, run:

              $ {command} -v v1
          c                     | j                  ddd       | j                  ddd       | j                  j                  d       | j                  j                  t               | j                  j                  d        y 	Nz	--servicez-szAIf specified, only list instances belonging to the given service.)helpz	--versionz-vzAIf specified, only list instances belonging to the given version.a  
          table(
            service:sort=1,
            version:sort=2,
            id:sort=3,
            instance.vmStatus.yesno(no="N/A"),
            instance.vmLiveness,
            instance.vmDebugEnabled.yesno(yes="YES", no=""):label=DEBUG_MODE
          )
    add_argumentdisplay_info	AddFormat
AddUriFuncr   AddCacheUpdaterparsers    r   Argsz	List.Args9   s    
T3  5 T3  5 !! 	# 		 ""7+
''-    c                     t        j                  | j                               }|j                  |j                  |j
                        S Nr   GetApiClientForTrackReleaseTrackGetAllInstancesserviceversionselfargs
api_clients      r   RunzList.RunO   6    %::4;L;L;NOJ%%dllDLLAAr    N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r-    r    r   r   r   %   s0    J  -  . .*Br    r   c                   &    e Zd ZdZed        Zd Zy)ListBetar   c                     | j                  ddd       | j                  ddd       | j                  j                  d       | j                  j                  t               | j                  j                  d        y r   r   r   s    r   r   zListBeta.ArgsX   s    
#  %
 #  %
 !! 	# 		 ""7+
''-r    c                     t        j                  | j                               }|j                  |j                  |j
                        S r"   r#   r)   s      r   r-   zListBeta.Runq   r.   r    N)r/   r0   r1   r2   r4   r   r-   r5   r    r   r7   r7   T   s    J. .0Br    r7   N)r2   
__future__r   r   r   googlecloudsdk.api_lib.appr   googlecloudsdk.callioper   formatAppengineApiClient
ApiVersionr   r   ReleaseTracksr%   GAListCommandr   BETAr7   r5   r    r   <module>rD      s    ( &  ' ; (>EE++668: ? D%%(()+B4 +B *+B\ D%%**+Bt B ,Br    