
    E                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 dd	lmZ e
j                   G d
 de
j                               Zy)z*Implementation of update command for HMAC.    )absolute_import)division)unicode_literalsN)api_factory)	cloud_api)base)storage_urlc                   0    e Zd ZdZdddZed        Zd Zy)Updatez,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                     | j                  dd       | j                  ddt        j                  d             | j                  d      }|j                  d	d
d       |j                  dd
d       y )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ArgszUpdate.Args5   s    
*MN
__ 3 4  5 55t5DKC  E E  G    c                 d   t        j                  t        j                  j                        }|j
                  }|j                  }|j                  rt        j                  j                  }n&|j                  rt        j                  j                  }|j                  ||      }|j                  S )N)r   get_apir	   ProviderPrefixGCSr   etagactivater   HmacKeyStateACTIVE
deactivateINACTIVEpatch_hmac_keymetadata)selfargsapir   r!   stateresponses          r   Runz
Update.RunH   s    


k88<<
=CI99D}}$$++e	$$--e!!)T59Hr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r.    r   r   r   r      s1    4
	
-( G G$	r   r   )r2   
__future__r   r   r   r   googlecloudsdk.api_lib.storager   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager	   UniverseCompatibleCommandr   r5   r   r   <module>r<      sG    1 &  '  6 4 ( : 3T\\ 3 3r   