rds_instance module and tests (#43789)

* Add functions to retrieve the allowed and required parameters for boto3 client methods

* Add custom waiter for stopping an RDS DB instance

* Add rds_instance module

* Add rds_instance integration tests

* address requested changes from ryansb

* address requested changes from willthames

* address requested changes from dmsimard

* Fix final snapshots

Fix idempotence with already-deleting DB instances

Remove unused import from module_utils/aws/core.py

Consolidate function to get all boto3 client method parameters and the subset of required parameters

* Add some additional rds_instance integration tests

* Add some common functions to module_utils/aws/rds

* Move common code out of rds_instance

* Remove hardcoded engine choices and require the minimum boto3

* Document wait behavior

* Provide a list of valid engines in the error message if it is invalid

Add supported methods to whitelist

Remove AWSRetry around waiter

Wait for a less crazy amount of time

Remove unused variables

* Add a test for an invalid engine option

* pep8

* Missed adding a method to the whitelist

* Use retries

* Fix some little things

* Fix more things

* Improve error message

* Support creating cross-region read replicas

* Remove unused imports

* Add retry when getting RDS instance

* Soft-check required options so module fails properly when options are missing

* Fix mariadb parameter version

* Fix cross-region read_replica creation and tests

* fix modify tests

* Fix a modification test

* Fix typo

* Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
This commit is contained in:
Sloane Hertel 2018-08-30 22:17:02 -04:00 committed by Will Thames
parent ef8ce6b2f3
commit 113336d6f1
18 changed files with 2789 additions and 0 deletions

View file

@ -204,6 +204,26 @@ eks_data = {
}
rds_data = {
"version": 2,
"waiters": {
"DBInstanceStopped": {
"delay": 20,
"maxAttempts": 60,
"operation": "DescribeDBInstances",
"acceptors": [
{
"state": "success",
"matcher": "pathAll",
"argument": "DBInstances[].DBInstanceStatus",
"expected": "stopped"
},
]
}
}
}
def ec2_model(name):
ec2_models = core_waiter.WaiterModel(waiter_config=ec2_data)
return ec2_models.get_waiter(name)
@ -219,6 +239,11 @@ def eks_model(name):
return eks_models.get_waiter(name)
def rds_model(name):
rds_models = core_waiter.WaiterModel(waiter_config=rds_data)
return rds_models.get_waiter(name)
waiters_by_name = {
('EC2', 'route_table_exists'): lambda ec2: core_waiter.Waiter(
'route_table_exists',
@ -286,6 +311,12 @@ waiters_by_name = {
core_waiter.NormalizedOperationMethod(
eks.describe_cluster
)),
('RDS', 'db_instance_stopped'): lambda rds: core_waiter.Waiter(
'db_instance_stopped',
rds_model('DBInstanceStopped'),
core_waiter.NormalizedOperationMethod(
rds.describe_db_instances
)),
}