o
    Ni                     @   s6   d Z ddlmZ ddlmZ e ZG dd deZdS )zFA client for interacting with Google Cloud Storage using the gRPC API.    )ClientWithProject)_storage_v2c                       sP   e Zd ZdZedddfddd fddZ				dddZed	d
 Z  Z	S )
GrpcClienta  A client for interacting with Google Cloud Storage using the gRPC API.

    :type project: str or None
    :param project: The project which the client acts on behalf of. If not
                    passed, falls back to the default inferred from the
                    environment.

    :type credentials: :class:`~google.auth.credentials.Credentials`
    :param credentials: (Optional) The OAuth2 Credentials to use for this
                        client. If not passed, falls back to the default
                        inferred from the environment.

    :type client_info: :class:`~google.api_core.client_info.ClientInfo`
    :param client_info:
        The client info used to send a user-agent string along with API
        requests. If ``None``, then default info will be used. Generally,
        you only need to set this if you're developing your own library
        or partner tool.

    :type client_options: :class:`~google.api_core.client_options.ClientOptions` or :class:`dict`
    :param client_options: (Optional) Client options used to set user options
        on the client. A non-default universe domain or API endpoint should be
        set through client_options.

    :type api_key: string
    :param api_key:
        (Optional) An API key. Mutually exclusive with any other credentials.
        This parameter is an alias for setting `client_options.api_key` and
        will supersede any API key set in the `client_options` parameter.

    :type attempt_direct_path: bool
    :param attempt_direct_path:
        (Optional) Whether to attempt to use DirectPath for gRPC connections.
        This provides a direct, unproxied connection to GCS for lower latency
        and higher throughput, and is highly recommended when running on Google
        Cloud infrastructure. Defaults to ``True``.
    NT)api_keyattempt_direct_pathc                   sh   t t| j||d t|tr|r||d< n|d u r#|si nd|i}n|r(||_| j||||d| _d S )N)projectcredentialsr   )r   client_infoclient_optionsr   )superr   __init__
isinstancedictr   _create_gapic_client_grpc_client)selfr   r   r	   r
   r   r   	__class__ T/home/ubuntu/.local/lib/python3.10/site-packages/google/cloud/storage/grpc_client.pyr   >   s   

zGrpcClient.__init__c                 C   s6   t jd}|j|d}|||d}t j||||dS )z?Creates and configures the low-level GAPIC `storage_v2` client.grpc)r   )r   channel)r   	transportr	   r
   )
storage_v2StorageClientget_transport_classcreate_channel)r   r   r	   r
   r   transport_clsr   r   r   r   r   r   Y   s   zGrpcClient._create_gapic_clientc                 C   s   | j S )az  The underlying gRPC client.

        This property gives users direct access to the `storage_v2.StorageClient`
         instance. This can be useful for accessing
        newly added or experimental RPCs that are not yet exposed through
        the high-level GrpcClient.

        Returns:
            google.cloud.storage_v2.StorageClient: The configured GAPIC client.
        )r   )r   r   r   r   grpc_clientn   s   zGrpcClient.grpc_client)NNNT)
__name__
__module____qualname____doc___markerr   r   propertyr   __classcell__r   r   r   r   r      s"    (
r   N)	r"   google.cloud.clientr   google.cloudr   r   objectr#   r   r   r   r   r   <module>   s
   