Various code reformatting

pull/3273/merge
Michael DeHaan 12 years ago
parent db94171f5b
commit 4c43264033

@ -41,10 +41,11 @@ options:
aliases: [] aliases: []
db_engine: db_engine:
description: 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 required: false
default: null default: null
aliases: [] aliases: []
choices: [ 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web' ]
size: size:
description: description:
- Size in gigabytes of the initial storage for the DB instance. Used only when command=create or command=modify. - 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: [] aliases: []
instance_type: instance_type:
description: 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 required: false
default: null default: null
aliases: [] 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: username:
description: description:
- Master database username. Used only when command=create. - Master database username. Used only when command=create.
@ -95,13 +97,15 @@ options:
aliases: [] aliases: []
license_model: license_model:
description: 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 required: false
default: null default: null
aliases: [] aliases: []
choices: [ 'license-included', 'bring-your-own-license', 'general-public-license' ]
multi_zone: multi_zone:
description: 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 required: false
default: null default: null
aliases: [] aliases: []
@ -208,7 +212,7 @@ author: Bruce Pennypacker
EXAMPLES = ''' EXAMPLES = '''
# Basic mysql provisioning example # Basic mysql provisioning example
action: rds - rds: >
command=create command=create
instance_name=new_database instance_name=new_database
db_engine=MySQL db_engine=MySQL
@ -218,7 +222,7 @@ EXAMPLES = '''
password=1nsecure password=1nsecure
# Create a read-only replica and wait for it to become available # Create a read-only replica and wait for it to become available
action: rds - rds: >
command=replicate command=replicate
instance_name=new_database_replica instance_name=new_database_replica
source_instance=new_database source_instance=new_database
@ -226,13 +230,13 @@ EXAMPLES = '''
wait_timeout=600 wait_timeout=600
# Delete an instance, but create a snapshot before doing so # Delete an instance, but create a snapshot before doing so
action: rds - rds: >
command=delete command=delete
instance_name=new_database instance_name=new_database
snapshot=new_database_snapshot snapshot=new_database_snapshot
# Get facts about an instance # Get facts about an instance
action: rds - rds: >
command=facts command=facts
instance_name=new_database instance_name=new_database
register: new_database_facts register: new_database_facts
@ -278,11 +282,11 @@ def main():
engine_version = dict(required=False), engine_version = dict(required=False),
parameter_group = dict(required=False), parameter_group = dict(required=False),
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license'], 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), iops = dict(required=False),
security_groups = dict(required=False), security_groups = dict(required=False),
port = dict(required=False), port = dict(required=False),
upgrade = dict(choices=BOOLEANS, default=False), upgrade = dict(type='bool', default=False),
option_group = dict(required=False), option_group = dict(required=False),
maint_window = dict(required=False), maint_window = dict(required=False),
backup_window = dict(required=False), backup_window = dict(required=False),
@ -292,10 +296,10 @@ def main():
subnet = dict(required=False), subnet = dict(required=False),
ec2_secret_key = dict(aliases=['EC2_SECRET_KEY'], no_log=True, 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), 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), wait_timeout = dict(default=300),
snapshot = dict(required=False), 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': if command == 'create':
required_vars = [ 'instance_name', 'db_engine', 'size', 'instance_type', 'username', 'password' ] required_vars = [ 'instance_name', 'db_engine', 'size', 'instance_type', 'username', 'password' ]
invalid_vars = [ 'source_instance', 'snapshot', 'apply_immediately' ] invalid_vars = [ 'source_instance', 'snapshot', 'apply_immediately' ]
elif command == 'replicate': elif command == 'replicate':
required_vars = [ 'instance_name', 'source_instance' ] 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' ] 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': elif command == 'delete':
required_vars = [ 'instance_name' ] 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' ] 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': elif command == 'facts':
required_vars = [ 'instance_name' ] 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' ] 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': elif command == 'modify':
required_vars = [ 'instance_name' ] required_vars = [ 'instance_name' ]
if password: if password:
@ -378,11 +386,11 @@ def main():
for v in required_vars: for v in required_vars:
if not module.params.get(v): 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: for v in invalid_vars:
if module.params.get(v): 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 # Package up the optional parameters
params = {} params = {}

Loading…
Cancel
Save