
    'wf'&                     Z    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y	)
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                   2   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y)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                 r    || _         i | _        ||| j                  d<   ||| j                  d<   || _        y )NaccessId	projectId)_client_properties_user_project)selfclient	access_id
project_iduser_projects        q/home/panchajanya/Development/work/volatility3/venv/lib/python3.12/site-packages/google/cloud/storage/hmac_key.py__init__zHMACKeyMetadata.__init__9   sE     +4DZ(!,6D[))    c                     t        || j                        st        S | j                  |j                  k(  xr | j                  |j                  k(  S N)
isinstance	__class__NotImplementedr   r   )r   others     r   __eq__zHMACKeyMetadata.__eq__E   s;    %0!!||u}},R5??1RRr   c                 X    t        | j                        t        | j                        z   S r   )hashr   r   r   s    r   __hash__zHMACKeyMetadata.__hash__K   s    DLL!D$888r   c                 8    | j                   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                 8    | j                   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                 8    | j                   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                 8    | j                   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0r   c                 8    | j                   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                 8    | j                   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<   y )Nr3   )r   r   values     r   r3   zHMACKeyMetadata.state   s    $)!r   c                 T    | j                   j                  d      }|t        |      S y)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   s0       $$]3-e44 r   c                 T    | j                   j                  d      }|t        |      S y)r8   updatedNr:   r5   s     r   r=   zHMACKeyMetadata.updated   s0       $$Y/-e44 r   c                     | j                   t        d      | j                  }|| j                  j                  }d| d| j                    S )z%Resource path for the metadata's key.zNo 'access_id' set.z
/projects/z
/hmacKeys/)r   
ValueErrorr.   r   )r   r.   s     r   pathzHMACKeyMetadata.path   sO     >>!233,,?ll**GG9Jt~~.>??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                  | j                  |||       y# t        $ r Y y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.
        userProjectquery_paramstimeoutretryTF)r   r   _get_resourcer@   r   r   rF   rG   	qs_paramss       r   existszHMACKeyMetadata.exists   sh    	I  ,+/+<+<	-(LL&&		&	 '    		s   AA	 		AAc                     i }| j                   | j                   |d<   | j                  j                  | j                  |||      | _        y)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   sQ     	('+'8'8Im$<<55II"	 6 
r   c                     i }| j                   | j                   |d<   d| j                  i}| j                  j                  | j                  ||||      | _        y)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   sb     	('+'8'8Im$DJJ'<<55II" 6 
r   c                     i }| j                   | j                   |d<   | j                  j                  | j                  |||       y)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  sL     	('+'8'8Im$%%II"	 	& 	
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	      sT     L:N M5$n5
*S9 0 0 , , * * 1 1 ; ; - - \\* * 
5 
5 
5 
5 
@ 
@ " " .] @ .] 
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 DQ
f Q
r   