Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route53 waiter with throttling retries #350

Merged
merged 2 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/350-route53-waiter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- module_utils/waiter - add Route53 ``resource_record_sets_changed`` waiter (https://github.com/ansible-collections/amazon.aws/pull/350).
31 changes: 31 additions & 0 deletions plugins/module_utils/waiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,26 @@
}


route53_data = {
"version": 2,
"waiters": {
"ResourceRecordSetsChanged": {
"delay": 30,
"maxAttempts": 60,
"operation": "GetChange",
"acceptors": [
{
"matcher": "path",
"expected": "INSYNC",
"argument": "ChangeInfo.Status",
"state": "success"
}
]
}
}
}


def _inject_limit_retries(model):

extra_retries = [
Expand Down Expand Up @@ -508,6 +528,11 @@ def rds_model(name):
return rds_models.get_waiter(name)


def route53_model(name):
route53_models = core_waiter.WaiterModel(waiter_config=_inject_limit_retries(route53_data))
return route53_models.get_waiter(name)


waiters_by_name = {
('EC2', 'image_available'): lambda ec2: core_waiter.Waiter(
'image_available',
Expand Down Expand Up @@ -671,6 +696,12 @@ def rds_model(name):
core_waiter.NormalizedOperationMethod(
rds.describe_db_instances
)),
('Route53', 'resource_record_sets_changed'): lambda route53: core_waiter.Waiter(
'resource_record_sets_changed',
route53_model('ResourceRecordSetsChanged'),
core_waiter.NormalizedOperationMethod(
route53.get_change
)),
}


Expand Down