
    E                         S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SS	KJr  \
R                   " S
 S\
R                  5      5       rg)z*Implementation of update command for HMAC.    )absolute_import)division)unicode_literalsN)api_factory)	cloud_api)base)storage_urlc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Update   z,Change the status of a service account HMAC.a[  
       *{command}* sets the state of the specified key. Valid state arguments
       are ``ACTIVE'' and ``INACTIVE''. To set a key to state ``DELETED'', use
       *{parent_command} delete* on an ``INACTIVE'' key. If an etag is set in
       the command, it will only succeed if the provided etag matches the etag
       of the stored key.
      a	  
       To activate an HMAC key:

         $ {command} GOOG56JBMFZX6PMPTQ62VD2 --activate

       To set the state of an HMAC key to ``INACTIVE'' provided its etag is
       ``M42da='':

         $ {command} GOOG56JBMFZX6PMPTQ62VD2 --deactivate --etag=M42da=
      )DESCRIPTIONEXAMPLESc                     U R                  SSS9  U R                  SS[        R                  " S5      S9  U R                  SS9nUR                  S	S
SS9  UR                  SS
SS9  g )N	access_idz!Access ID for HMAC key to update.)helpz-ez--etagz            If provided, the update will only be performed if the specified etag
            matches the etag of the stored key.T)requiredz
--activate
store_truez2Sets the state of the specified key to ``ACTIVE''.)actionr   z--deactivatez4Sets the state of the specified key to ``INACTIVE''.)add_argumenttextwrapdedentadd_mutually_exclusive_group)parserstate_groups     "lib/surface/storage/hmac/update.pyArgsUpdate.Args5   s    
*MN
__ 3 4  5 55t5DKC  E E  G    c                 x   [         R                  " [        R                  R                  5      nUR
                  nUR                  nUR                  (       a  [        R                  R                  nO+UR                  (       a  [        R                  R                  nUR                  X4W5      nUR                  $ )N)r   get_apir	   ProviderPrefixGCSr   etagactivater   HmacKeyStateACTIVE
deactivateINACTIVEpatch_hmac_keymetadata)selfargsapir   r#   stateresponses          r   Run
Update.RunH   s~    


k88<<
=CI99D}}$$++e	$$--e!!)59Hr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r0   __static_attributes__r2   r   r   r   r      s1    4
	
-( G G$	r   r   )r7   
__future__r   r   r   r   googlecloudsdk.api_lib.storager   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager	   UniverseCompatibleCommandr   r2   r   r   <module>rA      sG    1 &  '  6 4 ( : 3T\\ 3 3r   