Started implementing modify_option_group.
This commit is contained in:
parent
a43b002c3a
commit
dfb33aaad3
@ -452,7 +452,9 @@ class RDS2Backend(BaseBackend):
|
|||||||
'sqlserver-se': ['10.50', '11.00'],
|
'sqlserver-se': ['10.50', '11.00'],
|
||||||
'sqlserver-ee': ['10.50', '11.00']
|
'sqlserver-ee': ['10.50', '11.00']
|
||||||
}
|
}
|
||||||
|
if option_group_kwargs['name'] in self.option_groups:
|
||||||
|
raise RDSClientError('OptionGroupAlreadyExistsFault',
|
||||||
|
'An option group named {} already exists.'.format(option_group_kwargs['name']))
|
||||||
if 'description' not in option_group_kwargs or not option_group_kwargs['description']:
|
if 'description' not in option_group_kwargs or not option_group_kwargs['description']:
|
||||||
raise RDSClientError('InvalidParameterValue',
|
raise RDSClientError('InvalidParameterValue',
|
||||||
'The parameter OptionGroupDescription must be provided and must not be blank.')
|
'The parameter OptionGroupDescription must be provided and must not be blank.')
|
||||||
@ -535,6 +537,19 @@ class RDS2Backend(BaseBackend):
|
|||||||
return default_option_group_options[engine_name][major_engine_version]
|
return default_option_group_options[engine_name][major_engine_version]
|
||||||
return default_option_group_options[engine_name]['all']
|
return default_option_group_options[engine_name]['all']
|
||||||
|
|
||||||
|
def modify_option_group(self, option_group_name, options_to_include=None, options_to_remove=None, apply_immediately=None):
|
||||||
|
if option_group_name not in self.option_groups:
|
||||||
|
raise RDSClientError('OptionGroupNotFoundFault',
|
||||||
|
'Specified OptionGroupName: {} not found.'.format(option_group_name))
|
||||||
|
if not options_to_include and not options_to_remove:
|
||||||
|
raise RDSClientError('InvalidParameterValue',
|
||||||
|
'At least one option must be added, modified, or removed.')
|
||||||
|
if options_to_remove:
|
||||||
|
self.option_groups[option_group_name].remove_options(options_to_remove)
|
||||||
|
if options_to_include:
|
||||||
|
self.option_groups[option_group_name].add_options(options_to_include)
|
||||||
|
return ['a']
|
||||||
|
|
||||||
|
|
||||||
class OptionGroup(object):
|
class OptionGroup(object):
|
||||||
def __init__(self, name, engine_name, major_engine_version, description=None):
|
def __init__(self, name, engine_name, major_engine_version, description=None):
|
||||||
@ -558,6 +573,12 @@ class OptionGroup(object):
|
|||||||
}""")
|
}""")
|
||||||
return template.render(option_group=self)
|
return template.render(option_group=self)
|
||||||
|
|
||||||
|
def remove_options(self, options_to_remove):
|
||||||
|
return
|
||||||
|
|
||||||
|
def add_options(self, options_to_add):
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class OptionGroupOption(object):
|
class OptionGroupOption(object):
|
||||||
def __init__(self, engine_name, major_engine_version):
|
def __init__(self, engine_name, major_engine_version):
|
||||||
|
@ -185,6 +185,32 @@ class RDS2Response(BaseResponse):
|
|||||||
option_group_options = self.backend.describe_option_group_options(engine_name, major_engine_version)
|
option_group_options = self.backend.describe_option_group_options(engine_name, major_engine_version)
|
||||||
return option_group_options
|
return option_group_options
|
||||||
|
|
||||||
|
def modify_option_group(self):
|
||||||
|
option_group_name = self._get_param('OptionGroupName')
|
||||||
|
count = 1
|
||||||
|
options_to_include = []
|
||||||
|
while self._get_param('OptionsToInclude.member.{}.OptionName'.format(count)):
|
||||||
|
options_to_include.append({
|
||||||
|
'Port': self._get_param('OptionsToInclude.member.{}.Port'.format(count)),
|
||||||
|
'OptionName': self._get_param('OptionsToInclude.member.{}.OptionName'.format(count)),
|
||||||
|
'DBSecurityGroupMemberships': self._get_param('OptionsToInclude.member.{}.DBSecurityGroupMemberships'.format(count)),
|
||||||
|
'OptionSettings': self._get_param('OptionsToInclude.member.{}.OptionSettings'.format(count)),
|
||||||
|
'VpcSecurityGroupMemberships': self._get_param('OptionsToInclude.member.{}.VpcSecurityGroupMemberships'.format(count))
|
||||||
|
})
|
||||||
|
count += 1
|
||||||
|
count = 1
|
||||||
|
options_to_remove = []
|
||||||
|
while self._get_param('OptionsToRemove.member.{}'.format(count)):
|
||||||
|
options_to_remove.append(self._get_param('OptionsToRemove.member.{}'.format(count)))
|
||||||
|
count += 1
|
||||||
|
apply_immediately = self._get_param('ApplyImmediately')
|
||||||
|
result = self.backend.modify_option_group(option_group_name,
|
||||||
|
options_to_include,
|
||||||
|
options_to_remove,
|
||||||
|
apply_immediately)
|
||||||
|
return json.dumps('{"DescribeOptionGroupOptionsResponse": {"DescribeOptionGroupOptionsResult": {"Marker": null, "OptionGroupOptions": [{"MinimumRequiredMinorEngineVersion": "2789.0.v1", "OptionsDependedOn": [], "MajorEngineVersion": "10.50", "Persistent": false, "DefaultPort": null, "Permanent": false, "OptionGroupOptionSettings": [], "EngineName": "sqlserver-ee", "Name": "Mirroring", "PortRequired": false, "Description": "SQLServer Database Mirroring"}, {"MinimumRequiredMinorEngineVersion": "2789.0.v1", "OptionsDependedOn": [], "MajorEngineVersion": "10.50", "Persistent": true, "DefaultPort": null, "Permanent": false, "OptionGroupOptionSettings": [], "EngineName": "sqlserver-ee", "Name": "TDE", "PortRequired": false, "Description": "SQL Server - Transparent Data Encryption"}, {"MinimumRequiredMinorEngineVersion": "2100.60.v1", "OptionsDependedOn": [], "MajorEngineVersion": "11.00", "Persistent": false, "DefaultPort": null, "Permanent": false, "OptionGroupOptionSettings": [], "EngineName": "sqlserver-ee", "Name": "Mirroring", "PortRequired": false, "Description": "SQLServer Database Mirroring"}, {"MinimumRequiredMinorEngineVersion": "2100.60.v1", "OptionsDependedOn": [], "MajorEngineVersion": "11.00", "Persistent": true, "DefaultPort": null, "Permanent": false, "OptionGroupOptionSettings": [], "EngineName": "sqlserver-ee", "Name": "TDE", "PortRequired": false, "Description": "SQL Server - Transparent Data Encryption"}]}, "ResponseMetadata": {"RequestId": "c9f2fd9b-9fcb-11e4-8add-31b6fe33145f"}}}')
|
||||||
|
|
||||||
|
|
||||||
CREATE_DATABASE_TEMPLATE = """{
|
CREATE_DATABASE_TEMPLATE = """{
|
||||||
"CreateDBInstanceResponse": {
|
"CreateDBInstanceResponse": {
|
||||||
"CreateDBInstanceResult": {
|
"CreateDBInstanceResult": {
|
||||||
|
@ -91,6 +91,13 @@ def test_create_option_group_empty_description():
|
|||||||
conn.create_option_group.when.called_with('test', 'mysql', '5.6', '').should.throw(BotoServerError)
|
conn.create_option_group.when.called_with('test', 'mysql', '5.6', '').should.throw(BotoServerError)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_rds2
|
||||||
|
def test_create_option_group_duplicate():
|
||||||
|
conn = boto.rds2.connect_to_region("us-west-2")
|
||||||
|
conn.create_option_group('test', 'mysql', '5.6', 'test option group')
|
||||||
|
conn.create_option_group.when.called_with('test', 'mysql', '5.6', 'foo').should.throw(BotoServerError)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds2
|
||||||
def test_describe_option_group():
|
def test_describe_option_group():
|
||||||
conn = boto.rds2.connect_to_region("us-west-2")
|
conn = boto.rds2.connect_to_region("us-west-2")
|
||||||
@ -133,6 +140,26 @@ def test_describe_option_group_options():
|
|||||||
conn.describe_option_group_options.when.called_with('non-existent').should.throw(BotoServerError)
|
conn.describe_option_group_options.when.called_with('non-existent').should.throw(BotoServerError)
|
||||||
conn.describe_option_group_options.when.called_with('mysql', 'non-existent').should.throw(BotoServerError)
|
conn.describe_option_group_options.when.called_with('mysql', 'non-existent').should.throw(BotoServerError)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_rds2
|
||||||
|
def test_modify_option_group():
|
||||||
|
conn = boto.rds2.connect_to_region("us-west-2")
|
||||||
|
# if Someone can tell me how the hell to use this function I can finish coding this.
|
||||||
|
|
||||||
|
|
||||||
|
@mock_rds2
|
||||||
|
def test_modify_option_group_no_options():
|
||||||
|
conn = boto.rds2.connect_to_region("us-west-2")
|
||||||
|
conn.create_option_group('test', 'mysql', '5.6', 'test option group')
|
||||||
|
conn.modify_option_group.when.called_with('test').should.throw(BotoServerError)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_rds2
|
||||||
|
def test_modify_non_existant_option_group():
|
||||||
|
conn = boto.rds2.connect_to_region("us-west-2")
|
||||||
|
conn.modify_option_group.when.called_with('non-existant', [('OptionName', 'Port', 'DBSecurityGroupMemberships', 'VpcSecurityGroupMemberships', 'OptionSettings')]).should.throw(BotoServerError)
|
||||||
|
|
||||||
|
|
||||||
#@disable_on_py3()
|
#@disable_on_py3()
|
||||||
#@mock_rds2
|
#@mock_rds2
|
||||||
#def test_delete_database():
|
#def test_delete_database():
|
||||||
|
Loading…
Reference in New Issue
Block a user