
                             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\R                  5      rS rS r " S S\5      rg)z$Utilities for Eventarc Channels API.    )absolute_import)division)unicode_literals)common)EventarcClientBase)apis)
exceptions)
propertiesc                       \ rS rSrSrSrg)NoFieldsSpecifiedError   z:Error when no fields were specified for a Patch operation. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       6lib/googlecloudsdk/api_lib/eventarc/google_channels.pyr   r      s    Br   r   c                     U R                   =(       d2    [        R                  R                  R                   R	                  5       $ )z=Gets project resource from either argument flag or attribute.)projectr
   VALUEScore	GetOrFailargss    r   
GetProjectr       s,    		C**//77AACCr   c                     U R                   =(       d2    [        R                  R                  R                   R	                  5       $ )z>Gets location resource from either argument flag or attribute.)locationr
   r   eventarcr   r   s    r   GetLocationr"   %   s,    		I*++44==GGIIr   c                   J   ^  \ rS rSrSrU 4S jrS rS rS rS r	S r
S	rU =r$ )
GoogleChannelConfigClientV1*   zGGoogle Channel Client for interaction with v1 of Eventarc Channels API.c                   > [         [        U ]  [        R                  [        R
                  S5        [        R                  " [        R                  [        R
                  5      nUR                  U l	        UR                  U l        g )NGoogleChannelConfig)superr$   __init__r   API_NAMEAPI_VERSION_1r   GetClientInstanceMESSAGES_MODULE	_messagesprojects_locations_service)selfclient	__class__s     r   r)   $GoogleChannelConfigClientV1.__init__-   s`    	
%
&*>*>.0 ##FOOV5I5IJF++DN--DMr   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zGets the requested GoogleChannelConfig.

Args:
  google_channel_config_name: str, the name of GoogleChannelConfig to get.

Returns:
  The GoogleChannelConfig message.
)name)r.   6EventarcProjectsLocationsGetGoogleChannelConfigRequestr0   GetGoogleChannelConfig)r1   google_channel_config_nameget_reqs      r   GetGoogleChannelConfigClientV1.Get8   s6     nnSS' T )G==//88r   c                 n    U R                   R                  UUUS9nU R                  R                  U5      $ )a^  Updates the specified Channel.

Args:
  google_channel_config_name: str, the name of GoogleChannelConfig to
    update.
  google_channel_config_message: GoogleChannelConfig, the config message
    that holds KMS encryption info.
  update_mask: str, a comma-separated list of GoogleChannelConfig fields to
    update.

Returns:
  Response for update.
)r6   googleChannelConfig
updateMask)r.   9EventarcProjectsLocationsUpdateGoogleChannelConfigRequestr0   UpdateGoogleChannelConfig)r1   r9   google_channel_config_messageupdate_mask
update_reqs        r   Update"GoogleChannelConfigClientV1.UpdateE   s>     YY'9 Z  J ==22:>>r   c                 8    U R                   R                  UUUS9$ )N)r6   cryptoKeyNamelabels)r.   r'   )r1   r9   crypto_key_namerI   s       r   BuildGoogleChannelConfig4GoogleChannelConfigClientV1.BuildGoogleChannelConfigZ   s)     >>--'% .  r   c                     / nU(       a  UR                  S5        U(       a  UR                  S5        U(       a  UR                  S5        U(       d  [        S5      eSR                  U5      $ )a=  Builds an update mask for updating a channel.

Args:
  crypto_key: bool, whether to update the crypto key.
  clear_crypto_key: bool, whether to clear the crypto key.
  labels: bool, whether to update the labels.

Returns:
  The update mask as a string.

Raises:
  NoFieldsSpecifiedError: No fields are being updated.
rH   rI   z*Must specify at least one field to update.,)appendr   join)r1   
crypto_keyclear_crypto_keyrI   rC   s        r   BuildUpdateMask+GoogleChannelConfigClientV1.BuildUpdateMaskc   sZ     K))""#OPP88K  r   c                 B    U R                   R                  R                  $ )zReturns the labels value class.)r.   r'   LabelsValue)r1   s    r   LabelsValueClass,GoogleChannelConfigClientV1.LabelsValueClass}   s    >>--999r   )r.   r0   )r   r   r   r   r   r)   r;   rE   rK   rS   rW   r   __classcell__)r3   s   @r   r$   r$   *   s)    O	.9?*!4: :r   r$   N)r   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   $googlecloudsdk.api_lib.eventarc.baser   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer	   r
   Errorr   r   r"   r$   r   r   r   <module>r`      sQ    + &  ' 2 C , * *CZ-- CD
J
U:"4 U:r   