
    2                        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&                   G d dej(                                      Zy)z(Command to update the specified channel.    )absolute_import)division)unicode_literals)channels)base)flags)labels_util)logz{description}a           To update the channel `my-channel` in location `us-central1`, run:

          $ {command} my-channel --location=us-central1

        To configure the channel `my-channel` in location `us-central1` with a Cloud KMS CryptoKey, run:

          $ {command} my-channel --location=us-central1 --crypto-key=projects/PROJECT_ID/locations/KMS_LOCATION/keyRings/KEYRING/cryptoKeys/KEY

        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)UpdatezUpdate an Eventarc channel.c                     t        j                  |dd       t        j                  |d       t        j                  |       t
        j                  j                  |       y )NzChannel to update.T)required)
with_clear)r   AddChannelResourceArgAddCryptoKeyArgr	   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser)clsparsers     'lib/surface/eventarc/channels/update.pyArgszUpdate.Args3   sE    	(<tL	&T2$$V,OO'    c           
      r   t        j                         }|j                  j                  j	                         }|j                         j                         j                         }|j                         j                         }t        j                  dj                  |j                         ||             |j                  |      }t        j                  j                  |      j                  |j                         |j                         }|j#                  |j%                  d      |j&                  |j(                        }d}	|j%                  d      r|j*                  }	|j-                  ||j/                  |d|	|j1                               |      }
|j2                  r|
S |j5                  |
d|      S )zRun the update command.z1Updating channel {} for project {} in location {}
crypto_key)r   clear_crypto_keylabels NUpdating)r   ChannelClientV1CONCEPTSchannelParseParentNamer
   debugformatGetr	   DiffFromUpdateArgsApplyLabelsValueClsr   BuildUpdateMaskIsSpecifiedr   needs_updater   PatchBuildChannel	GetOrNoneasync_WaitFor)selfargsclientchannel_refproject_namelocation_nameoriginal_channellabels_update_resultupdate_maskcrypto_key_name	operations              r   Runz
Update.Run:   s   %%'F--''--/K%%'..0557L&&(--/MIIAHHL-9 : zz+.&++::4@FF!1!8!8 ((##L1..#00 ) K O%o0D0N0N0P	
 	I {{>>)Z==r   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpclassmethodr   rB    r   r   r   r   ,   s#     $ -( (#>r   r   N)rF   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rG   ReleaseTracksReleaseTrackGADefaultUniverseOnlyUpdateCommandr   rJ   r   r   <module>rV      s{    / &  ' 4 ( 5 < # 				" D%%(()/>T />  */>r   