o
    ˷e                     @   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                       sB   e Zd ZdZdZdZd fdd	ZdZ	 dZ	  fd	d
Z	  Z
S )
Connectiona  A connection to Google Cloud Storage via the JSON REST API. Mutual TLS feature will be
    enabled if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "true".

    :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.googleapis.comz#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__ Q/var/www/ideatree/venv/lib/python3.10/site-packages/google/cloud/storage/_http.pyr	   )   s   

zConnection.__init__v1z*{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"   =   s    zConnection.api_request)NN)__name__
__module____qualname____doc__r
   r   r	   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   