
    
                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ  G d	 d
ej                        Zy)z>A command that lists the resource collections for a given API.    )absolute_import)division)unicode_literalsN)base)flags)registryc                   &    e Zd ZdZed        Zd Zy)Listz5List the methods of a resource collection for an API.c                    t         j                  j                  |        t         j                  j                  |        t        j                  dt
        j                  d      }|j                  |        t
        j                  j                  |        t        j                  dt
        j                  d      }|j                  |        | j                  j                  d       y )Nz--collectionzjThe name of the collection for which to list methods.
If left blank, returns methods from all collections.)	completerhelpz--apizThe name of the API to get the methods for. If `--api-version` is also supplied, then returns methods from specified version, otherwise returns methods from all versions of this API.z
      table(
        name:sort=1,
        detailed_path:optional,
        http_method,
        request_type,
        response_type
      )
    )r   PAGE_SIZE_FLAGRemoveFromParserURI_FLAGArgumentr   CollectionCompleterAddToParserAPI_VERSION_FLAGAPICompleterdisplay_info	AddFormat)parsercollection_flagapi_flags      %lib/surface/meta/apis/methods/list.pyArgsz	List.Args    s    ((0MM""6*mm++DEO
 '	&&v.}}$$IKH  
!! # 	    c                    |j                   s|j                  r,t        j                  |j                  |j                        g}nIt        j
                         D cg c],  }t        j                  |j                  |j                        . }}t        t        j                  j                  |            }|D cg c]-  }t        j                  |j                  |j                        / }}t        t        j                  j                  |            }|S t        j                  |j                   |j                        S c c}w c c}w )N)api_version)
collectionapir   GetAPICollectionsr   
GetAllAPIsnameversionlist	itertoolschainfrom_iterable
GetMethods	full_name)selfargscollectionsr!   r    methodss         r   RunzList.Run<   s   ??	11$((D<L<LMN  **,
, &&sxx=, 	 
 66{CDk $/0#.Z $$Z%9%91;1G1GI#.  0 Y__227;<gntD<L<LMM

0s   1E;2E	N)__name__
__module____qualname____doc__staticmethodr   r0    r   r   r
   r
      s    =	 	6Nr   r
   )r4   
__future__r   r   r   r'   googlecloudsdk.callioper   $googlecloudsdk.command_lib.meta.apisr   $googlecloudsdk.command_lib.util.apisr   ListCommandr
   r6   r   r   <module>r<      s4     E &  '  ( 6 9/N4 /Nr   