
    Bf'&                     b    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	  G d de
          Zd	S )
zConfigure HMAC keys that can be used to authenticate requests to Google Cloud Storage.

See [HMAC keys documentation](https://cloud.google.com/storage/docs/authentication/hmackeys)
    )NotFound)_rfc3339_nanos_to_datetime)_DEFAULT_TIMEOUT)DEFAULT_RETRY)DEFAULT_RETRY_IF_ETAG_IN_JSONc                   l   e Zd ZdZdZ	 dZ	 dZ	 eefZddZd Z	d Z
ed	             Zed
             Zed             Zed             Zed             Zed             Zej        d             Zed             Zed             Zed             Zed             ZeefdZeefdZeefdZeefdZdS )HMACKeyMetadataa   Metadata about an HMAC service account key withn Cloud Storage.

    :type client: :class:`~google.cloud.stoage.client.Client`
    :param client: client associated with the key metadata.

    :type access_id: str
    :param access_id: (Optional) Unique ID of an existing key.

    :type project_id: str
    :param project_id: (Optional) Project ID of an existing key.
        Defaults to client's project.

    :type user_project: str
    :param user_project: (Optional) This parameter is currently ignored.
    ACTIVEINACTIVEDELETEDNc                 `    || _         i | _        |
|| j        d<   |
|| j        d<   || _        d S )NaccessId	projectId)_client_properties_user_project)selfclient	access_id
project_iduser_projects        l/home/panchajanya/Development/work/volatility3/lib/python3.11/site-packages/google/cloud/storage/hmac_key.py__init__zHMACKeyMetadata.__init__9   sE     +4DZ(!,6D[))    c                 z    t          || j                  st          S | j        |j        k    o| j        |j        k    S N)
isinstance	__class__NotImplementedr   r   )r   others     r   __eq__zHMACKeyMetadata.__eq__E   s9    %00 	"!!|u},R5?1RRr   c                 T    t          | j                  t          | j                  z   S r   )hashr   r   r   s    r   __hash__zHMACKeyMetadata.__hash__K   s!    DL!!D$8$888r   c                 6    | j                             d          S )z|Access ID of the key.

        :rtype: str or None
        :returns: unique identifier of the key within a project.
        r   r   getr$   s    r   r   zHMACKeyMetadata.access_idN   s     ##J///r   c                 6    | j                             d          S )zETag identifying the version of the key metadata.

        :rtype: str or None
        :returns: ETag for the version of the key's metadata.
        etagr'   r$   s    r   r*   zHMACKeyMetadata.etagW   s     ##F+++r   c                 6    | j                             d          S )zID of the key, including the Project ID and the Access ID.

        :rtype: str or None
        :returns: ID of the key.
        idr'   r$   s    r   r,   zHMACKeyMetadata.id`   s     ##D)))r   c                 6    | j                             d          S )zzProject ID associated with the key.

        :rtype: str or None
        :returns: project identfier for the key.
        r   r'   r$   s    r   projectzHMACKeyMetadata.projecti   s     ##K000r   c                 6    | j                             d          S )zService account e-mail address associated with the key.

        :rtype: str or None
        :returns: e-mail address for the service account which created the key.
        serviceAccountEmailr'   r$   s    r   service_account_emailz%HMACKeyMetadata.service_account_emailr   s     ##$9:::r   c                 6    | j                             d          S )zGet / set key's state.

        One of:
            - ``ACTIVE``
            - ``INACTIVE``
            - ``DELETED``

        :rtype: str or None
        :returns: key's current state.
        stater'   r$   s    r   r3   zHMACKeyMetadata.state{   s     ##G,,,r   c                     || j         d<   d S )Nr3   )r   r   values     r   r3   zHMACKeyMetadata.state   s    $)!!!r   c                 \    | j                             d          }|t          |          S dS )3  Retrieve the timestamp at which the HMAC key was created.

        :rtype: :class:`datetime.datetime` or ``NoneType``
        :returns: Datetime object parsed from RFC3339 valid timestamp, or
                  ``None`` if the bucket's resource has not been loaded
                  from the server.
        timeCreatedNr   r(   r   r5   s     r   time_createdzHMACKeyMetadata.time_created   s6      $$]33-e444 r   c                 \    | j                             d          }|t          |          S dS )r8   updatedNr:   r5   s     r   r=   zHMACKeyMetadata.updated   s6      $$Y//-e444 r   c                 r    | j         t          d          | j        }|| j        j        }d| d| j          S )z%Resource path for the metadata's key.NzNo 'access_id' set.z
/projects/z
/hmacKeys/)r   
ValueErrorr.   r   )r   r.   s     r   pathzHMACKeyMetadata.path   sI     >!2333,?l*G?G??t~???r   c                     | j         S )zProject ID to be billed for API requests made via this bucket.

        This property is currently ignored by the server.

        :rtype: str
        )r   r$   s    r   r   zHMACKeyMetadata.user_project   s     !!r   c                     	 i }| j         
| j         |d<   | j                            | j        |||           dS # t          $ r Y dS w xY w)a#  Determine whether or not the key for this metadata exists.

        :type timeout: float or tuple
        :param timeout:
            (Optional) The amount of time, in seconds, to wait
            for the server response.  See: :ref:`configuring_timeouts`

        :type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
        :param retry:
            (Optional) How to retry the RPC. See: :ref:`configuring_retries`

        :rtype: bool
        :returns: True if the key exists in Cloud Storage.
        NuserProjectquery_paramstimeoutretryTF)r   r   _get_resourcer@   r   r   rF   rG   	qs_paramss       r   existszHMACKeyMetadata.exists   sz    	I ,+/+<	-(L&&	&	 '    4  	 	 	55	s   6: 
AAc                 |    i }| j         
| j         |d<   | j                            | j        |||          | _        dS )a4  Reload properties from Cloud Storage.

        :type timeout: float or tuple
        :param timeout:
            (Optional) The amount of time, in seconds, to wait
            for the server response.  See: :ref:`configuring_timeouts`

        :type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
        :param retry:
            (Optional) How to retry the RPC. See: :ref:`configuring_retries`

        :raises :class:`~google.api_core.exceptions.NotFound`:
            if the key does not exist on the back-end.
        NrC   rD   )r   r   rH   r@   r   rI   s       r   reloadzHMACKeyMetadata.reload   sR     	('+'8Im$<55I"	 6 
 
r   c                     i }| j         
| j         |d<   d| j        i}| j                            | j        ||||          | _        dS )a9  Save writable properties to Cloud Storage.

        :type timeout: float or tuple
        :param timeout:
            (Optional) The amount of time, in seconds, to wait
            for the server response.  See: :ref:`configuring_timeouts`

        :type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
        :param retry:
            (Optional) How to retry the RPC. See: :ref:`configuring_retries`

        :raises :class:`~google.api_core.exceptions.NotFound`:
            if the key does not exist on the back-end.
        NrC   r3   rD   )r   r3   r   _put_resourcer@   r   )r   rF   rG   rJ   payloads        r   updatezHMACKeyMetadata.update   sa     	('+'8Im$DJ'<55I" 6 
 
r   c                 r    i }| j         
| j         |d<   | j                            | j        |||           dS )a1  Delete the key from Cloud Storage.

        :type timeout: float or tuple
        :param timeout:
            (Optional) The amount of time, in seconds, to wait
            for the server response.  See: :ref:`configuring_timeouts`

        :type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
        :param retry:
            (Optional) How to retry the RPC. See: :ref:`configuring_retries`

        :raises :class:`~google.api_core.exceptions.NotFound`:
            if the key does not exist on the back-end.
        NrC   rD   )r   r   _delete_resourcer@   rI   s       r   deletezHMACKeyMetadata.delete  sV     	('+'8Im$%%I"	 	& 	
 	
 	
 	
 	
r   )NNN)__name__
__module____qualname____doc__ACTIVE_STATEINACTIVE_STATEDELETED_STATE_SETTABLE_STATESr   r!   r%   propertyr   r*   r,   r.   r1   r3   setterr;   r=   r@   r   r   r   rK   rM   r   rQ   rT    r   r   r	   r	      s          L:N M5$n5
* 
* 
* 
*S S S9 9 9 0 0 X0 , , X, * * X* 1 1 X1 ; ; X; - - X- \* * \* 
5 
5 X
5 
5 
5 X
5 
@ 
@ X
@ " " X" .]    @ .] 
 
 
 
6 .5R 
 
 
 
8 .] 
 
 
 
 
 
r   r	   N)rX   google.cloud.exceptionsr   google.cloud._helpersr   google.cloud.storage.constantsr   google.cloud.storage.retryr   r   objectr	   r_   r   r   <module>re      s    
 - , , , , , < < < < < < ; ; ; ; ; ; 4 4 4 4 4 4 D D D D D DQ
 Q
 Q
 Q
 Q
f Q
 Q
 Q
 Q
 Q
r   