
    `                     0   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 d	d
dZdZd Z e	j                  e	j                   j"                  e	j                   j$                        e	j&                   G d de	j(                                      Zy)z:Command to list all enrollments in a project and location.    )absolute_import)division)unicode_literalsN)enrollments)base)flagsz{description}z         To list all enrollments in location `us-central1`, run:

          $ {command} --location=us-central1

        To list all enrollments in all locations, run:

          $ {command} --location=-

        or

          $ {command}
        )DESCRIPTIONEXAMPLESa   table(
    name.scope("enrollments"):label=NAME,
    message_bus.scope("messageBuses"):label=MESSAGE_BUS,
    message_bus.scope("projects").segment(1):label=MESSAGE_BUS_PROJECT,
    destination():label=DESTINATION,
    name.scope("locations").segment(0):label=LOCATION
)
c                     | j                  d      }|yd}t        j                  ||      }|r dj                  |j	                  d            S y)z1Generate a destination string for the enrollment.destinationzUnknown destinationz)^projects/.*/locations/.*/pipelines/(.*)$zPipeline: {}   )getresearchformatgroup)
enrollmentr   pipeline_str_patternmatchs       (lib/surface/eventarc/enrollments/list.py_Destinationr   7   sO    }-+ D
))(+
6%
  Q00	    c                   *    e Zd ZdZeZed        Zd Zy)ListzList Eventarc enrollments.c                 2   t        j                  | ddd       t        j                  |        | j                  j	                  t
               | j                  j                  t        j                         | j                  j                  dt        i       y )NzXThe location for which to list enrollments. This should be one of the supported regions.FT)requiredallow_aggregationr   )r   AddLocationResourceArgAddProjectResourceArgdisplay_info	AddFormat_FORMAT
AddUriFuncr   GetEnrollmentURIAddTransformsr   )parsers    r   Argsz	List.ArgsL   sz    	  	 
'
!!'*
"";#?#?@
%%|' r   c                     t        j                         }|j                  j                  j	                         }|j                  ||j                  |j                        S )N)r   EnrollmentClientV1CONCEPTSlocationParser   limit	page_size)selfargsclientlocation_refs       r   RunzList.Run\   sC    ++-F==))//1L;;|TZZ@@r   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr'   r3    r   r   r   r   E   s$     # - Ar   r   )r7   
__future__r   r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   r8   r"   r   ReleaseTracksReleaseTrackBETAGADefaultUniverseOnlyListCommandr   r;   r   r   <module>rF      s    A &  ' 	 7 ( 5 #" D%%**D,=,=,@,@AA4 A  BAr   