
     	                         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	d
Z
e	j                   G d de	j                               Ze
e_        y)z'logging views list' command.    )absolute_import)division)unicode_literals)util)arg_parsers)basez2
        Lists the views defined on a bucket.
    zK
     To list the views defined on a bucket, run:

        $ {command}
    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)ListzList the defined views.c                     t        j                  | d       t        j                  | dd       | j                  ddt	        j
                  dd      d       | j                  j                  d	       y
)z Register flags for this command.zviews to listTz Location of the specified bucketz--bucketz.+zmust be non-emptyzID of bucket)requiredtypehelpzGtable(name.segment(-1):label=VIEW_ID, filter, create_time, update_time)N)r   AddParentArgsAddBucketLocationArgadd_argumentr   RegexpValidatordisplay_info	AddFormat)parsers    !lib/surface/logging/views/list.pyArgsz	List.Args*   sq     	v/8:
T((0CD   !!	    c           	   #   8  K   t        j                         j                  j                  t        j                         j                  t        j                  t        j                  |      d|j                                    }|j                  D ]  }|  yw)zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
      command invocation.

    Yields:
      The list of views.
    buckets)parentN)
r   	GetClient projects_locations_buckets_viewsr   GetMessages/LoggingProjectsLocationsBucketsViewsListRequestCreateResourceNameGetBucketLocationFromArgsbucketviews)selfargsresultviews       r   RunzList.Run9   s~      ^^>>CCJJ**..t4iN 	K 	OPF j s   BBN)__name__
__module____qualname____doc__staticmethodr   r*    r   r   r   r   &   s     r   r   N)r.   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   DETAILED_HELPUniverseCompatibleListCommandr   detailed_helpr0   r   r   <module>r8      s_     $ &  ' / / (		 !4 ! !F # r   