From 850b15d849f43918db49d0b848f74b4feec7e0f0 Mon Sep 17 00:00:00 2001 From: Chris Henry Date: Mon, 26 Jan 2015 13:33:46 -0500 Subject: [PATCH] Add a to_json method to SubnetGroup. --- moto/rds2/models.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/moto/rds2/models.py b/moto/rds2/models.py index ad2f9b3f1..846d070ab 100644 --- a/moto/rds2/models.py +++ b/moto/rds2/models.py @@ -339,6 +339,29 @@ class SubnetGroup(object): """) return template.render(subnet_group=self) + def to_json(self): + template = Template("""{ + "DBSubnetGroup": { + "VpcId": "{{ subnet_group.vpc_id }}", + "SubnetGroupStatus": "{{ subnet_group.status }}", + "DBSubnetGroupDescription": "{{ subnet_group.description }}", + "DBSubnetGroupName": "{{ subnet_group.subnet_name }}", + "Subnets": { + "Subnet": [ + {% for subnet in subnet_group.subnets %}{ + "SubnetStatus": "Active", + "SubnetIdentifier": "{{ subnet.id }}", + "SubnetAvailabilityZone": { + "Name": "{{ subnet.availability_zone }}", + "ProvisionedIopsCapable": "false" + } + }{%- if not loop.last -%},{%- endif -%}{% endfor %} + ] + } + } + }""") + return template.render(subnet_group=self) + @classmethod def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name): properties = cloudformation_json['Properties']