add support for RDS ModifyDBSubnetGroup (#4125)
This commit is contained in:
parent
9bd38f8480
commit
013e3462aa
@ -422,6 +422,8 @@ class BaseResponse(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
|
||||
|
||||
@staticmethod
|
||||
def _send_response(headers, response):
|
||||
if response is None:
|
||||
response = "", {}
|
||||
if len(response) == 2:
|
||||
body, new_headers = response
|
||||
else:
|
||||
|
@ -1029,6 +1029,16 @@ class RDS2Backend(BaseBackend):
|
||||
raise DBSubnetGroupNotFoundError(subnet_group_name)
|
||||
return self.subnet_groups.values()
|
||||
|
||||
def modify_db_subnet_group(self, subnet_name, description, subnets):
|
||||
subnet_group = self.subnet_groups.pop(subnet_name)
|
||||
if not subnet_group:
|
||||
raise DBSubnetGroupNotFoundError(subnet_name)
|
||||
subnet_group.subnet_name = subnet_name
|
||||
subnet_group.subnets = subnets
|
||||
if description is not None:
|
||||
subnet_group.description = description
|
||||
return subnet_group
|
||||
|
||||
def delete_subnet_group(self, subnet_name):
|
||||
if subnet_name in self.subnet_groups:
|
||||
return self.subnet_groups.pop(subnet_name)
|
||||
|
@ -281,6 +281,19 @@ class RDS2Response(BaseResponse):
|
||||
template = self.response_template(DESCRIBE_SUBNET_GROUPS_TEMPLATE)
|
||||
return template.render(subnet_groups=subnet_groups)
|
||||
|
||||
def modify_db_subnet_group(self):
|
||||
subnet_name = self._get_param("DBSubnetGroupName")
|
||||
description = self._get_param("DBSubnetGroupDescription")
|
||||
subnet_ids = self._get_multi_param("SubnetIds.SubnetIdentifier")
|
||||
subnets = [
|
||||
ec2_backends[self.region].get_subnet(subnet_id) for subnet_id in subnet_ids
|
||||
]
|
||||
subnet_group = self.backend.modify_db_subnet_group(
|
||||
subnet_name, description, subnets
|
||||
)
|
||||
template = self.response_template(MODIFY_SUBNET_GROUPS_TEMPLATE)
|
||||
return template.render(subnet_group=subnet_group)
|
||||
|
||||
def delete_db_subnet_group(self):
|
||||
subnet_name = self._get_param("DBSubnetGroupName")
|
||||
subnet_group = self.backend.delete_subnet_group(subnet_name)
|
||||
@ -588,6 +601,15 @@ DESCRIBE_SUBNET_GROUPS_TEMPLATE = """<DescribeDBSubnetGroupsResponse xmlns="http
|
||||
</ResponseMetadata>
|
||||
</DescribeDBSubnetGroupsResponse>"""
|
||||
|
||||
MODIFY_SUBNET_GROUPS_TEMPLATE = """<ModifyDBSubnetGroupResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/">
|
||||
<ModifyDBSubnetGroupResult>
|
||||
{{ subnet_group.to_xml() }}
|
||||
</ModifyDBSubnetGroupResult>
|
||||
<ResponseMetadata>
|
||||
<RequestId>b783db3b-b98c-11d3-fbc7-5c0aad74da7c</RequestId>
|
||||
</ResponseMetadata>
|
||||
</ModifyDBSubnetGroupResponse>"""
|
||||
|
||||
DELETE_SUBNET_GROUP_TEMPLATE = """<DeleteDBSubnetGroupResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/">
|
||||
<ResponseMetadata>
|
||||
<RequestId>13785dd5-a7fc-11e4-bb9c-7f371d0859b0</RequestId>
|
||||
|
Loading…
Reference in New Issue
Block a user