
    c                     n    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  G d dej                        Z
y	)
z#`gcloud app services list` command.    )absolute_import)division)unicode_literals)appengine_api_client)basec                   .    e Zd ZdZddiZed        Zd Zy)ListzzList your existing services.

  This command lists all services that are currently deployed to the App Engine
  server.
  EXAMPLESz`          To list all services in the current project, run:

            $ {command}

          c                 :    | j                   j                  d       y )Nzu
          table(
            id:label=SERVICE:sort=1,
            versions.len():label=NUM_VERSIONS
          )
    )display_info	AddFormat)parsers     lib/surface/app/services/list.pyArgsz	List.Args)   s    
!! # 	    c                 P   t        j                  | j                               }|j                         }|j	                  |      }g }|D ]I  }|D cg c]  }|j
                  |j                  k(  s|  }}|j                  |j                  |d       K t        |d       S c c}w )N)idversionsc                     | d   S )Nr    )rs    r   <lambda>zList.Run.<locals>.<lambda>=   s    $r   )key)	r   GetApiClientForTrackReleaseTrackListServicesListVersionsservicer   appendsorted)	selfargs
api_clientservicesr   resultr   vversions_for_services	            r   RunzList.Run2   s    %::4;L;L;NOJ&&(H&&x0HF)1MAQYY'**5LaMmm)=
>@ 
 &/00	 Ns   B#/B#N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r(   r   r   r   r	   r	      s1      - 	 	1r   r	   N)r,   
__future__r   r   r   googlecloudsdk.api_lib.appr   googlecloudsdk.callioper   ListCommandr	   r   r   r   <module>r3      s+    * &  ' ; ($14 $1r   