
    DhX                        d dl mZ d dlmZmZmZmZmZmZ d dl	m
Z
 d dlmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d	d
lmZ d	dlmZ d	dlmZmZ d	dlmZ d	dlm Z  d	dl!m"Z"m#Z# d	dl$m%Z%  e       Z& G d de      Z' G d de      Z(y)    )prepare_request_dict)
BaseClientClientCreatorClientEndpointBridgePaginatorDocstringloggerresolve_checksum_context),block_endpoint_discovery_required_operations)OperationNotPageableErrorUnknownServiceError)get_global_history_recorder)first_non_none_response)get_service_module_name)
xform_name   )waiter)AioClientArgsCreator)AioEndpointDiscoveryHandlerAioEndpointDiscoveryManager)apply_request_checksum)AioPaginator)adaptivestandard)AioS3RegionRedirectorv2c                   T    e Zd Z	 	 	 	 	 	 	 	 ddZd Zd Zd Zd Zd Zd Z	d	 Z
d
 Zy)AioClientCreatorNc                 >  K   | j                   j                  d|       d {   }t        ||      }| j                  ||      }	 | j	                  ||      }| j
                  j                  d      }| j                  ||       d {   }| j                  ||	      \  }}	t        | j                  ||	|j                  j                  d      | j                   |j                  j                  d            }| j#                  ||||||||	||
||      } |di |}| j%                  |       | j'                  |d d |	|	       | j)                  |
       | j+                  |||	       |S 7 J# t        $ r d }d }t        j                  d|       Y !w xY w7 w)Nzchoose-service-name)service_namedefault
partitionszSNo endpoints ruleset found for service %s, falling back to legacy endpoint routing.signingNamesignatureVersion)service_signing_nameconfig_storeservice_signature_version)clientendpoint_bridgeendpoint_urlclient_configscoped_configr'    )_event_emitteremitr   _load_service_model_load_service_endpoints_ruleset_loader	load_datar   r   info_create_client_class_normalize_fips_regionr   _endpoint_resolvermetadataget_config_store_get_client_args_register_retries_register_s3_events_register_s3_control_events_register_endpoint_discovery)selfr   region_name	is_securer)   verifycredentialsr+   api_versionr*   
auth_token	responsesservice_modelendpoints_ruleset_datapartition_dataclsr(   client_argsservice_clients                      t/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/aiobotocore/client.pycreate_clientzAioClientCreator.create_client   s     --22! 3 
 
	 /y,O00{K	%)%I%Ik&" "\\33LAN --lMJJ%)%@%@&
"] /##!.!7!7!;!;M!J++&3&<&<&@&@"'	
 ++"
 +{+~.  ! '' 	! 	
 	(((?))L-	
 y
 # 	%)"!NKK+	 Ks@   !FE-#F-E0 5F
FC#F0#FFFFc                 H  K   | j                  |      }| j                  |      }||d<   t        g}|j                  j	                         }| j
                  j                  d|z  ||       d {    t        |      }t        t        |      t        |      |      }|S 7 0w)N_PY_TO_OP_NAMEzcreating-client-class.%s)class_attributesbase_classes)_create_methods_create_name_mappingAioBaseClient
service_id	hyphenizer.   r/   r   typestrtuple)	r@   r   rH   rR   py_name_to_operation_namebasesrW   
class_namerK   s	            rN   r5   z%AioClientCreator._create_client_classh   s     //>$($=$=m$L!-F)*"--779
!!&&&3- ' 
 	
 	

 -];
3z?E%L2BC
	
s   A-B"/B 01B"c                     |j                   j                  j                  d   }|dk(  r| j                  |       y |dk(  r#| j                  |       | j	                  |       y |dk(  r| j                  |       y y )Nmoder   r   legacy)metaconfigretries_register_v2_standard_retries_register_v2_adaptive_retries_register_legacy_retries)r@   r'   
retry_modes      rN   r<   z"AioClientCreator._register_retriesw   ss    . [[''//7
#..v6:%..v6..v68#))&1 $    c                     |j                   j                  j                  j                  d      }d|i}|||d<   t	        j
                  di | y )Ntotal_max_attemptsr'   max_attemptsr-   )rb   rc   rd   r9   r   register_retry_handler)r@   r'   rl   kwargss       rN   re   z.AioClientCreator._register_v2_standard_retries   sN    {{))11556JKF##%1F>"''1&1ri   c                 .    t        j                  |       y N)r   rm   )r@   r'   s     rN   rf   z.AioClientCreator._register_v2_adaptive_retries   s     	''/ri   c                    |j                   j                  j                  }|j                   j                  j                  }|j	                         }| j
                  j                  d      }|sy | j                  |j                   j                  j                        }| j                  j                  ||j                  di       |j                  di       |      }t        j                  d|j                   j                  j                         | j                   j#                  ||      }d|z  }	|j                   j$                  j'                  d| ||	       y )N_retryretrydefinitionsz*Registering retry handlers for service: %szretry-config-%szneeds-retry.)	unique_id)rb   rH   endpoint_prefixrW   rX   r2   r3   _transform_legacy_retriesrc   rd   _retry_config_translatorbuild_retry_configr9   r   debugr   _retry_handler_factorycreate_retry_handlereventsregister)
r@   r'   rv   rW   service_event_nameoriginal_configrd   retry_confighandlerru   s
             rN   rg   z)AioClientCreator._register_legacy_retries   s.    ++33CC[[..99
'113 ,,00:001C1C1K1KL44GG,r2	
 	8KK%%22	
 --BB/
 &(::	##-./I 	$ 	
ri   c                 0   |y |j                   j                  j                  y |j                   j                  }|j                   j                  j                  j                         }d}|r|j                  |j                  }n'| j                  r| j                  j                  d      }| j                  |      }|rA| j                  ||      r/|du }t        ||      }t        |      }	|	j                  ||       y |j                  dt               y )NFendpoint_discovery_enabledT)always_discoverzbefore-parameter-build)rb   rH   endpoint_discovery_operationr}   rW   rX   r   r:   get_config_variable$_normalize_endpoint_discovery_config_requires_endpoint_discoveryr   r   r~   r
   )
r@   r'   r)   rc   r}   rW   enableddiscovermanagerr   s
             rN   r?   z-AioClientCreator._register_endpoint_discovery   s    #;;$$AAI##[[..99CCE
f77C77G((<<,G ;;GDt88I$H1G 2':GVZ0OO(<ri   c                     |j                   j                  j                  dk7  ry t        d |      j	                          | j                  |j                   ||       y )Ns3)rb   rH   r   r   r~   !_set_s3_presign_signature_version)r@   r'   r(   r)   r*   r+   s         rN   r=   z$AioClientCreator._register_s3_events   sK     ;;$$11T9f-668..KK	
ri   c                     t        | j                  | j                  | j                  | j                  | j
                  | j                        }|j                  |||||||||	|
||      S )N)r%   )r   r.   _user_agent_response_parser_factoryr2   _exceptions_factoryr:   get_client_args)r@   rH   rA   rB   r)   rC   rD   r+   r*   r(   rF   rI   rJ   args_creators                 rN   r;   z!AioClientCreator._get_client_args   s{    " ,))LL$$++
 ++"
 	
ri   )TNNNNNNN)__name__
__module____qualname__rO   r5   r<   re   rf   rg   r?   r=   r;   r-   ri   rN   r   r      sL    
 IV2@20

>>
&
ri   r   c                   `    e Zd Zd Zd Zd Zd Zd Z	 	 	 ddZd Z		 dd	Z
d
 Zd Zd Zd Zy)rV   c                    K   dj                  | j                  j                  j                         |      }| j                  j
                  j                  ||        d {   \  }}|S 7 	w)Nzgetattr.{}.{}r,   )format_service_modelrW   rX   rb   r}   emit_until_response)r@   item
event_namer   event_responses        rN   _async_getattrzAioBaseClient._async_getattr  sn     $++**446

 )-		(8(8(L(Lt )M )
 #
 	#
s   AA-!A+"
A-c                 `    t        dj                  | j                  j                  |            )Nz!'{}' object has no attribute '{}')AttributeErrorr   	__class__r   )r@   r   s     rN   __getattr__zAioBaseClient.__getattr__$  s.     /66''
 	
ri   c                 T   K   | j                   j                          d{    y7 w)z'Closes underlying endpoint connections.N)	_endpointcloser@   s    rN   r   zAioBaseClient.close.  s     nn""$$$s   (&(c                   K   | j                   j                  |      }| j                   j                  }t        j	                  d|||d       |j
                  rt        j                  d||       | j                  j                  | j                  j                  |j                  |j                  d}| j                  |||       d {   \  }}| j                  |||||       d {   }t        |||       | j                   j                   j#                         }	| j                  j$                  j'                  dj)                  |	|      ||| j*                  |       d {   \  }
}||\  }}n)t-        |       | j/                  |||       d {   \  }}| j                  j$                  j1                  d	j)                  |	|      ||||
       d {    |j2                  dk\  rE|j5                  di       j5                  d      }| j6                  j9                  |      } |||      |S 7 q7 S7 7 7 dw)NAPI_CALL)service	operationparamszWarning: %s.%s() is deprecated)client_regionr*   has_streaming_input	auth_type)
api_paramsoperation_modelr)   contextheadersz)before-call.{service_id}.{operation_name}rW   operation_name)modelr   request_signerr   z(after-call.{service_id}.{operation_name})http_responseparsedr   r   i,  ErrorCode)r   r   r   history_recorderrecord
deprecatedr   rz   rb   rA   rc   r   r   _resolve_endpoint_ruleset_convert_to_request_dictr	   rW   rX   r}   r   r   _request_signerr   _make_requestr/   status_coder9   
exceptions	from_code)r@   r   r   r   r   request_contextr)   additional_headersrequest_dictrW   r   r   httpparsed_response
error_codeerror_classs                   rN   _make_api_callzAioBaseClient._make_api_call2  sh    --==nM**77'+$	
 %%LL0, "YY22!YY--#2#F#F(22	
 261O1OZ2
 ,
(( "::!+%#& ; 
 
 	!
K((33==?
(,		(8(8(L(L7>>%n ?  "//# )M )
 #
 %$2!D/"<0*.*<*<+ %!D/ ii##6==%n >  "!# $ 
 	
 	
 s"(,,Wb9==fEJ//33J?Ko~>>""],

#
%	
s]   CI
H; I+H>,A=I)I*0IIAI I!AI>IIIIc                 X  K   	 | j                   j                  ||       d {   S 7 # t        $ rt}| j                  j                  j                  dj                  | j                  j                  j                         |j                        ||       d {  7    d }~ww xY ww)Nz.after-call-error.{service_id}.{operation_name}r   )	exceptionr   )r   make_request	Exceptionrb   r}   r/   r   r   rW   rX   name)r@   r   r   r   es        rN   r   zAioBaseClient._make_requestw  s     	44     		))""''@GG#22==GGI#2#7#7 H  ' (    		s=   B** (* B** 	B'A(B"BB""B''B*Nc                 P  K   | j                  |||       d {   }| j                  j                  ||      }| j                  j                  s|j                  dd        ||d   j                  |       |r| j                  j                  }nd }t        ||||       |S 7 w)Nhost_prefixr   )r)   
user_agentr   )	_emit_api_params_serializerserialize_to_request_client_configinject_host_prefixpopupdater   r   )	r@   r   r   r)   r   r   set_user_agent_headerr   r   s	            rN   r   z&AioBaseClient._convert_to_request_dict  s       00
 

 ''<<
 ""55]D1#**73 ,,77JJ%!		
 )
s   B&B$BB&c                 l  K   |j                   }| j                  j                  j                         }| j                  j
                  j                  d| d| |||       d {   }t        ||      }| j                  j
                  j                  d| d| |||       d {    |S 7 J7 w)Nzprovide-client-params..)r   r   r   r   zbefore-parameter-build.)r   r   rW   rX   rb   r}   r/   r   )r@   r   r   r   r   rW   rG   s          rN   r   zAioBaseClient._emit_api_params  s      )--
 ((33==?
))**//$ZL.1AB!	 0 
 
	 -Y
K
ii##%j\>2BC!	 $ 
 	
 	
 
	
s%   A#B4%B0&AB4)B2*B42B4c                   K   | j                   | j                  j                  }i }||fS | j                   j                  |||       d{   }|j                  }|j
                  }|j                  j                  d      }|O| j                   j                  |      }	|	\  }
}|
|d<   d|v r|r|d= d|v r|d   j                  |       ||fS ||d<   ||fS 7 w)a  Returns endpoint URL and list of additional headers returned from
        EndpointRulesetResolver for the given operation and params. If the
        ruleset resolver is not available, for example because the service has
        no endpoints ruleset file, the legacy endpoint resolver's value is
        returned.

        Use ignore_signing_region for generating presigned URLs or any other
        situtation where the signing region information from the ruleset
        resolver should be ignored.

        Returns tuple of URL and headers dictionary. Additionally, the
        request_context dict is modified in place with any signing information
        returned from the ruleset resolver.
        N)r   	call_argsr   authSchemesr   regionsigning)
_ruleset_resolverrb   r)   construct_endpointurlr   
propertiesr9   auth_schemes_to_signing_ctxr   )r@   r   r   r   ignore_signing_regionr)   r   endpoint_infoauth_schemes	auth_infor   signing_contexts               rN   r   z'AioBaseClient._resolve_endpoint_ruleset  s#    * !!)9911L!#2 //// #'"8"8"K"K /  / #L # M
 ),,L!.!6!6 )3377FL' 22NN 	 .7*	?/8,.3H'1/#I.55oF /// 2AOI.////s   A
CCBCc                    | j                  |      st        |      | j                  |   }d }| j                  d   |   }t	        || j
                  j                  | j
                  j                  |d      |_        t        | j
                  j                        }| d| }t        |t        fd|i      }| j                  j                  |      } |t        | |      ||      }	|	S )a  Create 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                 .    t        j                  | fi |S rp   )r   paginate)r@   rn   s     rN   r   z-AioBaseClient.get_paginator.<locals>.paginate  s    #,,T<V<<ri   page_configF)paginator_nameevent_emitterrH   paginator_configinclude_signaturez.Paginator.r   )can_paginater   rQ   _cacher   rb   r}   rH   __doc__r   rY   r   r   r   getattr)
r@   r   actual_operation_namer   r   service_module_namepaginator_class_namedocumented_paginator_clsr   	paginators
             rN   get_paginatorzAioBaseClient.get_paginator  s
   &   0+>JJ$($7$7$G!
=  ${{=9%   24"ii.."ii55!1"' H #:		''# ''{3H2IJ !
 (,$|o
H7M($ #11AA%O 1n- I
 ri   c                    | j                         }|st        d|z        t        j                  |      }i }|j                  D ]  }||t        |      <    ||vrt        d|z        t        j                  ||   ||       S )aG  Returns 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
        zWaiter does not exist: %s)_get_waiter_config
ValueErrorr   WaiterModelwaiter_namesr   create_waiter_with_client)r@   waiter_namerc   r   mappingr   s         rN   
get_waiterzAioBaseClient.get_waiter6  s     ((*8;FGG""6*&& 	-D(,GJt$%	-g%8;FGG//K %
 	
ri   c                 j   K   | j                   j                  j                          d {    | S 7 wrp   )r   http_session
__aenter__r   s    rN   r  zAioBaseClient.__aenter__N  s,     nn))44666 	7s   (313c                 n   K   | j                   j                  j                  |||       d {    y 7 wrp   )r   r  	__aexit__)r@   exc_typeexc_valexc_tbs       rN   r  zAioBaseClient.__aexit__R  s(     nn))33HgvNNNs   +535)NNT)F)r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r-   ri   rN   rV   rV     sS    
%C#J. ">< $00d?F
0Ori   rV   N))botocore.awsrequestr   botocore.clientr   r   r   r   r   r	   botocore.discoveryr
   botocore.exceptionsr   r   botocore.historyr   botocore.hooksr   botocore.utilsr   botocore.waiterr    r   argsr   	discoveryr   r   httpchecksumr   r   r   rd   r   r   utilsr   r   r   rV   r-   ri   rN   <module>r"     sd    4  L N 8 2 2 &  & O 0 " ' *.0 z
} z
zzOJ zOri   