
    .
0h                     h    d Z ddl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j	                  Z
dS )	z8Create / interact with Google Cloud Storage connections.    N)_http)__version__)_helpers)create_trace_spanc                   f     e Zd ZdZ ej                    ZdZd fd	Zej	        Z
	 dZ	  fdZ x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                 X   t          t          |                               ||           |p| j        | _        | j        | _        |d u | _        t          | j	        _
        | j	        j        d| j	        _        dt           }|| j	        j        vr| j	        xj        d| dz  c_        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        U/var/www/html/nourish/venv/lib/python3.11/site-packages/google/cloud/storage/_http.pyr   zConnection.__init__/   s    j$((===(ED,E!%!?-9T-A*3>0 '/+-D(666 1 <<<((,@,@,@,@@(((( =<    z*{api_base_url}/storage/{api_version}{path}c                    |                     dd           }t          j                    }||d<   d|i}t          j        t          t          |           j        g|R i |}t          d|| j	        ||          5  |r,	  |j
        di |}n# t          $ r Y nw xY w|r ||          } |            cd d d            S # 1 swxY w Y   d S )Nretryextra_api_infozgccl-invocation-idzStorage.Connection.api_request)name
attributesr   api_requestr    )popr   _get_invocation_id	functoolspartialr   r   r#   r   _client"get_retry_policy_if_conditions_metAttributeError)r   argskwargsr   invocation_idspan_attributescallr   s          r   r#   zConnection.api_requestC   s[   

7D)) 355#0  -
  z4!8!8!DVtVVVvVV1&<
 
 
 	 	  'DEDNNvNNEE%   D ' 5;;D466	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   :B?>BB?
BB?BB??CC)NN)__name__
__module____qualname____doc__r   _get_default_storage_base_urlr   r   r   _API_VERSIONAPI_VERSIONAPI_URL_TEMPLATEr#   __classcell__)r   s   @r   r   r      s         & B8ACC EA A A A A A 'KFC:        r   r   )r4   r'   google.cloudr   google.cloud.storager   r   +google.cloud.storage._opentelemetry_tracingr   JSONConnectionr   r$   r   r   <module>r>      s    ? >           , , , , , , ) ) ) ) ) ) I I I I I IB B B B B% B B B B Br   