
                         6   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lmZ dd	lmZ d
ddZ ej                   ej"                  j$                  ej"                  j&                        ej(                   G d dej*                                      Zy)z Command to create an enrollment.    )absolute_import)division)unicode_literals)enrollments)base)flags)labels_util)logz{description}a           To create a new enrollment `my-enrollment` in location `us-central1` for message-bus `my-message-bus` with cel matching expression `message.type == "google.cloud.pubsub.topic.v1.messagePublished"` and destination pipeline `my-pipeline`, run:

          $ {command} my-enrollment --location=us-central1 --message-bus=my-message-bus --cel-match="message.type == 'google.cloud.pubsub.topic.v1.messagePublished'" --destination-pipeline=my-pipeline
        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)CreatezCreate an Eventarc enrollment.c                     t        j                  |       t        j                  |d       t        j                  |       t
        j                  j                  |       y )NT)required)r   AddCreateEnrollmentResourceArgsAddCelMatchArgr	   AddCreateLabelsFlagsr   
ASYNC_FLAGAddToParser)clsparsers     *lib/surface/eventarc/enrollments/create.pyArgszCreate.Args,   s@    	))&1	$/$$V,OO'    c                 f   t        j                         }|j                  j                  j	                         }t        j                  dj                  |j                  |j                  |j                               |j                  ||j                  ||j                  |j                  j                  j	                         |j                  j                  j	                         t!        j"                  ||j%                                           }|j&                  r|S |j)                  |d|      S )zRun the create command.z4Creating enrollment {} for project {} in location {}Creating)r   EnrollmentClientV1CONCEPTS
enrollmentParser
   debugformatenrollmentsId
projectsIdlocationsIdr   BuildEnrollment	cel_matchmessage_busdestination_pipeliner	   ParseCreateArgsLabelsValueClassasync_WaitFor)selfargsclientenrollment_ref	operations        r   Runz
Create.Run3   s    ++-F]]--335NII>EE((%%&&	
 NNMM%%++-MM..446''f.E.E.GH	
	I {{>>)Z@@r   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpclassmethodr   r3    r   r   r   r   %   s$     ' -( (Ar   r   N)r7   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   r8   ReleaseTracksReleaseTrackBETAGADefaultUniverseOnlyCreateCommandr   r;   r   r   <module>rH      s    ' &  ' 7 ( 5 < # # D%%**D,=,=,@,@A%AT %A  B%Ar   