You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/01 00:54:25 UTC
[1/2] libcloud git commit: Add method to modify snapshot attribute
for EC2
Repository: libcloud
Updated Branches:
refs/heads/trunk c4cfea6e1 -> 17fe85b04
Add method to modify snapshot attribute for EC2
Signed-off-by: Sayan Chowdhury <sa...@gmail.com>
Closes #990
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ebcfed52
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ebcfed52
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ebcfed52
Branch: refs/heads/trunk
Commit: ebcfed52becef9bf0f8705b39c6b0959db283f0b
Parents: c4cfea6
Author: Sayan Chowdhury <sa...@gmail.com>
Authored: Wed Feb 22 17:17:45 2017 +0530
Committer: Anthony Shaw <an...@apache.org>
Committed: Sat Apr 1 11:53:28 2017 +1100
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 24 ++++++++++++++++++++
.../fixtures/ec2/modify_snapshot_attribute.xml | 4 ++++
libcloud/test/compute/test_ec2.py | 12 ++++++++++
3 files changed, 40 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebcfed52/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 61e6344..f376854 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -4794,6 +4794,30 @@ class BaseEC2NodeDriver(NodeDriver):
return self._get_boolean(res)
+ def ex_modify_snapshot_attribute(self, snapshot, attributes):
+ """
+ Modify Snapshot attributes.
+
+ :param snapshot: VolumeSnapshot instance
+ :type snanpshot: :class:`VolumeSnapshot`
+
+ :param attributes: Dictionary with snapshot attributes
+ :type attributes: ``dict``
+
+ :return: True on success, False otherwise.
+ :rtype: ``bool``
+ """
+ attributes = attributes or {}
+ attributes.update({'SnapshotId': snapshot.id})
+
+ params = {'Action': 'ModifySnapshotAttribute'}
+ params.update(attributes)
+
+ res = self.connection.request(self.path,
+ params=params.copy()).object
+
+ return self._get_boolean(res)
+
def ex_modify_image_attribute(self, image, attributes):
"""
Modify image attributes.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebcfed52/libcloud/test/compute/fixtures/ec2/modify_snapshot_attribute.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ec2/modify_snapshot_attribute.xml b/libcloud/test/compute/fixtures/ec2/modify_snapshot_attribute.xml
new file mode 100644
index 0000000..e812ea4
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ec2/modify_snapshot_attribute.xml
@@ -0,0 +1,4 @@
+<ModifySnapshotAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
+ <return>true</return>
+</ModifySnapshotAttributeResponse>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebcfed52/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 191cbf7..659d669 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -934,6 +934,14 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
resp = self.driver.ex_modify_image_attribute(image, data)
self.assertTrue(resp)
+ def test_ex_modify_snapshot_attribute(self):
+ snap = VolumeSnapshot(id='snap-1234567890abcdef0',
+ size=10, driver=self.driver)
+
+ data = {'CreateVolumePermission.Add.1.Group': 'all'}
+ resp = self.driver.ex_modify_snapshot_attribute(snap, data)
+ self.assertTrue(resp)
+
def test_create_node_ex_security_groups(self):
EC2MockHttp.type = 'ex_security_groups'
@@ -1402,6 +1410,10 @@ class EC2MockHttp(MockHttpTestCase):
body = self.fixtures.load('modify_instance_attribute.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _ModifySnapshotAttribute(self, method, url, body, headers):
+ body = self.fixtures.load('modify_snapshot_attribute.xml')
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _idempotent_CreateTags(self, method, url, body, headers):
body = self.fixtures.load('create_tags.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
[2/2] libcloud git commit: changes for #990
Posted by an...@apache.org.
changes for #990
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/17fe85b0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/17fe85b0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/17fe85b0
Branch: refs/heads/trunk
Commit: 17fe85b044f120b80004c2d35555edb50c15911f
Parents: ebcfed5
Author: Anthony Shaw <an...@apache.org>
Authored: Sat Apr 1 11:54:19 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Sat Apr 1 11:54:19 2017 +1100
----------------------------------------------------------------------
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/17fe85b0/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 1631733..21c8d42 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -8,6 +8,10 @@ Changes in latest version of Apache Libcloud
Compute
~~~~~~~
+- [EC2] Add method to modify snapshot attribute for EC2
+ [GITHUB-990]
+ (Sayan Chowdhury)
+
- [Linode] Add start, stop instance methods and fix incorrect state TERMINATED to STOPPED
[GITHUB-986]
(Markos Gogoulos)