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/21 05:42:53 UTC
[06/16] libcloud git commit: added ex_describe_volume_modifications()
method
added ex_describe_volume_modifications() method
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/aecad3ca
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/aecad3ca
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/aecad3ca
Branch: refs/heads/trunk
Commit: aecad3ca967bd36b904c11f63951fb9c89fdcc9b
Parents: 27fef81
Author: Hennadii Stas <ut...@gmail.com>
Authored: Wed Mar 29 16:43:28 2017 +0300
Committer: Hennadii Stas <ut...@gmail.com>
Committed: Thu Apr 20 13:03:28 2017 +0300
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 58 +++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/aecad3ca/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index f7de3f4..f3775df 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -5623,7 +5623,7 @@ class BaseEC2NodeDriver(NodeDriver):
def ex_modify_volume(self, volume, parameters):
"""
Modify volume parameters.
- A list of valid parameters can be found at https://goo.gl/N0rPEQ
+ A list of valid parameters can be found at https://goo.gl/N0rPEQ
:param Volume: Volume instance
:type Volume: :class:`Volume`
@@ -5646,6 +5646,57 @@ class BaseEC2NodeDriver(NodeDriver):
params=parameters.copy()).object
return self._to_volume_modification(response)
+ def ex_describe_volumes_modifications(self, dry_run=False, volume_ids=None,
+ filters=None, next_token=None,
+ max_results=None):
+ """
+ Describes one or more of your volume modifications.
+
+ :param dry_run: dry_run
+ :type dry_run: ``bool``
+
+ :param volume_ids: The volume_ids so that the response includes
+ information for only said volumes
+ :type volume_ids: ``dict``
+
+ :param filters: The filters so that the response includes
+ information for only certain volumes
+ :type filters: ``dict``
+
+ :param max_results: The maximum number of items that can be
+ returned in a single page
+ :type max_results: ``int``
+
+ :param next_token: The nextToken value returned by a previous paginated request.
+ :type next_token: ``string``
+
+ :return: List of volume modification status objects
+ :rtype: ``list`` of :class:`VolumeModification
+ """
+
+ if next_token:
+ raise NotImplementedError(
+ 'volume_modifications next_token is not implemented')
+
+ params = {'Action': 'DescribeVolumesModifications'}
+
+ if dry_run:
+ params.update({'DryRun': dry_run})
+
+ if volume_ids:
+ params.update({'VolumeIds': volume_ids})
+
+ if filters:
+ params.update(self._build_filters(filters))
+
+ if max_results:
+ params.update({'MaxResults': max_results})
+
+ response = self.connection.request(self.path, params=params,
+ method='GET').object
+
+ return self._to_volume_modifications(response)
+
def _ex_connection_class_kwargs(self):
kwargs = super(BaseEC2NodeDriver, self)._ex_connection_class_kwargs()
if hasattr(self, 'token') and self.token is not None:
@@ -5774,6 +5825,11 @@ class BaseEC2NodeDriver(NodeDriver):
state=state,
extra=extra)
+ def _to_volume_modifications(self, object):
+ return [self._to_volume_modification(el) for el in object.findall(
+ fixxpath(xpath='volumeModificationSet/item', namespace=NAMESPACE))
+ ]
+
def _to_volume_modification(self, element):
"""
Parse the XML element and return a StorageVolume object.