
    %                     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 message bus.    )absolute_import)division)unicode_literals)message_buses)base)flags)labels_util)logz{description}a           To update the message bus `my-message-bus` in location `us-central1`, run:

          $ {command} my-message-bus --location=us-central1

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

          $ {command} my-message-bus --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 message bus.c                     t        j                  |dd       t        j                  |d       t        j                  |d       t	        j
                  |       t        j                  j                  |       y )NzMessage bus to update.T)requiredz&The logging config of the message bus.)
with_clear)	r   AddMessageBusResourceArgAddLoggingConfigArgAddCryptoKeyArgr	   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser)clsparsers     ,lib/surface/eventarc/message_buses/update.pyArgszUpdate.Args1   s[    	""(4 
f&NO	&T2$$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/                  ||j0                  |j2                  |j5                               |      }|j6                  r|S |j9                  |d|      S )zRun the update command.z5Updating message bus {} for project {} in location {}logging_config
crypto_key)r   r   clear_crypto_keylabels)message_bus_refr   crypto_key_namer!   Updating)r   MessageBusClientV1CONCEPTSmessage_busParser
   debugformatmessageBusesId
projectsIdlocationsIdGetr	   DiffFromUpdateArgsApplyLabelsValueClassr!   BuildUpdateMaskIsSpecifiedr    needs_updatePatchBuildMessageBusr   r   	GetOrNoneasync_WaitFor)selfargsclientr"   original_message_buslabels_update_resultupdate_mask	operations           r   Runz
Update.Run;   sW   --/Fmm//557OII?FF**&&''	
 "::o6&++::4@FF!#7#>#> ((''(89##L1..#00	 ) K +.. OO'113	 	 	
 		I {{>>)ZAAr   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpclassmethodr   rB    r   r   r   r   *   s$     ( -( (&B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BETAGADefaultUniverseOnlyUpdateCommandr   rJ   r   r   <module>rW      s    3 &  ' 9 ( 5 < # #	 D%%**D,=,=,@,@A5BT 5B  B5Br   