Ë
    V¼Sf'&  ã                   ó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	)
zµConfigure 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        ú\C:\Users\user\Documents\project_loop\venv\Lib\site-packages\google/cloud/storage/hmac_key.pyÚ__init__zHMACKeyMetadata.__init__9   sE   € ØˆŒØˆÔàÐ Ø+4ˆD×Ñ˜ZÑ(àÐ!Ø,6ˆD×Ñ˜[Ñ)à)ˆÕó    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   € Ü�D—L‘LÓ!¤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 )z•ETag 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 )z�ID 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 )z­Service 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 )zÂGet / 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à—,‘,ˆØˆ?Ø—l‘l×*Ñ*ˆGà˜G˜9 J¨t¯~©~Ð.>Ð?Ð?r   c                 ó   — | j                   S )z—Project 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à× Ñ Ð,Ø+/×+<Ñ+<�	˜-Ñ(à�L‰L×&Ñ&Ø—	‘	Ø&ØØð	 'ô ð øô ò 	Ùð	ú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Ñ'8ˆI�mÑ$àŸ<™<×5Ñ5Ø�I‰IØ"ØØð	 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Ñ'8ˆI�mÑ$à˜DŸJ™JÐ'ˆØŸ<™<×5Ñ5Ø�I‰IØØ"ØØð 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Ñ'8ˆI�mÑ$à�‰×%Ñ%Ø�I‰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	      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   