File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/aws.cpython-310.pyc
o
�N�g>O � @ sd d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z
ddlm m
Z ddlmZ ddlZddlZddlZddlm mZ e�e�ZdZdZg d�ZdZdZd Z d
a!d
a"d
a#d
a$d
a%i Z&da'dd� Z(d&dd�Z)dd� Z*dd� Z+d'dd�Z,eddddd
dddf dd�Z-dd� Z.dd� Z/ d(d d!�Z0d"d#� Z1d)d$d%�Z2dS )*z�
Connection library for AWS
.. versionadded:: 2015.5.0
This is a base library used by a number of AWS services.
:depends: requests
� N)�datetime� us-east-1z
2016-11-15)ZRequestLimitExceededZInsufficientInstanceCapacityZ
InternalErrorZUnavailableZInsufficientAddressCapacityZ$InsufficientReservedInstanceCapacitygffffff@� zuse-instance-role-credentials� c C s t �t�dd| �� dS )az
backoff an exponential amount of time to throttle requests
during "API Rate Exceeded" failures as suggested by the AWS documentation here:
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/query-api-troubleshooting.html
and also here:
https://docs.aws.amazon.com/general/latest/gr/api-retries.html
Failure to implement this approach results in a failure rate of >30% when using salt-cloud with
"--parallel" when creating 50 or more instances with a fixed delay of 2 seconds.
A failure rate of >10% is observed when using the salt-api with an asynchronous client
specified (runner_async).
� � N)�time�sleep�random�uniform)�attempts� r
�B/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/aws.py�sleep_exponential_backoff7 s r Tc C sz i }t dur
t |d<