
                         
   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	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KJr  \R,                  \R.                  " \R0                  R2                  \R0                  R4                  5       " S S\
R6                  5      5       5       r\R.                  " \R0                  R8                  5       " S S\5      5       r\R                   \l         g)z'Command for listing available services.    )absolute_import)division)unicode_literals)global_methods)base)commands)connection_context)flags)	platforms)pretty_print)resource_args)serverless_operations)concept_parsers)presentation_specs)logc                   `    \ rS rSrSrSSS.r\S 5       r\S 5       r    SS jr	S	 r
S
 rSrg)List#   List available services.z"          {description}
          zK          To list available services:

              $ {command}
          )DESCRIPTIONEXAMPLESc           	          [         R                  " S[        R                  " 5       SSSSS9n[        R
                  " U/5      R                  U5        UR                  R                  U R                  5        g )Nz--namespacezNamespace to list services in.TF)requiredprefixeshidden)
r   ResourcePresentationSpecr   GetNamespaceResourceSpecr   ConceptParserAddToParserdisplay_info
AddUriFunc_GetResourceUri)clsparsernamespace_presentations       lib/surface/run/services/list.py
CommonArgsList.CommonArgs5   sl     0HH..0( !!#9 #$ %%0[%8
""3#6#67    c                 &    U R                  U5        g Nr'   r#   r$   s     r&   Args	List.ArgsD       NN6r)   c                    [         R                  S/nU(       a)  UR                  SR                  U(       a  SOS5      5        U(       a  UR                  S5        U(       a  UR                  S5        UR	                  / SQ5        UR                  5       R                  SR                  S	R                  U5      [        R                  S
95        g)aW  Set display format for output.

Args:
  args: Namespace, the args namespace
  show_region: bool, True to show region of listed services
  show_namespace: bool, True to show namespace of listed services
  show_description: bool, True to show description of listed services
  is_multi_region: bool, True if the list is for multi-region services
z'firstof(id,metadata.name):label=SERVICEzregion:label={}REGIONSREGIONznamespace:label=NAMESPACEzdescription:label=DESCRIPTION)zdomain:label=URLz&last_modifier:label="LAST DEPLOYED BY"z-last_transition_time:label="LAST DEPLOYED AT"ztable({columns}):({alias}),)columnsaliasN)
r   READY_COLUMNappendformatextendGetDisplayInfo	AddFormatjoinr   SATISFIES_PZS_ALIAS)selfargsshow_regionshow_namespaceshow_descriptionis_multi_regionr5   s          r&   
_SetFormatList._SetFormatH   s      	!!1G nn&f/YxHJnn01nn45NN  
 	##$++HHW%X-I-I 	, 	
r)   c                 N    U R                  USS9  [        R                  " U5      $ )z1Provides the method to provide a regionless list.T)rA   )rE   r   ListServices)r?   clientr@   s      r&   _GlobalListList._GlobalListm   s#    OODdO+&&v..r)   c           	         [         R                  " 5       [         R                  :H  nU(       a  UR                  S5      (       dy  [        R
                  " 5       nU R                  UR                  5        UR                  R                  R                  5         [        R                  " U R                  X15      5      $ [        R                  " U[         R"                  R$                  U R'                  5       5      nU R)                  XU(       + S9  UR                  R                  R                  5       n[*        R,                  " U5       nU R/                  UR0                  5        U(       d  SnSn[3        US5      (       a  SR5                  UR6                  5      n[3        US5      (       a  SR5                  UR8                  5      n[:        R<                  R?                  SR5                  UR@                  UUS	95        [        R                  " URC                  U5      5      sS
S
S
5        $ ! , (       d  f       g
= f)r   region)rA   rB    cluster_locationz in [{}]cluster_projectz in project [{}]z'For cluster [{cluster}]{zone}{project}:)clusterzoneprojectN)"r   GetPlatformPLATFORM_MANAGEDIsSpecifiedr   GetServerlessClientInstanceSetPartialApiEndpointurlCONCEPTS	namespaceParser   
SortByNamerJ   r	   GetConnectionContextr
   ProductRUNReleaseTrackrE   r   ConnectSetCompleteApiEndpointendpointhasattrr9   rO   rP   r   statusPrintcluster_namerH   )r?   r@   
is_managedrI   conn_contextnamespace_reflocation_msgproject_msgs           r&   RunList.Runr   s   &&(I,F,FFJ$**84499;f
  ,
mm##%  !1!1&!?@@'<<
!!4#4#4#68l
oo
J  Imm--335m ((6&##L$9$9:,+\#566%,,\-J-JKL\#455,33,,.K
**

DKK"//! L # $ ""6#6#6}#EF 766s   
CH//
H= N)FFFF)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr'   r.   rE   rJ   rn   __static_attributes__rp   r)   r&   r   r   #   s_     !- 8 8  
 # %"'!&#J/
Gr)   r   c                   (    \ rS rSrSr\S 5       rSrg)	AlphaList   r   c                 &    U R                  U5        g r+   r,   r-   s     r&   r.   AlphaList.Args   r0   r)   rp   N)rq   rr   rs   rt   ru   rw   r.   rx   rp   r)   r&   rz   rz      s      r)   rz   N)ru   
__future__r   r   r   googlecloudsdk.api_lib.runr   googlecloudsdk.callioper   googlecloudsdk.command_lib.runr   r	   r
   r   r   r   r   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   UniverseCompatibleReleaseTracksra   BETAGAr   ALPHArz   rp   r)   r&   <module>r      s    . &  ' 5 ( 3 = 0 4 7 8 @ D G # D%%**D,=,=,@,@AjG8== jG B jGZ D%%++,  - LL	 r)   