o
    ×èFh  ã                   @   sF   d Z ddlZddlmZ ddlmZ ddlmZ G dd„ dejƒZdS )z8Create / interact with Google Cloud Storage connections.é    N)Ú_http)Ú__version__)Ú_helpersc                       sH   e Zd ZdZe ¡ ZdZd	‡ fdd„	Zej	Z
	 dZ	 ‡ fdd„Z‡  ZS )
Ú
Connectiona  A connection to Google Cloud Storage via the JSON REST API.

    Mutual TLS will be enabled if the "GOOGLE_API_USE_CLIENT_CERTIFICATE"
    environment variable is set to the exact string "true" (case-sensitive).

    Mutual TLS is not compatible with any API endpoint or universe domain
    override at this time. If such settings are enabled along with
    "GOOGLE_API_USE_CLIENT_CERTIFICATE", a ValueError will be raised.

    :type client: :class:`~google.cloud.storage.client.Client`
    :param client: The client that owns the current connection.

    :type client_info: :class:`~google.api_core.client_info.ClientInfo`
    :param client_info: (Optional) instance used to generate user agent.

    :type api_endpoint: str
    :param api_endpoint: (Optional) api endpoint to use.
    z#https://storage.mtls.googleapis.comNc                    s‚   t t| ƒ ||¡ |p| j| _| j| _|d u | _t| j	_
| j	jd u r&d| j	_dt› �}|| j	jvr?| j	 jd|› d�7  _d S d S )NÚ zgcloud-python/ú )Úsuperr   Ú__init__ÚDEFAULT_API_ENDPOINTÚAPI_BASE_URLÚDEFAULT_API_MTLS_ENDPOINTÚAPI_BASE_MTLS_URLÚALLOW_AUTO_SWITCH_TO_MTLS_URLr   Ú_client_infoÚclient_library_versionÚ
user_agent)ÚselfÚclientÚclient_infoÚapi_endpointÚagent_version©Ú	__class__© úS/var/www/html/loop/nvenv/lib/python3.10/site-packages/google/cloud/storage/_http.pyr	   .   s   

ÿzConnection.__init__z*{api_base_url}/storage/{api_version}{path}c                    sv   |  dd ¡}t ¡ |d< tjtt| ƒjg|¢R i |¤Ž}|r8z
|jdi |¤Ž}W n	 t	y1   Y nw |r8||ƒ}|ƒ S )NÚretryÚextra_api_infor   )
Úpopr   Ú_get_invocation_idÚ	functoolsÚpartialr   r   Úapi_requestÚ"get_retry_policy_if_conditions_metÚAttributeError)r   ÚargsÚkwargsr   Úcallr   r   r   r!   B   s    ÿzConnection.api_request)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú_get_default_storage_base_urlr
   r   r	   Ú_API_VERSIONÚAPI_VERSIONÚAPI_URL_TEMPLATEr!   Ú__classcell__r   r   r   r   r      s    r   )	r*   r   Úgoogle.cloudr   Úgoogle.cloud.storager   r   ÚJSONConnectionr   r   r   r   r   Ú<module>   s   