HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/722141/root/lib/python3.6/site-packages/botocore/__pycache__/client.cpython-36.pyc
3

�T_*��@s|ddlZddlZddlmZmZddlmZddlmZddl	m
Z
ddlmZddlm
Z
ddlmZmZmZmZmZdd	lmZdd
lmZddlmZddlmZmZmZmZmZm Z m!Z!m"Z"ddlmZdd
lm#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)m*Z*m+Z+ddl,m-Z-ddl,m.Z.ej/e0�Z1e'�Z2Gdd�de3�Z4Gdd�de3�Z5Gdd�de3�Z6Gdd�de3�Z7dd�Z8dS)�N)�waiter�
xform_name)�ClientArgsCreator)�AUTH_TYPE_MAPS)�prepare_request_dict)�ClientMethodDocstring)�PaginatorDocstring)�ClientError�DataNotFoundError�OperationNotPageableError�UnknownSignatureVersionError�*InvalidEndpointDiscoveryConfigurationError)�first_non_none_response)�ServiceModel)�	Paginator)�CachedProperty�get_service_module_name�S3RegionRedirector�S3ArnParamHandler�S3EndpointSetter�ensure_boolean�S3ControlArnParamHandler�S3ControlEndpointSetter)�UNSIGNED)�Config)�get_global_history_recorder)�EndpointDiscoveryHandler�EndpointDiscoveryManager�,block_endpoint_discovery_required_operations)�standard)�adaptivec@s�eZdZdZd0dd�Zd1dd�Zd2dd	�Zd
d�Zd3dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)4�
ClientCreatorz%Creates client objects for a service.Nc

Cs:||_||_||_||_||_||_||_||_|	|_dS)N)	�_loader�_endpoint_resolver�_user_agent�_event_emitter�_retry_handler_factory�_retry_config_translator�_response_parser_factory�_exceptions_factory�
_config_store)
�self�loader�endpoint_resolver�
user_agent�
event_emitterZretry_handler_factoryZretry_config_translatorZresponse_parser_factory�exceptions_factory�config_store�r2�/usr/lib/python3.6/client.py�__init__6szClientCreator.__init__Tc

Cs�|jjd|d�}
t|
|d�}|j||�}|j||�}t|j||	|jjd�d�}
|j	||||||||	|
�	}|f|�}|j
|�|j||
||	|�|j||
||	|�|j
|||	�|S)Nzchoose-service-name)�service_name)�defaultZsigningName)�service_signing_name)r%�emitr�_load_service_model�_create_client_class�ClientEndpointBridger#�metadata�get�_get_client_args�_register_retries�_register_s3_events�_register_s3_control_events�_register_endpoint_discovery)r+r5�region_name�	is_secure�endpoint_url�verify�credentials�
scoped_config�api_version�
client_config�	responses�
service_model�cls�endpoint_bridgeZclient_argsZservice_clientr2r2r3�
create_clientHs,



zClientCreator.create_clientcCs|j||�}|j||�S)N)r9r:)r+r5rIrLr2r2r3�create_client_classesz!ClientCreator.create_client_classc	Csb|j|�}|j|�}||d<tg}|jj�}|jjd|||d�t|�}tt	|�t
|�|�}|S)N�_PY_TO_OP_NAMEzcreating-client-class.%s)�class_attributesZbase_classes)�_create_methods�_create_name_mapping�
BaseClient�
service_id�	hyphenizer%r8r�type�str�tuple)	r+r5rLrRZpy_name_to_operation_name�basesrV�
class_namerMr2r2r3r:is


z"ClientCreator._create_client_classcCs"|jj|d|d�}t||d�}|S)Nz	service-2)rI)r5)r"�load_service_modelr)r+r5rIZ
json_modelrLr2r2r3r9ws
z!ClientCreator._load_service_modelcCsV|jjjd}|dkr"|j|�n0|dkr@|j|�|j|�n|dkrR|j|�dS)N�moderr �legacy)�meta�config�retries�_register_v2_standard_retries�_register_v2_adaptive_retries�_register_legacy_retries)r+�client�
retry_moder2r2r3r?}s
zClientCreator._register_retriescCs8|jjjjd�}d|i}|dk	r(||d<tjf|�dS)N�total_max_attemptsrf�max_attempts)r`rarbr=r�register_retry_handler)r+rfri�kwargsr2r2r3rc�s
z+ClientCreator._register_v2_standard_retriescCstj|�dS)N)r rj)r+rfr2r2r3rd�sz+ClientCreator._register_v2_adaptive_retriesc
Cs�|jjj}|jjj}|j�}|jjd�}|s0dS|j|jjj	�}|j
j||jdi�|jdi�|�}t
jd|jjj�|jj||�}d|}	|jjjd|||	d�dS)NZ_retryZretryZdefinitionsz*Registering retry handlers for service: %szretry-config-%szneeds-retry.%s)�	unique_id)r`rL�endpoint_prefixrVrWr"Z	load_data�_transform_legacy_retriesrarbr'Zbuild_retry_configr=�logger�debugr5r&Zcreate_retry_handler�events�register)
r+rfrmrVZservice_event_nameZoriginal_configrbZretry_config�handlerrlr2r2r3re�s&


z&ClientCreator._register_legacy_retriescCs:|dkrdS|j�}d|kr6|j�}|jd�d|d<|S)Nrh�ri)�copy�pop)r+rbZcopied_argsr2r2r3rn�sz'ClientCreator._transform_legacy_retriescCs6|jjj}|dk	r(|jd�dk	r(|dS|jd�p4dS)Nr^rgr_)r`rarbr=�get_config_variable)r+rfr1Zclient_retriesr2r2r3�_get_retry_mode�s

zClientCreator._get_retry_modec
Cs�|dk	rdS|jjjdkrdS|jj}|jjjj�}d}|rN|jdk	rN|j}n|jr`|jjd�}|j	|�}|r�|j
||�r�|dk}t||d�}t|�}	|	j
||�n|j
dt�dS)NF�endpoint_discovery_enabledT)Zalways_discoverzbefore-parameter-build)r`rLZendpoint_discovery_operationrqrVrWryr*rw�$_normalize_endpoint_discovery_config�_requires_endpoint_discoveryrrrrr)
r+rfrErarqrV�enabledZdiscoverZmanagerrsr2r2r3rB�s(
z*ClientCreator._register_endpoint_discoverycCsPt|t�r4|j�j�}|dkr"|S|dkrBt|�Snt|t�rB|St|d��dS)z?Config must either be a boolean-string or string-literal 'auto'�auto�true�false)Zconfig_valueN)r~r)�
isinstancerY�lower�stripr�boolr
)r+r|r2r2r3rz�s


z2ClientCreator._normalize_endpoint_discovery_configcCs|dkr|jjjS|S)Nr})r`rLZendpoint_discovery_required)r+rfr|r2r2r3r{�s
z*ClientCreator._requires_endpoint_discoverycCsp|jjjdkrdSt||�j�t�j|jj�t|j|jj	|jj
j||jjd�j|jj�|j
|j||�dS)N�s3)r-�region�	s3_configrE�	partition)r`rLr5rrrrrqrr#rCrar�r��!_set_s3_presign_signature_version)r+rfrNrErJrHr2r2r3r@�s
z!ClientCreator._register_s3_eventscCsR|jjjdkrdSt�j|jj�t|j|jj|jj	j
||jjd�j|jj�dS)NZ	s3control)r-r�r�rEr�)r`rLr5rrrrqrr#rCrar�r�)r+rfrNrErJrHr2r2r3rA�sz)ClientCreator._register_s3_control_eventscCsxtd||�}|dk	rdS|jjd|j�}|jdkr@|j|kr@dS|jjd|j�}|d}d|krddS|jjd|j�dS)Nr�z
aws-global�signatureVersionszchoose-signer.s3)	�!_get_configured_signature_versionr#Zget_available_endpointsr�rC�construct_endpointrqrr�_default_s3_presign_to_sigv2)r+Zclient_metarJrHZprovided_signature_versionZregions�endpointZsignature_versionsr2r2r3r�	s 




z/ClientCreator._set_s3_presign_signature_versioncKs$xdD]}|j|�rd|SqWdS)a�
        Returns the 's3' (sigv2) signer if presigning an s3 request. This is
        intended to be used to set the default signature version for the signer
        to sigv2.

        :type signature_version: str
        :param signature_version: The current client signature version.

        :type signing_name: str
        :param signing_name: The signing name of the service.

        :return: 's3' if the request is an s3 presign request, None otherwise
        �-query�
-presign-postr�N)r�r�)�endswith)r+�signature_versionrk�suffixr2r2r3r�-s

z*ClientCreator._default_s3_presign_to_sigv2c

Cs:t|j|j|j|j|j|jd�}
|
j|||||||||	�	S)N)r1)rr%r$r(r"r)r*Zget_client_args)r+rLrCrDrErFrGrHrJrNZargs_creatorr2r2r3r>?szClientCreator._get_client_argscCs2i}x(|jD]}t|�}|j|||�||<qW|S)N)�operation_namesr�_create_api_method)r+rLZop_dict�operation_name�py_operation_namer2r2r3rSJszClientCreator._create_methodscCs(i}x|jD]}t|�}|||<qW|S)N)r�r)r+rL�mappingr�r�r2r2r3rTRs
z"ClientCreator._create_name_mappingcsH��fdd�}t��|_|j��}t|�|j|jd�dd�}||_|S)Ncs|rtd���|j�|�S)Nz$%s() only accepts keyword arguments.)�	TypeError�_make_api_call)r+�argsrk)r�r�r2r3�	_api_call]s
z3ClientCreator._create_api_method.<locals>._api_callzresponse = client.%sF)�operation_modelZmethod_namer/Zmethod_descriptionZexample_prefix�include_signature)rY�__name__r�rr%Z
documentation�__doc__)r+r�r�rLr�r�Z	docstringr2)r�r�r3r�[s


z ClientCreator._create_api_method)NNN)TNNNNNN)N)N)r��
__module__�__qualname__r�r4rOrPr:r9r?rcrdrernrxrBrzr{r@rAr�r�r>rSrTr�r2r2r2r3r!4s8






$	r!c@s�eZdZdZdZddgZddd�Zd d	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)!r;a�Bridges endpoint data and client creation

    This class handles taking out the relevant arguments from the endpoint
    resolver and determining which values to use, taking into account any
    client configuration options and scope configuration options.

    This class also handles determining what, if any, region to use if no
    explicit region setting is provided. For example, Amazon S3 client will
    utilize "us-east-1" by default if no region can be resolved.z {service}.{region}.amazonaws.comr�z
s3-controlNcCs(||_||_||_||_|p |j|_dS)N)r7r-rHrJ�DEFAULT_ENDPOINT�default_endpoint)r+r-rHrJr�r7r2r2r3r4�s
zClientEndpointBridge.__init__TcCsZ|j||�}|jj||�}|s0|jj||dd�}|rF|j|||||�S|j||||�SdS)NZaws)Zpartition_name)�_check_default_regionr-r��_create_endpoint�_assume_endpoint)r+r5rCrErD�resolvedr2r2r3�resolve�szClientEndpointBridge.resolvecCs*|dk	r|S|jr&|jjdk	r&|jjSdS)N)rJrC)r+r5rCr2r2r3r��sz*ClientEndpointBridge._check_default_regionc	Cs�|dk	}|j|||�\}}|dkrl|j|�rD|j|||d||�}n(|jd|jd��}|j|||jdg��}|j||�}	|j||�}
|j||||
|||	d�S)NZ	dnsSuffixZ
sslCommonName�hostnameZ	protocols)r5rC�signing_region�signing_namerEr<r�)�_pick_region_values�_is_s3_dualstack_mode�_create_dualstack_endpointr=�	_make_url�_resolve_signature_version�_resolve_signing_name�_create_result)r+r�r5rCrErD�explicit_regionr�r�r�r�r2r2r3r��s&
z%ClientEndpointBridge._create_endpointcCsn||jkrdS|j}|dk	r:|jdk	r:d|jkr:|jdS|jdkrHdS|jjdi�jdd�}|dkrjdSdS)NFZuse_dualstack_endpointr�T�Truer~)Tr�r~)�_DUALSTACK_ENABLED_SERVICESrJr�rHr=)r+r5rJr|r2r2r3r��s



z*ClientEndpointBridge._is_s3_dualstack_modecCs4|r|dkrd}dj|||d�}|j||ddg�S)Nz
aws-globalz	us-east-1z){service}.dualstack.{region}.{dns_suffix})�servicer��
dns_suffix�http�https)�formatr�)r+r5rCr�rDr�r�r2r2r3r��sz/ClientEndpointBridge._create_dualstack_endpointc	Csr|dkr*|jj||d�}|j||ddg�}tjd|||�|j|ddgi�}|j|id�}|j||||||id�S)	N)r�r�r�r�z#Assuming an endpoint for %s, %s: %sr��v4)r�)r5rCr�r�r�rEr<)r�r�r�rorpr�r�r�)r+r5rCrErDr�r�r�r2r2r3r��s


z%ClientEndpointBridge._assume_endpointcCs|||||||d�S)N)r5rCr�r�rEr�r<r2)r+r5rCr�r�rEr�r<r2r2r3r��sz#ClientEndpointBridge._create_resultcCs"|rd|krd}nd}d||fS)Nr�r�z%s://%sr2)r+r�rDZsupported_protocols�schemer2r2r3r�szClientEndpointBridge._make_urlcCs0d|kr d|dkr |ddS|jr,|jS|S)N�credentialScoper�)r7)r+r5r�r2r2r3r�sz*ClientEndpointBridge._resolve_signing_namecCs@|}|dkr8|d}|}d|kr8d|dkr8|dd}||fS)NZendpointNamer�r�r2)r+r�rCrEr�r2r2r3r�sz(ClientEndpointBridge._pick_region_valuescCsrt||j|j�}|dk	r|Sd|kr^|d}|dkr8dSd|krDdSx|D]}|tkrJ|SqJWt|jd�d��dS)Nr�r�Zs3v4r�)r�)r�rJrHrrr=)r+r5r�Zconfigured_versionZpotential_versionsZknownr2r2r3r�+s
z/ClientEndpointBridge._resolve_signature_version)NNNN)NNT)r�r�r�r�r�r�r4r�r�r�r�r�r�r�r�r�r�r�r2r2r2r3r;ws$	


r;c@s�eZdZiZdd�Zdd�Zdd�Zedd��Zd	d
�Z	dd�Z
d dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zdd�Zd
S)!rUcCs\||_||_||_||_i|_||_||_t||j|j||j	|	�|_
|
|_d|_|j
�dS)N)�_serializer�	_endpointZ_response_parser�_request_signer�_cacher"�_client_config�
ClientMeta�hostrQr`r)�_exceptions�_register_handlers)r+Z
serializerr�Zresponse_parserr/�request_signerrLr,rJr�r0r2r2r3r4KszBaseClient.__init__cCsNd|jjj�|f}|jjj||d�\}}|dk	r6|Std|jj|f��dS)Nz
getattr.%s.%s)rfz!'%s' object has no attribute '%s')	�_service_modelrVrWr`rq�emit_until_response�AttributeError�	__class__r�)r+�item�
event_namers�event_responser2r2r3�__getattr__\szBaseClient.__getattr__cCs*|jjjj�}|jjjd||jj�dS)Nzrequest-created.%s)r`rLrVrWrqrrr�rs)r+rVr2r2r3r�kszBaseClient._register_handlerscCs|jjS)N)r`rL)r+r2r2r3r�sszBaseClient._service_modelcCs|jj|�}|jj}tjd|||d��|jr<tjd||�|jj	|jj
|j|jd�}|j
|||d�}|jjj�}|jjjdj||d�|||j|d�\}}	|	dk	r�|	\}
}n|j|||�\}
}|jjjd	j||d�|
|||d
�|
jdk�r|jdi�jd
�}|jj|�}
|
||��n|SdS)NZAPI_CALL)r�Z	operation�paramszWarning: %s.%s() is deprecated)Z
client_regionrJ�has_streaming_input�	auth_type)�contextz)before-call.{service_id}.{operation_name})rVr�)�modelr�r�r�z(after-call.{service_id}.{operation_name})Z
http_responseZparsedr�r�i,�ErrorZCode)r�r�r5�history_recorder�recordZ
deprecatedrorpr`rCrar�r��_convert_to_request_dictrVrWrqr�r�r��
_make_requestr8Zstatus_coder=�
exceptionsZ	from_code)r+r��
api_paramsr�r5�request_context�request_dictrVrsr�r�Zparsed_responseZ
error_codeZerror_classr2r2r3r�wsJ



zBaseClient._make_api_callcCs`y|jj||�Stk
rZ}z0|jjjdj|jjj	�|j
d�||d��WYdd}~XnXdS)Nz.after-call-error.{service_id}.{operation_name})rVr�)Z	exceptionr�)r�Zmake_request�	Exceptionr`rqr8r�r�rVrW�name)r+r�r�r��er2r2r3r��s

zBaseClient._make_requestNcCsL|j|||�}|jj||�}|jjs0|jdd�t||jj|jj	|d�|S)NZhost_prefix)rEr.r�)
�_emit_api_paramsr�Zserialize_to_requestr�Zinject_host_prefixrvrr�r�r.)r+r�r�r�r�r2r2r3r��s

z#BaseClient._convert_to_request_dictcCsf|j}|jjj�}|jjjdj||d�|||d�}t||d�}d}|jjj|j||d�|||d�|S)Nz3provide-client-params.{service_id}.{operation_name})rVr�)r�r�r�)r6z4before-parameter-build.{service_id}.{operation_name})	r�r�rVrWr`rqr8r�r)r+r�r�r�r�rVrKr�r2r2r3r��szBaseClient._emit_api_paramsc	Cs�|j|�st|d��n�|j|}dd�}|jd|}t||jj|jj|dd�|_t	dt
|jj�|f�}t|tfd|i�}|j
j|�}|t||�||�}|Sd	S)
aCreate a paginator for an operation.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :raise OperationNotPageableError: Raised if the operation is not
            pageable.  You can use the ``client.can_paginate`` method to
            check if an operation is pageable.

        :rtype: L{botocore.paginate.Paginator}
        :return: A paginator object.

        )r�c[stj|f|�S)N)r�paginate)r+rkr2r2r3r��sz*BaseClient.get_paginator.<locals>.paginate�page_configF)Zpaginator_namer/rL�paginator_configr�z%s.Paginator.%sr�N)�can_paginaterrQr�rr`rqrLr�rYrrXrr�r��getattr)	r+r��actual_operation_namer�r�Zpaginator_class_nameZdocumented_paginator_clsr�Z	paginatorr2r2r3�
get_paginator�s.




zBaseClient.get_paginatorcCsld|jkrTy*|jj|jjd|jj�d}||jd<Wntk
rRi|jd<YnX|j|}||jdkS)aMCheck if an operation can be paginated.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :return: ``True`` if the operation can be paginated,
            ``False`` otherwise.

        r�zpaginators-1Z
pagination)r�r"r]r�r5rIr
rQ)r+r�r�r�r2r2r3r�s

zBaseClient.can_paginatecCsZd|jkrPy&|jj|jjd|jj�}||jd<Wntk
rNi|jd<YnX|jdS)N�
waiter_configz	waiters-2)r�r"r]r�r5rIr
)r+r�r2r2r3�_get_waiter_config.s

zBaseClient._get_waiter_configcCsh|j�}|std|��tj|�}i}x|jD]}||t|�<q.W||krVtd|��tj||||�S)aGReturns an object that can wait for some condition.

        :type waiter_name: str
        :param waiter_name: The name of the waiter to get. See the waiters
            section of the service docs for a list of available waiters.

        :returns: The specified waiter object.
        :rtype: botocore.waiter.Waiter
        zWaiter does not exist: %s)r��
ValueErrorr�WaiterModel�waiter_namesrZcreate_waiter_with_client)r+Zwaiter_namerar�r�r�r2r2r3�
get_waiter:s

zBaseClient.get_waitercCs*|j�}|sgStj|�}dd�|jD�S)z(Returns a list of all available waiters.cSsg|]}t|��qSr2)r)�.0r�r2r2r3�
<listcomp>Zsz+BaseClient.waiter_names.<locals>.<listcomp>)r�rr�r�)r+rar�r2r2r3r�Qs

zBaseClient.waiter_namescCs|jdkr|j�|_|jS)N)r��_load_exceptions)r+r2r2r3r�\s

zBaseClient.exceptionscCs|jj|j�S)N)r)Zcreate_client_exceptionsr�)r+r2r2r3r�bszBaseClient._load_exceptions)N)r�r�r�rQr4r�r��propertyr�r�r�r�r�r�r�r�r�rr�r�r�r2r2r2r3rUAs 1
9rUc@s`eZdZdZdd�Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��ZdS)r�a~Holds additional client methods.

    This class holds additional information for clients.  It exists for
    two reasons:

        * To give advanced functionality to clients
        * To namespace additional client attributes from the operation
          names which are mapped to methods at runtime.  This avoids
          ever running into collisions with operation names.

    cCs(||_||_||_||_||_||_dS)N)rqr��
_endpoint_urlr��_method_to_api_mapping�
_partition)r+rqrJrErL�method_to_api_mappingr�r2r2r3r4tszClientMeta.__init__cCs|jS)N)r�)r+r2r2r3rL}szClientMeta.service_modelcCs|jjS)N)r�rC)r+r2r2r3rC�szClientMeta.region_namecCs|jS)N)r�)r+r2r2r3rE�szClientMeta.endpoint_urlcCs|jS)N)r�)r+r2r2r3ra�szClientMeta.configcCs|jS)N)r�)r+r2r2r3r��sz ClientMeta.method_to_api_mappingcCs|jS)N)r�)r+r2r2r3r��szClientMeta.partitionN)r�r�r�r�r4r�rLrCrErar�r�r2r2r2r3r�gs	r�cCs\|r|jdk	r|jS|dk	rX|j|�}|dk	rXt|t�rX|jd�}|rXtjd||�|SdS)z�
    Gets the manually configured signature version.

    :returns: the customer configured signature version, or None if no
        signature version was configured.
    Nr�zWSwitching signature version for service %s to version %s based on config file override.)r�r=r��dictrorp)r5rJrHZservice_config�versionr2r2r3r��s	

r�)9Zlogging�	functoolsZbotocorerrZ
botocore.argsrZ
botocore.authrZbotocore.awsrequestrZbotocore.docs.docstringrrZbotocore.exceptionsr	r
rrr
Zbotocore.hooksrZbotocore.modelrZbotocore.paginaterZbotocore.utilsrrrrrrrrrZbotocore.configrZbotocore.historyrZbotocore.discoveryrrrZbotocore.retriesrr Z	getLoggerr�ror��objectr!r;rUr�r�r2r2r2r3�<module>
s>(
EK(/