summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.rst35
-rw-r--r--MANIFEST.in1
-rw-r--r--README.rst6
-rw-r--r--boto/__init__.py2
-rw-r--r--boto/ec2/connection.py46
-rw-r--r--boto/rds/__init__.py17
-rw-r--r--docs/source/index.rst1
-rw-r--r--docs/source/releasenotes/v2.19.0.rst24
-rw-r--r--tests/unit/ec2/test_connection.py57
-rw-r--r--tests/unit/rds/test_snapshot.py281
10 files changed, 422 insertions, 48 deletions
diff --git a/Changelog.rst b/Changelog.rst
deleted file mode 100644
index 46317b92..00000000
--- a/Changelog.rst
+++ /dev/null
@@ -1,35 +0,0 @@
-==============
-Change history
-==============
-
-.. contents::
- :local:
-
-.. _version-2.0:
-
-2.0
-===
-:release-date: 2011-07-14
-
-.. _v20-important:
-
-Important Notes
----------------
-
-* Backwards-incompatible filter changes in the latest 2011 EC2 APIs
-
- In the latest 2011 EC2 APIs all security groups are assigned a unique
- identifier (sg-\*). As a consequence, some existing filters which used to take
- the group name now require the group *id* instead:
-
- 1. *group-id* filter in DescribeInstances (ie get_all_instances())
-
- To filter by group name you must instead use the *group-name* filter
-
- 2. *launch.group-id* filter in DescribeSpotInstanceRequests (ie get_all_spot_instance_requests())
-
- Unfortunately for now, it is *not* possible to filter spot instance
- requests by group name; the security group id *must* be used instead.
-
- This new security group id can be found in the *id* attribute of a boto
- SecurityGroup instance.
diff --git a/MANIFEST.in b/MANIFEST.in
index d5e4f618..da3dfb3a 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,5 @@
include boto/cacerts/cacerts.txt
include README.rst
-include Changelog.rst
include boto/file/README
include .gitignore
include pylintrc
diff --git a/README.rst b/README.rst
index 1c15dea3..d58d89a2 100644
--- a/README.rst
+++ b/README.rst
@@ -1,9 +1,9 @@
####
boto
####
-boto 2.18.0
+boto 2.19.0
-Released: 22-November-2013
+Released: 27-November-2013
.. image:: https://travis-ci.org/boto/boto.png?branch=develop
:target: https://travis-ci.org/boto/boto
@@ -121,7 +121,7 @@ ChangeLogs
**********
To see what has changed over time in boto, you can check out the
-`release notes`_ in the wiki.
+release notes at `http://docs.pythonboto.org/en/latest/#release-notes`
***************************
Finding Out More About Boto
diff --git a/boto/__init__.py b/boto/__init__.py
index 6e41b110..6c0ae7eb 100644
--- a/boto/__init__.py
+++ b/boto/__init__.py
@@ -36,7 +36,7 @@ import logging.config
import urlparse
from boto.exception import InvalidUriError
-__version__ = '2.18.0'
+__version__ = '2.19.0'
Version = __version__ # for backware compatibility
UserAgent = 'Boto/%s Python/%s %s/%s' % (
diff --git a/boto/ec2/connection.py b/boto/ec2/connection.py
index 2b75fde2..5a656d10 100644
--- a/boto/ec2/connection.py
+++ b/boto/ec2/connection.py
@@ -70,7 +70,7 @@ from boto.exception import EC2ResponseError
class EC2Connection(AWSQueryConnection):
- APIVersion = boto.config.get('Boto', 'ec2_version', '2013-10-01')
+ APIVersion = boto.config.get('Boto', 'ec2_version', '2013-10-15')
DefaultRegionName = boto.config.get('Boto', 'ec2_region_name', 'us-east-1')
DefaultRegionEndpoint = boto.config.get('Boto', 'ec2_region_endpoint',
'ec2.us-east-1.amazonaws.com')
@@ -522,7 +522,8 @@ class EC2Connection(AWSQueryConnection):
# Instance methods
- def get_all_instances(self, instance_ids=None, filters=None, dry_run=False):
+ def get_all_instances(self, instance_ids=None, filters=None, dry_run=False,
+ max_results=None):
"""
Retrieve all the instance reservations associated with your account.
@@ -547,6 +548,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
+ :type max_results: int
+ :param max_results: The maximum number of paginated instance
+ items per response.
+
:rtype: list
:return: A list of :class:`boto.ec2.instance.Reservation`
@@ -555,10 +560,11 @@ class EC2Connection(AWSQueryConnection):
'replaced with get_all_reservations.'),
PendingDeprecationWarning)
return self.get_all_reservations(instance_ids=instance_ids,
- filters=filters, dry_run=dry_run)
+ filters=filters, dry_run=dry_run,
+ max_results=max_results)
def get_only_instances(self, instance_ids=None, filters=None,
- dry_run=False):
+ dry_run=False, max_results=None):
# A future release should rename this method to get_all_instances
# and make get_only_instances an alias for that.
"""
@@ -578,17 +584,22 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
+ :type max_results: int
+ :param max_results: The maximum number of paginated instance
+ items per response.
+
:rtype: list
:return: A list of :class:`boto.ec2.instance.Instance`
"""
reservations = self.get_all_reservations(instance_ids=instance_ids,
filters=filters,
- dry_run=dry_run)
+ dry_run=dry_run,
+ max_results=max_results)
return [instance for reservation in reservations
for instance in reservation.instances]
def get_all_reservations(self, instance_ids=None, filters=None,
- dry_run=False):
+ dry_run=False, max_results=None):
"""
Retrieve all the instance reservations associated with your account.
@@ -606,6 +617,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
+ :type max_results: int
+ :param max_results: The maximum number of paginated instance
+ items per response.
+
:rtype: list
:return: A list of :class:`boto.ec2.instance.Reservation`
"""
@@ -624,6 +639,8 @@ class EC2Connection(AWSQueryConnection):
self.build_filter_params(params, filters)
if dry_run:
params['DryRun'] = 'true'
+ if max_results is not None:
+ params['MaxResults'] = max_results
return self.get_list('DescribeInstances', params,
[('item', Reservation)], verb='POST')
@@ -1261,7 +1278,8 @@ class EC2Connection(AWSQueryConnection):
def get_spot_price_history(self, start_time=None, end_time=None,
instance_type=None, product_description=None,
- availability_zone=None, dry_run=False):
+ availability_zone=None, dry_run=False,
+ max_results=None):
"""
Retrieve the recent history of spot instances pricing.
@@ -1295,6 +1313,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
+ :type max_results: int
+ :param max_results: The maximum number of paginated items
+ per response.
+
:rtype: list
:return: A list tuples containing price and timestamp.
"""
@@ -1311,6 +1333,8 @@ class EC2Connection(AWSQueryConnection):
params['AvailabilityZone'] = availability_zone
if dry_run:
params['DryRun'] = 'true'
+ if max_results is not None:
+ params['MaxResults'] = max_results
return self.get_list('DescribeSpotPriceHistory', params,
[('item', SpotPriceHistory)], verb='POST')
@@ -3943,7 +3967,7 @@ class EC2Connection(AWSQueryConnection):
params['Tag.%d.Value'%i] = value
i += 1
- def get_all_tags(self, filters=None, dry_run=False):
+ def get_all_tags(self, filters=None, dry_run=False, max_results=None):
"""
Retrieve all the metadata tags associated with your account.
@@ -3960,6 +3984,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
+ :type max_results: int
+ :param max_results: The maximum number of paginated instance
+ items per response.
+
:rtype: list
:return: A list of :class:`boto.ec2.tag.Tag` objects
"""
@@ -3968,6 +3996,8 @@ class EC2Connection(AWSQueryConnection):
self.build_filter_params(params, filters)
if dry_run:
params['DryRun'] = 'true'
+ if max_results is not None:
+ params['MaxResults'] = max_results
return self.get_list('DescribeTags', params,
[('item', Tag)], verb='POST')
diff --git a/boto/rds/__init__.py b/boto/rds/__init__.py
index 1cf371eb..b4c9b68c 100644
--- a/boto/rds/__init__.py
+++ b/boto/rds/__init__.py
@@ -1084,6 +1084,23 @@ class RDSConnection(AWSQueryConnection):
params = {'DBSnapshotIdentifier': snapshot_id,
'DBInstanceIdentifier': dbinstance_id}
return self.get_object('CreateDBSnapshot', params, DBSnapshot)
+
+ def copy_dbsnapshot(self, source_snapshot_id, target_snapshot_id):
+ """
+ Copies the specified DBSnapshot.
+
+ :type source_snapshot_id: string
+ :param source_snapshot_id: The identifier for the source DB snapshot.
+
+ :type target_snapshot_id: string
+ :param target_snapshot_id: The identifier for the copied snapshot.
+
+ :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot`
+ :return: The newly created DBSnapshot.
+ """
+ params = {'SourceDBSnapshotIdentifier': source_snapshot_id,
+ 'TargetDBSnapshotIdentifier': target_snapshot_id}
+ return self.get_object('CopyDBSnapshot', params, DBSnapshot)
def delete_dbsnapshot(self, identifier):
"""
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 75ddae9b..d6f05db9 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -115,6 +115,7 @@ Release Notes
.. toctree::
:titlesonly:
+ releasenotes/v2.19.0
releasenotes/v2.18.0
releasenotes/v2.17.0
releasenotes/v2.16.0
diff --git a/docs/source/releasenotes/v2.19.0.rst b/docs/source/releasenotes/v2.19.0.rst
new file mode 100644
index 00000000..e67affbf
--- /dev/null
+++ b/docs/source/releasenotes/v2.19.0.rst
@@ -0,0 +1,24 @@
+boto v2.19.0
+============
+
+:date: 2013/11/27
+
+This release adds support for max result limits for Amazon EC2 calls, adds
+support for Amazon RDS database snapshot copies and fixes links to the
+changelog.
+
+
+Features
+--------
+* Add max results parameters to EC2 describe instances and describe tags.
+ (:issue:`1873`, :issue:`1873`, :sha:`ad8a64a`)
+* Add support for RDS CopyDBSnapshot. (:issue:`1872`, :issue:`1872`,
+ :issue:`1865`, :sha:`bffb758`)
+
+
+Bugfixes
+--------
+* Update README.rst to link to ReadTheDocs changelogs. (:issue:`1869`,
+ :sha:`26f3dbe`)
+* Delete the old changelog in favor of the README link to ReadTheDocs
+ changelogs. (:issue:`1870`, :issue:`1870`, :sha:`32bc333`)
diff --git a/tests/unit/ec2/test_connection.py b/tests/unit/ec2/test_connection.py
index 0546f4a7..0ae34013 100644
--- a/tests/unit/ec2/test_connection.py
+++ b/tests/unit/ec2/test_connection.py
@@ -1256,5 +1256,62 @@ class TestTerminateInstances(TestEC2ConnectionBase):
self.ec2.terminate_instances('foo')
+class TestDescribeInstances(TestEC2ConnectionBase):
+
+ def default_body(self):
+ return """
+ <DescribeInstancesResponse>
+ </DescribeInstancesResponse>
+ """
+
+ def test_default_behavior(self):
+ self.set_http_response(status_code=200)
+ self.ec2.get_all_instances()
+ self.assert_request_parameters({
+ 'Action': 'DescribeInstances'},
+ ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
+ 'SignatureVersion', 'Timestamp', 'Version'])
+
+ def test_max_results(self):
+ self.set_http_response(status_code=200)
+ self.ec2.get_all_instances(
+ max_results=10
+ )
+ self.assert_request_parameters({
+ 'Action': 'DescribeInstances',
+ 'MaxResults': 10},
+ ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
+ 'SignatureVersion', 'Timestamp', 'Version'])
+
+
+class TestDescribeTags(TestEC2ConnectionBase):
+
+ def default_body(self):
+ return """
+ <DescribeTagsResponse>
+ </DescribeTagsResponse>
+ """
+
+ def test_default_behavior(self):
+ self.set_http_response(status_code=200)
+ self.ec2.get_all_tags()
+ self.assert_request_parameters({
+ 'Action': 'DescribeTags'},
+ ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
+ 'SignatureVersion', 'Timestamp', 'Version'])
+
+ def test_max_results(self):
+ self.set_http_response(status_code=200)
+ self.ec2.get_all_tags(
+ max_results=10
+ )
+ self.assert_request_parameters({
+ 'Action': 'DescribeTags',
+ 'MaxResults': 10},
+ ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
+ 'SignatureVersion', 'Timestamp', 'Version'])
+
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/unit/rds/test_snapshot.py b/tests/unit/rds/test_snapshot.py
new file mode 100644
index 00000000..b350494f
--- /dev/null
+++ b/tests/unit/rds/test_snapshot.py
@@ -0,0 +1,281 @@
+from tests.unit import unittest
+from tests.unit import AWSMockServiceTestCase
+
+from boto.rds import RDSConnection
+from boto.rds.dbsnapshot import DBSnapshot
+from boto.rds import DBInstance
+
+
+class TestDescribeDBSnapshots(AWSMockServiceTestCase):
+ connection_class = RDSConnection
+
+ def default_body(self):
+ return """
+ <DescribeDBSnapshotsResponse xmlns="http://rds.amazonaws.com/doc/2013-05-15/">
+ <DescribeDBSnapshotsResult>
+ <DBSnapshots>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <SnapshotCreateTime>2011-05-23T06:29:03.483Z</SnapshotCreateTime>
+ <Engine>mysql</Engine>
+ <Status>available</Status>
+ <AvailabilityZone>us-east-1a</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2011-05-23T06:06:43.110Z</InstanceCreateTime>
+ <AllocatedStorage>10</AllocatedStorage>
+ <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
+ <EngineVersion>5.1.50</EngineVersion>
+ <DBSnapshotIdentifier>mydbsnapshot</DBSnapshotIdentifier>
+ <SnapshotType>manual</SnapshotType>
+ <MasterUsername>master</MasterUsername>
+ <OptionGroupName>myoptiongroupname</OptionGroupName>
+ </DBSnapshot>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <SnapshotCreateTime>2011-03-11T07:20:24.082Z</SnapshotCreateTime>
+ <Engine>mysql</Engine>
+ <Status>available</Status>
+ <AvailabilityZone>us-east-1a</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2010-08-04T23:27:36.420Z</InstanceCreateTime>
+ <AllocatedStorage>50</AllocatedStorage>
+ <DBInstanceIdentifier>mydbinstance</DBInstanceIdentifier>
+ <EngineVersion>5.1.49</EngineVersion>
+ <DBSnapshotIdentifier>mysnapshot1</DBSnapshotIdentifier>
+ <SnapshotType>manual</SnapshotType>
+ <MasterUsername>sa</MasterUsername>
+ <OptionGroupName>myoptiongroupname</OptionGroupName>
+ </DBSnapshot>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <SnapshotCreateTime>2012-04-02T00:01:24.082Z</SnapshotCreateTime>
+ <Engine>mysql</Engine>
+ <Status>available</Status>
+ <AvailabilityZone>us-east-1d</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2010-07-16T00:06:59.107Z</InstanceCreateTime>
+ <AllocatedStorage>60</AllocatedStorage>
+ <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
+ <EngineVersion>5.1.47</EngineVersion>
+ <DBSnapshotIdentifier>rds:simcoprod01-2012-04-02-00-01</DBSnapshotIdentifier>
+ <SnapshotType>automated</SnapshotType>
+ <MasterUsername>master</MasterUsername>
+ <OptionGroupName>myoptiongroupname</OptionGroupName>
+ </DBSnapshot>
+ </DBSnapshots>
+ </DescribeDBSnapshotsResult>
+ <ResponseMetadata>
+ <RequestId>c4191173-8506-11e0-90aa-eb648410240d</RequestId>
+ </ResponseMetadata>
+ </DescribeDBSnapshotsResponse>
+ """
+
+ def test_describe_dbinstances_by_instance(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.get_all_dbsnapshots(instance_id='simcoprod01')
+ self.assert_request_parameters({
+ 'Action': 'DescribeDBSnapshots',
+ 'DBInstanceIdentifier': 'simcoprod01'
+ }, ignore_params_values=['Version'])
+ self.assertEqual(len(response), 3)
+ self.assertIsInstance(response[0], DBSnapshot)
+ self.assertEqual(response[0].id, 'mydbsnapshot')
+ self.assertEqual(response[0].status, 'available')
+ self.assertEqual(response[0].instance_id, 'simcoprod01')
+
+
+class TestCreateDBSnapshot(AWSMockServiceTestCase):
+ connection_class = RDSConnection
+
+ def default_body(self):
+ return """
+ <CreateDBSnapshotResponse xmlns="http://rds.amazonaws.com/doc/2013-05-15/">
+ <CreateDBSnapshotResult>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <Engine>mysql</Engine>
+ <Status>creating</Status>
+ <AvailabilityZone>us-east-1a</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2011-05-23T06:06:43.110Z</InstanceCreateTime>
+ <AllocatedStorage>10</AllocatedStorage>
+ <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
+ <EngineVersion>5.1.50</EngineVersion>
+ <DBSnapshotIdentifier>mydbsnapshot</DBSnapshotIdentifier>
+ <SnapshotType>manual</SnapshotType>
+ <MasterUsername>master</MasterUsername>
+ </DBSnapshot>
+ </CreateDBSnapshotResult>
+ <ResponseMetadata>
+ <RequestId>c4181d1d-8505-11e0-90aa-eb648410240d</RequestId>
+ </ResponseMetadata>
+ </CreateDBSnapshotResponse>
+ """
+
+ def test_create_dbinstance(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.create_dbsnapshot('mydbsnapshot', 'simcoprod01')
+ self.assert_request_parameters({
+ 'Action': 'CreateDBSnapshot',
+ 'DBSnapshotIdentifier': 'mydbsnapshot',
+ 'DBInstanceIdentifier': 'simcoprod01'
+ }, ignore_params_values=['Version'])
+ self.assertIsInstance(response, DBSnapshot)
+ self.assertEqual(response.id, 'mydbsnapshot')
+ self.assertEqual(response.instance_id, 'simcoprod01')
+ self.assertEqual(response.status, 'creating')
+
+
+class TestCopyDBSnapshot(AWSMockServiceTestCase):
+ connection_class = RDSConnection
+
+ def default_body(self):
+ return """
+ <CopyDBSnapshotResponse xmlns="http://rds.amazonaws.com/doc/2013-05-15/">
+ <CopyDBSnapshotResult>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <Engine>mysql</Engine>
+ <Status>available</Status>
+ <AvailabilityZone>us-east-1a</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2011-05-23T06:06:43.110Z</InstanceCreateTime>
+ <AllocatedStorage>10</AllocatedStorage>
+ <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
+ <EngineVersion>5.1.50</EngineVersion>
+ <DBSnapshotIdentifier>mycopieddbsnapshot</DBSnapshotIdentifier>
+ <SnapshotType>manual</SnapshotType>
+ <MasterUsername>master</MasterUsername>
+ </DBSnapshot>
+ </CopyDBSnapshotResult>
+ <ResponseMetadata>
+ <RequestId>c4181d1d-8505-11e0-90aa-eb648410240d</RequestId>
+ </ResponseMetadata>
+ </CopyDBSnapshotResponse>
+ """
+
+ def test_copy_dbinstance(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.copy_dbsnapshot('myautomaticdbsnapshot', 'mycopieddbsnapshot')
+ self.assert_request_parameters({
+ 'Action': 'CopyDBSnapshot',
+ 'SourceDBSnapshotIdentifier': 'myautomaticdbsnapshot',
+ 'TargetDBSnapshotIdentifier': 'mycopieddbsnapshot'
+ }, ignore_params_values=['Version'])
+ self.assertIsInstance(response, DBSnapshot)
+ self.assertEqual(response.id, 'mycopieddbsnapshot')
+ self.assertEqual(response.status, 'available')
+
+
+class TestDeleteDBSnapshot(AWSMockServiceTestCase):
+ connection_class = RDSConnection
+
+ def default_body(self):
+ return """
+ <DeleteDBSnapshotResponse xmlns="http://rds.amazonaws.com/doc/2013-05-15/">
+ <DeleteDBSnapshotResult>
+ <DBSnapshot>
+ <Port>3306</Port>
+ <SnapshotCreateTime>2011-03-11T07:20:24.082Z</SnapshotCreateTime>
+ <Engine>mysql</Engine>
+ <Status>deleted</Status>
+ <AvailabilityZone>us-east-1d</AvailabilityZone>
+ <LicenseModel>general-public-license</LicenseModel>
+ <InstanceCreateTime>2010-07-16T00:06:59.107Z</InstanceCreateTime>
+ <AllocatedStorage>60</AllocatedStorage>
+ <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
+ <EngineVersion>5.1.47</EngineVersion>
+ <DBSnapshotIdentifier>mysnapshot2</DBSnapshotIdentifier>
+ <SnapshotType>manual</SnapshotType>
+ <MasterUsername>master</MasterUsername>
+ </DBSnapshot>
+ </DeleteDBSnapshotResult>
+ <ResponseMetadata>
+ <RequestId>627a43a1-8507-11e0-bd9b-a7b1ece36d51</RequestId>
+ </ResponseMetadata>
+ </DeleteDBSnapshotResponse>
+ """
+
+ def test_delete_dbinstance(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.delete_dbsnapshot('mysnapshot2')
+ self.assert_request_parameters({
+ 'Action': 'DeleteDBSnapshot',
+ 'DBSnapshotIdentifier': 'mysnapshot2'
+ }, ignore_params_values=['Version'])
+ self.assertIsInstance(response, DBSnapshot)
+ self.assertEqual(response.id, 'mysnapshot2')
+ self.assertEqual(response.status, 'deleted')
+
+
+class TestRestoreDBInstanceFromDBSnapshot(AWSMockServiceTestCase):
+ connection_class = RDSConnection
+
+ def default_body(self):
+ return """
+ <RestoreDBInstanceFromDBSnapshotResponse xmlns="http://rds.amazonaws.com/doc/2013-05-15/">
+ <RestoreDBInstanceFromDBSnapshotResult>
+ <DBInstance>
+ <ReadReplicaDBInstanceIdentifiers/>
+ <Engine>mysql</Engine>
+ <PendingModifiedValues/>
+ <BackupRetentionPeriod>1</BackupRetentionPeriod>
+ <MultiAZ>false</MultiAZ>
+ <LicenseModel>general-public-license</LicenseModel>
+ <DBInstanceStatus>creating</DBInstanceStatus>
+ <EngineVersion>5.1.50</EngineVersion>
+ <DBInstanceIdentifier>myrestoreddbinstance</DBInstanceIdentifier>
+ <DBParameterGroups>
+ <DBParameterGroup>
+ <ParameterApplyStatus>in-sync</ParameterApplyStatus>
+ <DBParameterGroupName>default.mysql5.1</DBParameterGroupName>
+ </DBParameterGroup>
+ </DBParameterGroups>
+ <DBSecurityGroups>
+ <DBSecurityGroup>
+ <Status>active</Status>
+ <DBSecurityGroupName>default</DBSecurityGroupName>
+ </DBSecurityGroup>
+ </DBSecurityGroups>
+ <PreferredBackupWindow>00:00-00:30</PreferredBackupWindow>
+ <AutoMinorVersionUpgrade>true</AutoMinorVersionUpgrade>
+ <PreferredMaintenanceWindow>sat:07:30-sat:08:00</PreferredMaintenanceWindow>
+ <AllocatedStorage>10</AllocatedStorage>
+ <DBInstanceClass>db.m1.large</DBInstanceClass>
+ <MasterUsername>master</MasterUsername>
+ </DBInstance>
+ </RestoreDBInstanceFromDBSnapshotResult>
+ <ResponseMetadata>
+ <RequestId>7ca622e8-8508-11e0-bd9b-a7b1ece36d51</RequestId>
+ </ResponseMetadata>
+ </RestoreDBInstanceFromDBSnapshotResponse>
+ """
+
+ def test_restore_dbinstance_from_dbsnapshot(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.restore_dbinstance_from_dbsnapshot('mydbsnapshot',
+ 'myrestoreddbinstance',
+ 'db.m1.large',
+ '3306',
+ 'us-east-1a',
+ 'false',
+ 'true')
+ self.assert_request_parameters({
+ 'Action': 'RestoreDBInstanceFromDBSnapshot',
+ 'DBSnapshotIdentifier': 'mydbsnapshot',
+ 'DBInstanceIdentifier': 'myrestoreddbinstance',
+ 'DBInstanceClass': 'db.m1.large',
+ 'Port': '3306',
+ 'AvailabilityZone': 'us-east-1a',
+ 'MultiAZ': 'false',
+ 'AutoMinorVersionUpgrade': 'true'
+ }, ignore_params_values=['Version'])
+ self.assertIsInstance(response, DBInstance)
+ self.assertEqual(response.id, 'myrestoreddbinstance')
+ self.assertEqual(response.status, 'creating')
+ self.assertEqual(response.instance_class, 'db.m1.large')
+ self.assertEqual(response.multi_az, False)
+
+
+if __name__ == '__main__':
+ unittest.main()