
    E                         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
dZ ej                  ej                  j                         ej"                   G d dej$                                      Zy)z/Command to update the specified google channel.    )absolute_import)division)unicode_literals)google_channels)base)flags)labels_utilz{description}ag           To update the Google channel in location `us-central1`, run:

          $ {command} --location=us-central1

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

          $ {command} --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 Google channel.c                     t        j                  |dd       t        j                  |d       t        j                  |       y )Nz#The location of the Google Channel.T)required)
with_clear)r   AddLocationResourceArgAddCryptoKeyArgr	   AddUpdateLabelsFlags)clsparsers     .lib/surface/eventarc/google_channels/update.pyArgszUpdate.Args2   s7    	  5F	&T2$$V,    c           	      ^   t        j                         }|j                  j                  j	                         j                         }| d}|j                  |      }t        j                  j                  |      j                  |j                         |j                        }|j                  |j                  d      |j                  |j                         }d}|j                  d      r|j"                  }|j%                  ||j'                  |||j)                               |      }	|	S )zRun the update command.z/googleChannelConfig
crypto_key)r   clear_crypto_keylabels )r   )r   GoogleChannelConfigClientV1CONCEPTSlocationParseRelativeNameGetr	   DiffFromUpdateArgsApplyLabelsValueClassr   BuildUpdateMaskIsSpecifiedr   needs_updater   r   BuildGoogleChannelConfig	GetOrNone)
selfargsclientlocation_nameconfig_nameoriginal_google_channellabels_update_resultupdate_maskcrypto_key_nameresponses
             r   Runz
Update.Run9   s   88:FMM**002??AM"O#78K$jj5&++::4@FF!#:#A#A ((##L1..#00 ) K O%o}}'''113 	( 	

 	H Or   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpclassmethodr   r7    r   r   r   r   +   s#     + -- -r   r   N)r;   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   $googlecloudsdk.command_lib.util.argsr	   r<   ReleaseTracksReleaseTrackGADefaultUniverseOnlyUpdateCommandr   r?   r   r   <module>rJ      sx    6 &  ' ; ( 5 < 				" D%%(()*T *  **r   