mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Add docs to AnsibleAWSModule.client
retry settings (#38689)
This commit is contained in:
parent
ae7e391dab
commit
40b7a63d1a
1 changed files with 15 additions and 2 deletions
|
@ -44,6 +44,19 @@ or
|
||||||
|
|
||||||
m.client('sts') # - get an AWS connection as a boto3 client.
|
m.client('sts') # - get an AWS connection as a boto3 client.
|
||||||
|
|
||||||
|
To make use of AWSRetry easier, it can now be wrapped around any call from a
|
||||||
|
module-created client. To add retries to a client, create a client:
|
||||||
|
|
||||||
|
m.client('ec2', retry_decorator=AWSRetry.jittered_backoff(retries=10))
|
||||||
|
|
||||||
|
Any calls from that client can be made to use the decorator passed at call-time
|
||||||
|
using the `aws_retry` argument. By default, no retries are used.
|
||||||
|
|
||||||
|
ec2 = m.client('ec2', retry_decorator=AWSRetry.jittered_backoff(retries=10))
|
||||||
|
ec2.describe_instances(InstanceIds=['i-123456789'], aws_retry=True)
|
||||||
|
|
||||||
|
The call will be retried the specified number of times, so the calling functions
|
||||||
|
don't need to be wrapped in the backoff decorator.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue