Merge #913.
This commit is contained in:
parent
408a70992c
commit
0adebeed24
36 changed files with 669 additions and 58 deletions
|
|
@ -7,6 +7,7 @@ import boto.rds2
|
|||
from jinja2 import Template
|
||||
from re import compile as re_compile
|
||||
from moto.cloudformation.exceptions import UnformattedGetAttTemplateException
|
||||
from moto.compat import OrderedDict
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core.utils import get_random_hex
|
||||
from moto.ec2.models import ec2_backends
|
||||
|
|
@ -586,7 +587,7 @@ class RDS2Backend(BaseBackend):
|
|||
self.region = region
|
||||
self.arn_regex = re_compile(
|
||||
r'^arn:aws:rds:.*:[0-9]*:(db|es|og|pg|ri|secgrp|snapshot|subgrp):.*$')
|
||||
self.databases = {}
|
||||
self.databases = OrderedDict()
|
||||
self.db_parameter_groups = {}
|
||||
self.option_groups = {}
|
||||
self.security_groups = {}
|
||||
|
|
|
|||
|
|
@ -114,9 +114,21 @@ class RDS2Response(BaseResponse):
|
|||
|
||||
def describe_db_instances(self):
|
||||
db_instance_identifier = self._get_param('DBInstanceIdentifier')
|
||||
databases = self.backend.describe_databases(db_instance_identifier)
|
||||
all_instances = list(self.backend.describe_databases(db_instance_identifier))
|
||||
marker = self._get_param('Marker')
|
||||
all_ids = [instance.db_instance_identifier for instance in all_instances]
|
||||
if marker:
|
||||
start = all_ids.index(marker) + 1
|
||||
else:
|
||||
start = 0
|
||||
page_size = self._get_param('MaxRecords', 50) # the default is 100, but using 50 to make testing easier
|
||||
instances_resp = all_instances[start:start + page_size]
|
||||
next_marker = None
|
||||
if len(all_instances) > start + page_size:
|
||||
next_marker = instances_resp[-1].db_instance_identifier
|
||||
|
||||
template = self.response_template(DESCRIBE_DATABASES_TEMPLATE)
|
||||
return template.render(databases=databases)
|
||||
return template.render(databases=instances_resp, marker=next_marker)
|
||||
|
||||
def modify_db_instance(self):
|
||||
db_instance_identifier = self._get_param('DBInstanceIdentifier')
|
||||
|
|
@ -348,6 +360,9 @@ DESCRIBE_DATABASES_TEMPLATE = """<DescribeDBInstancesResponse xmlns="http://rds.
|
|||
{{ database.to_xml() }}
|
||||
{%- endfor -%}
|
||||
</DBInstances>
|
||||
{% if marker %}
|
||||
<Marker>{{ marker }}</Marker>
|
||||
{% endif %}
|
||||
</DescribeDBInstancesResult>
|
||||
<ResponseMetadata>
|
||||
<RequestId>523e3218-afc7-11c3-90f5-f90431260ab4</RequestId>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue