diff --git a/boto/ec2/connection.py b/boto/ec2/connection.py index 5af71b2c14..6ec1013f73 100644 --- a/boto/ec2/connection.py +++ b/boto/ec2/connection.py @@ -2205,17 +2205,17 @@ def get_all_snapshots(self, snapshot_ids=None, present, only the Snapshots associated with these snapshot ids will be returned. - :type owner: str - :param owner: If present, only the snapshots owned by the specified user + :type owner: str or list + :param owner: If present, only the snapshots owned by the specified user(s) will be returned. Valid values are: * self * amazon * AWS Account ID - :type restorable_by: str + :type restorable_by: str or list :param restorable_by: If present, only the snapshots that are restorable - by the specified account id will be returned. + by the specified account id(s) will be returned. :type filters: dict :param filters: Optional filters that can be used to limit @@ -2236,10 +2236,11 @@ def get_all_snapshots(self, snapshot_ids=None, params = {} if snapshot_ids: self.build_list_params(params, snapshot_ids, 'SnapshotId') + if owner: - params['Owner'] = owner + self.build_list_params(params, owner, 'Owner') if restorable_by: - params['RestorableBy'] = restorable_by + self.build_list_params(params, restorable_by, 'RestorableBy') if filters: self.build_filter_params(params, filters) if dry_run: diff --git a/tests/unit/ec2/test_snapshot.py b/tests/unit/ec2/test_snapshot.py new file mode 100644 index 0000000000..55dc46590a --- /dev/null +++ b/tests/unit/ec2/test_snapshot.py @@ -0,0 +1,59 @@ +from tests.unit import AWSMockServiceTestCase + +from boto.ec2.connection import EC2Connection +from boto.ec2.snapshot import Snapshot + + +class TestDescribeSnapshots(AWSMockServiceTestCase): + + connection_class = EC2Connection + + def default_body(self): + return """ + + 59dbff89-35bd-4eac-99ed-be587EXAMPLE + + + snap-1a2b3c4d + vol-1a2b3c4d + pending + YYYY-MM-DDTHH:MM:SS.SSSZ + 30% + 111122223333 + 15 + Daily Backup + + + Purpose + demo_db_14_backup + + + + + + """ + + def test_cancel_spot_instance_requests(self): + self.set_http_response(status_code=200) + response = self.service_connection.get_all_snapshots(['snap-1a2b3c4d', 'snap-9f8e7d6c'], + owner=['self', '111122223333'], + restorable_by='999988887777', + filters={'status': 'pending', + 'tag-value': '*db_*'}) + self.assert_request_parameters({ + 'Action': 'DescribeSnapshots', + 'SnapshotId.1': 'snap-1a2b3c4d', + 'SnapshotId.2': 'snap-9f8e7d6c', + 'Owner.1': 'self', + 'Owner.2': '111122223333', + 'RestorableBy.1': '999988887777', + 'Filter.1.Name': 'status', + 'Filter.1.Value.1': 'pending', + 'Filter.2.Name': 'tag-value', + 'Filter.2.Value.1': '*db_*'}, + ignore_params_values=['AWSAccessKeyId', 'SignatureMethod', + 'SignatureVersion', 'Timestamp', + 'Version']) + self.assertEqual(len(response), 1) + self.assertIsInstance(response[0], Snapshot) + self.assertEqual(response[0].id, 'snap-1a2b3c4d')