
                         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 update the specified enrollment.    )absolute_import)division)unicode_literals)enrollments)base)flags)labels_util)logz{description}a&           To update the enrollment `my-enrollment` with a new CEL expression `message.type == 'google.cloud.pubsub.topic.v1.messagePublished'`, run:

          $ {command} my-enrollment --location=us-central1 --cel-match="message.type == 'google.cloud.pubsub.topic.v1.messagePublished'"
        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)UpdatezUpdate an Eventarc enrollment.c                     t        j                  |       t        j                  |d       t        j                  |       t
        j                  j                  |       y )NF)required)r   AddUpdateEnrollmentResourceArgsAddCelMatchArgr	   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser)clsparsers     *lib/surface/eventarc/enrollments/update.pyArgszUpdate.Args,   s@    	))&1	%0$$V,OO'    c                 &   t        j                         }|j                  j                  j	                         }t        j                  dj                  |j                  |j                  |j                               |j                  |      }t        j                  j                  |      j                  |j!                         |j"                        }|j%                  |j'                  d      |j'                  d      |j(                        }|j+                  ||j-                  ||j.                  d|j                  j0                  j	                         |j3                               |      }|j4                  r|S |j7                  |d|      S )zRun the update command.z4Updating enrollment {} for project {} in location {}	cel_matchdestination_pipeline)r   destinationlabelsN)enrollment_refr   message_bus_refdestination_refr   Updating)r   EnrollmentClientV1CONCEPTS
enrollmentParser
   debugformatenrollmentsId
projectsIdlocationsIdGetr	   DiffFromUpdateArgsApplyLabelsValueClassr   BuildUpdateMaskIsSpecifiedneeds_updatePatchBuildEnrollmentr   r   	GetOrNoneasync_WaitFor)selfargsclientr    original_enrollmentlabels_update_resultupdate_mask	operations           r   Runz
Update.Run4   s^   ++-F]]--335NII>EE((%%&&	
 !**^4&++::4@FF!#6#=#= (("";/$$%;<#00 ) K )nn  MM>>DDF'113 	 	
 	
I {{>>)Z@@r   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpclassmethodr   rA    r   r   r   r   %   s$     ' -( (&Ar   r   N)rE   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rF   ReleaseTracksReleaseTrackBETAGADefaultUniverseOnlyUpdateCommandr   rI   r   r   <module>rV      s    2 &  ' 7 ( 5 < # # D%%**D,=,=,@,@A3AT 3A  B3Ar   