Various code reformatting

reviewable/pr18780/r1
Michael DeHaan 11 years ago
parent 7b8101eebf
commit 78bc5fd729

@ -41,10 +41,11 @@ options:
aliases: []
db_engine:
description:
- The type of database. Used only when command=create. Must be one of: MySQL | oracle-se1 | oracle-se | oracle-ee | sqlserver-ee | sqlserver-se | sqlserver-ex | sqlserver-web
- The type of database. Used only when command=create.
required: false
default: null
aliases: []
choices: [ 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web' ]
size:
description:
- Size in gigabytes of the initial storage for the DB instance. Used only when command=create or command=modify.
@ -53,10 +54,11 @@ options:
aliases: []
instance_type:
description:
- The instance type of the database. Must be specified when command=create. Optional when command=replicate or command=modify. If not specified then the replica inherits the same instance type as the source instance. Must be one of: db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | db.m1.xlarge | db.m2.xlarge | db.m2.2xlarge | db.m2.4xlarge
- The instance type of the database. Must be specified when command=create. Optional when command=replicate or command=modify. If not specified then the replica inherits the same instance type as the source instance.
required: false
default: null
aliases: []
choices: [ 'db.t1.micro', 'db.m1.small', 'db.m1.medium', 'db.m1.large', 'db.m1.xlarge', 'db.m2.xlarge', 'db.m2.2xlarge', 'db.m2.4xlarge' ]
username:
description:
- Master database username. Used only when command=create.
@ -95,13 +97,15 @@ options:
aliases: []
license_model:
description:
- The license model for this DB instance. Used only when command=create. Must be one of: license-included | bring-your-own-license | general-public-license
- The license model for this DB instance. Used only when command=create.
required: false
default: null
aliases: []
choices: [ 'license-included', 'bring-your-own-license', 'general-public-license' ]
multi_zone:
description:
- Specifies if this is a Multi-availability-zone deployment. Can not be used in conjunction with zone parameter. Used only when command=create or command=modify. Valid values: true | false
- Specifies if this is a Multi-availability-zone deployment. Can not be used in conjunction with zone parameter. Used only when command=create or command=modify.
choices: [ "yes", "no" ]
required: false
default: null
aliases: []
@ -208,7 +212,7 @@ author: Bruce Pennypacker
EXAMPLES = '''
# Basic mysql provisioning example
action: rds
- rds: >
command=create
instance_name=new_database
db_engine=MySQL
@ -218,7 +222,7 @@ EXAMPLES = '''
password=1nsecure
# Create a read-only replica and wait for it to become available
action: rds
- rds: >
command=replicate
instance_name=new_database_replica
source_instance=new_database
@ -226,13 +230,13 @@ EXAMPLES = '''
wait_timeout=600
# Delete an instance, but create a snapshot before doing so
action: rds
- rds: >
command=delete
instance_name=new_database
snapshot=new_database_snapshot
# Get facts about an instance
action: rds
- rds: >
command=facts
instance_name=new_database
register: new_database_facts
@ -278,11 +282,11 @@ def main():
engine_version = dict(required=False),
parameter_group = dict(required=False),
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license'], required=False),
multi_zone = dict(choices=BOOLEANS, default=False),
multi_zone = dict(type='bool', default=False),
iops = dict(required=False),
security_groups = dict(required=False),
port = dict(required=False),
upgrade = dict(choices=BOOLEANS, default=False),
upgrade = dict(type='bool', default=False),
option_group = dict(required=False),
maint_window = dict(required=False),
backup_window = dict(required=False),
@ -292,10 +296,10 @@ def main():
subnet = dict(required=False),
ec2_secret_key = dict(aliases=['EC2_SECRET_KEY'], no_log=True, required=False),
ec2_access_key = dict(aliases=['EC2_ACCESS_KEY'], required=False),
wait = dict(choices=BOOLEANS, default=False),
wait = dict(type='bool', default=False),
wait_timeout = dict(default=300),
snapshot = dict(required=False),
apply_immediately = dict(choices=BOOLEANS, default=False),
apply_immediately = dict(type='bool', default=False),
)
)
@ -361,15 +365,19 @@ def main():
if command == 'create':
required_vars = [ 'instance_name', 'db_engine', 'size', 'instance_type', 'username', 'password' ]
invalid_vars = [ 'source_instance', 'snapshot', 'apply_immediately' ]
elif command == 'replicate':
required_vars = [ 'instance_name', 'source_instance' ]
invalid_vars = [ 'db_engine', 'size', 'username', 'password', 'db_name', 'engine_version', 'parameter_group', 'license_model', 'multi_zone', 'iops', 'security_groups', 'option_group', 'maint_window', 'backup_window', 'backup_retention', 'subnet', 'snapshot', 'apply_immediately' ]
elif command == 'delete':
required_vars = [ 'instance_name' ]
invalid_vars = [ 'db_engine', 'size', 'instance_type', 'username', 'password', 'db_name', 'engine_version', 'parameter_group', 'license_model', 'multi_zone', 'iops', 'security_groups', 'option_group', 'maint_window', 'backup_window', 'backup_retention', 'port', 'upgrade', 'subnet', 'zone' , 'source_instance', 'apply_immediately' ]
elif command == 'facts':
required_vars = [ 'instance_name' ]
invalid_vars = [ 'db_engine', 'size', 'instance_type', 'username', 'password', 'db_name', 'engine_version', 'parameter_group', 'license_model', 'multi_zone', 'iops', 'security_groups', 'option_group', 'maint_window', 'backup_window', 'backup_retention', 'port', 'upgrade', 'subnet', 'zone', 'wait', 'source_instance' 'apply_immediately' ]
elif command == 'modify':
required_vars = [ 'instance_name' ]
if password:
@ -378,11 +386,11 @@ def main():
for v in required_vars:
if not module.params.get(v):
module.fail_json(msg = str("Variable %s required for %s command" % (v, command)))
module.fail_json(msg = str("Parameter %s required for %s command" % (v, command)))
for v in invalid_vars:
if module.params.get(v):
module.fail_json(msg = str("Variable %s invalid for %s command" % (v, command)))
module.fail_json(msg = str("Parameter %s invalid for %s command" % (v, command)))
# Package up the optional parameters
params = {}
@ -496,17 +504,17 @@ def main():
# If we got here then pack up all the instance details to send
# back to ansible
d = {
'id': my_inst.id,
'create_time': my_inst.create_time,
'status': my_inst.status,
'availability_zone': my_inst.availability_zone,
'backup_retention': my_inst.backup_retention_period,
'backup_window': my_inst.preferred_backup_window,
'maintenance_window': my_inst.preferred_maintenance_window,
'multi_zone': my_inst.multi_az,
'instance_type': my_inst.instance_class,
'username': my_inst.master_username,
'iops': my_inst.iops
'id' : my_inst.id,
'create_time' : my_inst.create_time,
'status' : my_inst.status,
'availability_zone' : my_inst.availability_zone,
'backup_retention' : my_inst.backup_retention_period,
'backup_window' : my_inst.preferred_backup_window,
'maintenance_window' : my_inst.preferred_maintenance_window,
'multi_zone' : my_inst.multi_az,
'instance_type' : my_inst.instance_class,
'username' : my_inst.master_username,
'iops' : my_inst.iops
}
# Endpoint exists only if the instance is available

Loading…
Cancel
Save