Current File : //usr/lib/python3/dist-packages/boto3/__pycache__/crt.cpython-312.pyc
�

��e���dZddlZddlZddlmZddlmZmZm	Z	m
Z
mZdada
ej�ZdZd�Zd�Zd�Zd	�Zd
�ZGd�d�Zd
�Zd�Zd�Zy)a6
This file contains private functionality for interacting with the AWS
Common Runtime library (awscrt) in boto3.

All code contained within this file is for internal usage within this
project and is not intended for external consumption. All interfaces
contained within are subject to abrupt breaking changes.
�N)�Session)�BotocoreCRTCredentialsWrapper�BotocoreCRTRequestSerializer�CRTTransferManager�acquire_crt_s3_process_lock�create_s3_crt_client�boto3c�$�|d|d�}tdi|��S)z�Create a CRT S3 Client for file transfer.

    Instantiating many of these may lead to degraded performance or
    system resource exhaustion.
    T)�region�use_ssl�crt_credentials_provider�)r)�session�config�region_name�
cred_provider�create_crt_client_kwargss     �+/usr/lib/python3/dist-packages/boto3/crt.py�_create_crt_clientr*s&����$1� ��
 �;�":�;�;�c� �t||dd��S)N)r�endpoint_url)r)rrs  r�_create_crt_request_serializerr8s��'���d�C��rc�l�t|�}|j�}tt||||�|||�S)zFCreate boto3 wrapper class to manage crt lock reference and S3 client.)r�to_crt_credentials_provider�CRTS3Clientr)rrr�credentials�lock�kwargs�cred_wrapperrs        r�_create_crt_s3_clientr!>s@��1��=�L� �<�<�>�M���7�F�K��G����	�rc���tt�}|�yt�}|jj}|j�}t
||�}t|||||�}||fS)N)NN)r�PROCESS_LOCK_NAMEr�metar�_get_credentialsrr!)�clientrrrrr�
serializer�	s3_clients        r�#_initialize_crt_transfer_primativesr)Lsi��&�'8�9�D��|���i�G��+�+�)�)�K��)�)�+�K�/���E�J�%����k�4��I��y� � rc��t5t�t||�\}}|a|addd�tS#1swYtSxYw�N)�CLIENT_CREATION_LOCK�
CRT_S3_CLIENTr)�BOTOCORE_CRT_SERIALIZER)r&rr'r(s    r�get_crt_s3_clientr/_sN��
�&�� �$G���%�!�J�	�'1�#�%�M�
&���&���s�/�=c��eZdZdZd�Zy)ra�
    This wrapper keeps track of our underlying CRT client, the lock used to
    acquire it and the region we've used to instantiate the client.

    Due to limitations in the existing CRT interfaces, we can only make calls
    in a single region and does not support redirects. We track the region to
    ensure we don't use the CRT client when a successful request cannot be made.
    c�<�||_||_||_||_yr+)�
crt_client�process_lockrr)�selfr2r3rrs     r�__init__zCRTS3Client.__init__xs ��$���(������*��rN)�__name__�
__module__�__qualname__�__doc__r5rrrrrns���+rrc���|�y|j�}|�yt|j�|j�}|jj
|jk(}|xr|S)z�
    Boto3 client must use same signing region and credentials
    as the CRT_S3_CLIENT singleton. Otherwise fallback to classic.
    F)r%�compare_identity�get_frozen_credentialsrr$rr)r&�
crt_s3_client�boto3_creds�is_same_identity�is_same_regions     r�is_crt_compatible_requestrAsk��
����)�)�+�K����'��*�*�,�m�.I�.I����[�[�,�,�
�0D�0D�D�N��.�.�.rc��	|�}|j|jk(xr4|j
|jk(xr|j|jk(}|S#tjj$rYywxYw)NF)	�botocore�
exceptions�NoCredentialsError�
access_key�
access_key_id�
secret_key�secret_access_key�token�
session_token)r>�crt_s3_creds�	crt_creds�is_matching_identitys    rr;r;�s���� �N�	�
	���)�"9�"9�9�	9��"�"�i�&A�&A�A�	9�����!8�!8�8��
 ������1�1����s�A�A:�9A:c�h�t||�}t||�rt|jt�Sy)z8Create a CRTTransferManager for optimized data transfer.N)r/rArr2r.)r&rr=s   r�create_crt_transfer_managerrP�s6��%�f�f�5�M� ���7�!��$�$�&=�
�	
�r)r9�	threading�botocore.exceptionsrC�botocore.sessionr�s3transfer.crtrrrrrr-r.�Lockr,r#rrr!r)r/rrAr;rPrrr�<module>rVss�����$����
���%�y�~�~�'����<���!�&�+�+�"/�& �r