HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/botocore/__pycache__/discovery.cpython-310.pyc
o

�h++�@s�ddlZddlZddlZddlmZddlmZmZmZddl	m
Z
ddlmZe�
e�ZGdd�de�ZGdd	�d	e�ZGd
d�de�Zdd
�ZGdd�d�ZGdd�d�ZGdd�d�ZdS)�N)�
xform_name)�
BotoCoreError�ConnectionError�HTTPClientError)�OperationNotFoundError)�CachedPropertyc@seZdZdS)�EndpointDiscoveryExceptionN)�__name__�
__module__�__qualname__�rr�E/usr/local/CyberCP/lib/python3.10/site-packages/botocore/discovery.pyrsrc@�eZdZdZdZdS)�EndpointDiscoveryRequiredzBEndpoint Discovery is disabled but is required for this operation.zAEndpoint Discovery is not enabled but this operation requires it.N�r	r
r�__doc__�fmtrrrr
r�rc@r)�EndpointDiscoveryRefreshFailedz=Endpoint Discovery failed to the refresh the known endpoints.z<Endpoint Discovery failed to refresh the required endpoints.Nrrrrr
r#rrcKs"|j}|r
|�d�rt��dSdS)N�required)�endpoint_discovery�getr)�model�kwargsrrrr
�,block_endpoint_discovery_required_operations)s�rc@sNeZdZdd�Zedd��Zedd��Zdd�Zd	d
�Zdd�Z	ddd�Z
d
S)�EndpointDiscoveryModelcC�
||_dS�N)�_service_model)�self�
service_modelrrr
�__init__0�
zEndpointDiscoveryModel.__init__cCs|jj}t|j�Sr)r�endpoint_discovery_operationr�name)r�discovery_operationrrr
�discovery_operation_name3s
z/EndpointDiscoveryModel.discovery_operation_namecCs&|jj}g}|jrt|jj���}|Sr)rr#�input_shape�list�members�keys)rr%r*rrr
�discovery_operation_keys8s
z/EndpointDiscoveryModel.discovery_operation_keyscCs2z|j�|�}|j�dd�WStyYdSw)NrF)r�operation_modelrrr)r�operation_namer,rrr
�discovery_required_for@s��z-EndpointDiscoveryModel.discovery_required_forcs>|j�|�d�s|�dd�|�dd��fdd�|��D�S)N�Identifiers�	Operationcsi|]\}}|�vr||�qSrr��.0�k�v��
input_keysrr
�
<dictcomp>OszEEndpointDiscoveryModel.discovery_operation_kwargs.<locals>.<dictcomp>)r+r�pop�items�rrrr5r
�discovery_operation_kwargsIs

z1EndpointDiscoveryModel.discovery_operation_kwargscCs|�|j|�Sr)�_gather_idsr'�r�	operation�paramsrrr
�gather_identifiersQ�z)EndpointDiscoveryModel.gather_identifiersNcCsb|duri}|j��D]#\}}|j�d�r||||<q|jdkr.||vr.|�||||�q|S)N�endpointdiscoveryid�	structure)r)r9�metadatar�	type_namer<)r�shaper?�ids�member_name�member_shaperrr
r<Ts�z"EndpointDiscoveryModel._gather_idsr)r	r
rr!rr&r+r.r;r@r<rrrr
r/s

	rc@speZdZ	ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�EndpointDiscoveryManagerNTcCsP|duri}||_i|_|durtj}||_||_t�|�|_t|j	j
�|_dSr)�_cache�_failed_attempts�time�_time�_always_discover�weakref�proxy�_clientr�metar �_model)r�client�cache�current_time�always_discoverrrr
r!dsz!EndpointDiscoveryManager.__init__cCs8|d}|��}|D]}|�d�}||d|d<q
|S)N�	Endpoints�CachePeriodInMinutes�<�
Expiration)rNr)r�response�	endpointsrW�endpoint�
cache_timerrr
�_parse_endpointsus
z)EndpointDiscoveryManager._parse_endpointscCst|t�r
tt|����S|Sr)�
isinstance�dict�tuple�sortedr9)r�valuerrr
�_cache_item}s
z$EndpointDiscoveryManager._cache_itemcs0�jjdi|��}t�fdd�t|���D��S)Nc3s�|]
\}}��|�VqdSr)rgr1�rrr
�	<genexpr>�s�z=EndpointDiscoveryManager._create_cache_key.<locals>.<genexpr>r)rTr;rdrer9r:rrhr
�_create_cache_key�sz*EndpointDiscoveryManager._create_cache_keycCs|j�||�Sr)rTr@r=rrr
r@�rAz+EndpointDiscoveryManager.gather_identifierscKs*|jdi|��}||jvr|j|=dSdS)Nr)rjrK)rr�	cache_keyrrr
�delete_endpoints�s
�z)EndpointDiscoveryManager.delete_endpointscKs@|jjdi|��}|jj}t|j|�}t�d|�|di|��S)Nz%Discovering endpoints with kwargs: %sr)rTr;r&�getattrrR�logger�debug)rrr-r%rrr
�_describe_endpoints�s
z,EndpointDiscoveryManager._describe_endpointscs.||jvrdS|����fdd�|j|D�S)Ncsg|]
}�|dkr|�qS)r\r)r2�e��nowrr
�
<listcomp>�szCEndpointDiscoveryManager._get_current_endpoints.<locals>.<listcomp>)rKrN)r�keyrrrr
�_get_current_endpoints�s
z/EndpointDiscoveryManager._get_current_endpointsc	Kst|jdi|��}z|jdi|��}|�|�}||j|<|j�|d�|WSttfy9|��d|j|<YdSw)Nr[r)	rjrprarKrLr8rrrN)rrrkr]r^rrr
�_refresh_current_endpoints�s

�z3EndpointDiscoveryManager._refresh_current_endpointscCs0||jvr|��}||j|krdS|j|=dS)NTF)rLrN)rrkrsrrr
�_recently_failed�s
z)EndpointDiscoveryManager._recently_failedcCs|ddS)Nr�Addressr)rr^rrr
�_select_endpoint�sz)EndpointDiscoveryManager._select_endpointcKs�|d}|j�|�}|js|st�d|���dS|jdi|��}|�|�}|r-|�|�S|�|�}|sC|j	di|��}|rC|�|�St�d|�|j
�|d�}|rW|�|�S|rm|rj|j	di|��}|rj|�|�St��dS)Nr0z?Optional discovery disabled. Skipping discovery for Operation: z%Endpoint Discovery has failed for: %sr)
rTr.rOrnrorjrvrzrxrwrKrr)rrr>�discovery_requiredrkr^�recently_failed�
stale_entriesrrr
�describe_endpoint�s6
�





z*EndpointDiscoveryManager.describe_endpoint)NNT)r	r
rr!rargrjr@rlrprvrwrxrzr~rrrr
rJcs
�	rJc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EndpointDiscoveryHandlercCrr)�_manager)r�managerrrr
r!�r"z!EndpointDiscoveryHandler.__init__cCs@|�d|��|j�|�d|��|j�|�d|��|j�dS)Nzbefore-parameter-build.zrequest-created.zneeds-retry.)�registerr@�register_first�discover_endpoint�handle_retries)r�events�
service_idrrr
r��s��z!EndpointDiscoveryHandler.registercKs0|j}|dur	dS|j�||�}d|i|d<dS)N�identifiers�	discovery)rr�r@)rr?r�contextrrrGrrr
r@�s
z+EndpointDiscoveryHandler.gather_identifierscKsn|j�di��d�}|durdS|jj||d�}|dur#t�d�dS|�d�s,d|}t�d|�||_dS)Nr�r��r0r/z&Failed to discover and inject endpoint�httpzhttps://z!Injecting discovered endpoint: %s)r�rr�r~rnro�
startswith�url)r�requestr-rrGr_rrr
r��s�


z*EndpointDiscoveryHandler.discover_endpointc
Ks�|durdS|\}}|�di��d�}|�di��d�}|dkr&|dkr&dS|�di�}|�di��d	�}	|	dur;dS|jj|j|	d
�dS)N�ResponseMetadata�HTTPStatusCode�Error�Codei��InvalidEndpointExceptionr�r�r�r�r)rr�rlr$)
r�request_dictr]r>r�_�status�
error_coder�rGrrr
r�s�z'EndpointDiscoveryHandler.handle_retriesN)r	r
rr!r�r@r�r�rrrr
r�s	r)�loggingrMrP�botocorer�botocore.exceptionsrrr�botocore.modelr�botocore.utilsr�	getLoggerr	rnrrrrrrJrrrrr
�<module>s
4}