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

Adding module that manages graph database clusters in AWS Neptune #41015

Closed
wants to merge 11 commits into from
61 changes: 61 additions & 0 deletions lib/ansible/module_utils/aws/waiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
}
}


eks_data = {
"version": 2,
"waiters": {
Expand All @@ -204,6 +205,49 @@
}


neptune_data = {
"version": 2,
"waiters": {
"DBClusterAvailable": {
"delay": 5,
"maxAttempts": 25,
"operation": "DescribeDBClusters",
"acceptors": [
{
"matcher": "path",
"expected": True,
"argument": "DBClusters[0].Status == 'available'",
"state": "success"
},
{
"matcher": "error",
"expected": "DBClusterNotFoundFault",
"state": "retry"
},
]
},
"DBClusterDeleted": {
"delay": 5,
"maxAttempts": 25,
"operation": "DescribeDBClusters",
"acceptors": [
{
"matcher": "path",
"expected": True,
"argument": "DBClusters[0]",
"state": "retry"
},
{
"matcher": "error",
"expected": "DBClusterNotFoundFault",
"state": "success"
},
]
}
}
}


def ec2_model(name):
ec2_models = core_waiter.WaiterModel(waiter_config=ec2_data)
return ec2_models.get_waiter(name)
Expand All @@ -219,6 +263,11 @@ def eks_model(name):
return eks_models.get_waiter(name)


def neptune_model(name):
neptune_models = core_waiter.WaiterModel(waiter_config=neptune_data)
return neptune_models.get_waiter(name)


waiters_by_name = {
('EC2', 'route_table_exists'): lambda ec2: core_waiter.Waiter(
'route_table_exists',
Expand Down Expand Up @@ -286,6 +335,18 @@ def eks_model(name):
core_waiter.NormalizedOperationMethod(
eks.describe_cluster
)),
('Neptune', 'cluster_available'): lambda neptune: core_waiter.Waiter(
'cluster_available',
neptune_model('DBClusterAvailable'),
core_waiter.NormalizedOperationMethod(
neptune.describe_db_clusters
)),
('Neptune', 'cluster_deleted'): lambda neptune: core_waiter.Waiter(
'cluster_deleted',
neptune_model('DBClusterDeleted'),
core_waiter.NormalizedOperationMethod(
neptune.describe_db_clusters
)),
}


Expand Down
Loading