o
    ÚtBhC	  ã                   @   s:   d Z ddlmZ ddlmZ d
dd„ZG dd	„ d	eƒZdS )zÎ
Functions in this file are included as a convenience for working with AWSRequestsAuth.
External libraries, like boto, that this file imports are not a strict requirement for the
aws-requests-auth package.
é    )ÚSessioné   )ÚAWSRequestsAuthNc                 C   s,   | du r	t ƒ  ¡ } |  ¡ }|j|j|jdœS )a˜  
    Interacts with boto to retrieve AWS credentials, and returns a dictionary of
    kwargs to be used in AWSRequestsAuth. boto automatically pulls AWS credentials from
    a variety of sources including but not limited to credentials files and IAM role.
    AWS credentials are pulled in the order listed here:
    http://boto3.readthedocs.io/en/latest/guide/configuration.html#configuring-credentials
    N)Úaws_access_keyÚaws_secret_access_keyÚ	aws_token)r   Úget_credentialsÚget_frozen_credentialsÚ
access_keyÚ
secret_keyÚtoken)Úcredentials_objÚfrozen_credentials© r   ús/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/aws_requests_auth/boto_utils.pyr      s   
ýr   c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )ÚBotoAWSRequestsAuthc                    s(   t t| ƒ dd|||¡ tƒ  ¡ | _dS )a  
        Example usage for talking to an AWS Elasticsearch Service:

        BotoAWSRequestsAuth(aws_host='search-service-foobar.us-east-1.es.amazonaws.com',
                            aws_region='us-east-1',
                            aws_service='es')

        The aws_access_key, aws_secret_access_key, and aws_token are discovered
        automatically from the environment, in the order described here:
        http://boto3.readthedocs.io/en/latest/guide/configuration.html#configuring-credentials
        N)Úsuperr   Ú__init__r   r   Ú_refreshable_credentials)ÚselfÚaws_hostÚ
aws_regionÚaws_service©Ú	__class__r   r   r   "   s   zBotoAWSRequestsAuth.__init__c                 C   s   t | jƒ}| j|fi |¤ŽS ©N)r   r   Úget_aws_request_headers)r   ÚrÚcredentialsr   r   r   Úget_aws_request_headers_handler1   s   
z3BotoAWSRequestsAuth.get_aws_request_headers_handler)Ú__name__Ú
__module__Ú__qualname__r   r   Ú__classcell__r   r   r   r   r       s    r   r   )Ú__doc__Úbotocore.sessionr   Úaws_authr   r   r   r   r   r   r   Ú<module>   s
    
