
    7!                     $   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	K
Jr  SS
KJr  SSKJr  SSS.r\R$                  " \R&                  R(                  5      \R*                   " S S\R,                  5      5       5       rg)zCommand to update a trigger.    )absolute_import)division)unicode_literals)triggers)base)
exceptions)flags)types)labels_util)logz{description}z         To update the trigger ``my-trigger'' by setting its destination Cloud Run service to ``my-service'', run:

          $ {command} my-trigger --destination-run-service=my-service
        )DESCRIPTIONEXAMPLESc                   P    \ rS rSrSr\r\S 5       rS r	S r
S rS rS rS	 rS
rg)Update)   zUpdate an Eventarc trigger.c                 2   [         R                  " USSS9  [         R                  " XR                  5       5        [         R                  " XR                  5       5        [         R
                  " XR                  5       5        [         R                  " XR                  5       5        [        R                  R                  U5        UR                  5       n[         R                  " U5        [         R                  " U5        [        R                  " U5        g )NzThe trigger to update.T)required)r	   AddTriggerResourceArgAddEventFiltersArgReleaseTrackAddEventFiltersPathPatternArgAddEventDataContentTypeArgAddUpdateDestinationArgsr   
ASYNC_FLAGAddToParseradd_mutually_exclusive_groupAddServiceAccountArgAddClearServiceAccountArgr   AddUpdateLabelsFlags)clsparserservice_account_groups      'lib/surface/eventarc/triggers/update.pyArgsUpdate.Args0   s    	(@4P	V%5%5%78	''0@0@0BC	$$V-=-=-?@	""6+;+;+=>OO'"??A	45	##$9:$$V,    c                 	   [         R                  " 5       nUR                  R                  R	                  5       n[
        R                  " XR                  5       5      n[
        R                  " XR                  5       5      n[
        R                  " XR                  5       5      nUR                  U5      n[        R                  R                  U5      R                  UR                  5       UR                   5      nUR#                  USLUSLUSLUR%                  S5      =(       d    UR&                  UR%                  S5      UR%                  S5      UR%                  S5      =(       d    UR(                  UR%                  S5      UR%                  S5      UR%                  S5      UR%                  S	5      =(       d    UR*                  UR%                  S
5      UR%                  S5      UR%                  S5      UR%                  S5      UR,                  S9n	UR/                  U5      U l        Sn
UR%                  S5      (       dS  UR%                  S5      (       d=  UR%                  S5      (       d'  UR%                  S5      (       d  UR(                  (       a>  UR3                  UR4                  UR6                  UR8                  UR:                  5      n
GOUR%                  S5      (       d=  UR%                  S5      (       d'  UR%                  S	5      (       d  UR*                  (       a5  UR=                  SSUR>                  UR@                  URB                  5      n
GOUR%                  S
5      (       d  UR%                  S5      (       a_  U RE                  X5      nU RG                  X5      nURI                  URK                  5       RK                  5       RM                  5       X5      n
OUR%                  S5      (       d  UR%                  S5      (       a^  U RO                  X5      nU RQ                  X5      nURS                  URK                  5       RK                  5       RM                  5       X5      n
URU                  UUUUURV                  U
SSURY                  5       5	      nUR[                  X>U	5      nUR\                  (       a  U$ UR_                  USU5      $ )zRun the update command.Nservice_accountdestination_run_servicedestination_run_jobdestination_run_pathdestination_run_regiondestination_gke_namespacedestination_gke_servicedestination_gke_pathdestination_workflowdestination_workflow_locationdestination_functiondestination_function_location)event_filtersevent_filters_path_patternevent_data_content_typer(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   labelsUpdating)0r   TriggersClientV1CONCEPTStriggerParser	   GetEventFiltersArgr   GetEventFiltersPathPatternArgGetEventDataContentTypeArgGetr   DiffFromUpdateArgsApplyLabelsValueClassr7   BuildUpdateMaskIsSpecifiedclear_service_accountclear_destination_run_pathclear_destination_gke_pathneeds_updateGetEventType_event_typeBuildCloudRunDestinationMessager)   r*   r+   r,   BuildGKEDestinationMessager-   r.   r/   GetWorkflowDestinationLocationGetWorkflowDestinationBuildWorkflowDestinationMessageParentNameGetFunctionDestinationLocationGetFunctionDestinationBuildFunctionDestinationMessageBuildTriggerMessager(   	GetOrNonePatchasync_WaitFor)selfargsclienttrigger_refr4   r5   r6   original_triggerlabels_update_resultupdate_maskdestination_messagelocationworkflowfunctiontrigger_message	operations                   r#   Run
Update.Run>   sM   &&(F--''--/K,,T3D3D3FGM!&!D!D!"##>>! zz+.&++::4@FF!#3#:#: ((#4/#=T#I 7t C(():; &%% $ 0 01J K ,,-BC!--.DE +**#//0HI"&"2"23N"O $ 0 01J K!--.DE +**!--.DE&*&6&6+'
 "--.DE&*&6&6+'
 $00/ ) K8 **+;<D233.//122/00''"BB

&
&(@(@

#
#T%@%@B 

6
7
7


4
5
5


1
2
2

)
)"==
d44

&
&(A(AC 

1
2
2


:
;
;44TLh,,TDh"BB




%
%
'
,
,
.D


1
2
2


:
;
;44TLh,,TDh"BB




%
%
'
,
,
.D00"&&(
O [;GI{{>>)Z==r&   c                     U(       aZ  [         R                  " U R                  5      (       a4  [        R                  " SR                  [        R                  5      5        g g g )Nz@It may take up to {} minutes for the update to take full effect.)r
   IsAuditLogTyperL   r   warningformatr   MAX_ACTIVE_DELAY_MINUTES)r\   resources_were_displayeds     r#   EpilogUpdate.Epilog   sC    E$8$89I9I$J$J	kk
L6(3346 %Kr&   c                     UR                  S5      (       a  UR                  $ UR                  R                  (       a(  UR                  R                  R	                  S5      S   $ [
        R                  " SS5      e)Nr1   /   z--destination-workflow8The specified trigger is not for a workflow destination.)rF   r1   destinationre   splitr   InvalidArgumentExceptionr\   r]   old_triggers      r#   rO   %Update.GetWorkflowDestinationLocation   sl    788///''$$--33C8;;

-
- BD Dr&   c                     UR                  S5      (       a  UR                  $ UR                  R                  (       a(  UR                  R                  R	                  S5      S   $ [
        R                  " SS5      e)Nr0   rt      z--destination-workflow-locationrv   )rF   r0   rw   re   rx   r   ry   rz   s      r#   rP   Update.GetWorkflowDestination   sl    .//&&&''$$--33C8;;

-
-)BD Dr&   c                     UR                  S5      (       a  UR                  $ UR                  R                  (       a(  UR                  R                  R	                  S5      S   $ [
        R                  " SS5      e)Nr3   rt   ru   z--destination-function8The specified trigger is not for a function destination.)rF   r3   rw   cloudFunctionrx   r   ry   rz   s      r#   rT   %Update.GetFunctionDestinationLocation   sl    788///,,$$2288=a@@

-
- BD Dr&   c                     UR                  S5      (       a  UR                  $ UR                  R                  (       a(  UR                  R                  R	                  S5      S   $ [
        R                  " SS5      e)Nr2   rt   r~   z--destination-function-locationr   )rF   r2   rw   r   rx   r   ry   rz   s      r#   rU   Update.GetFunctionDestination   sl    .//&&&,,$$2288=a@@

-
-)BD Dr&   )rL   N)__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpclassmethodr$   ri   rq   rO   rP   rT   rU   __static_attributes__ r&   r#   r   r   )   sB     $ -- -W>r6DDDDr&   r   N)r   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   r   #googlecloudsdk.command_lib.eventarcr	   r
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   ReleaseTracksr   GADefaultUniverseOnlyUpdateCommandr   r   r&   r#   <module>r      s    # &  ' 4 ( . 5 5 < # 				 D%%(()TDT TD  *TDr&   