This repository has been archived by the owner on Apr 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing calls: -- create -- all snapshots section
- Loading branch information
Showing
5 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
``blockstorage`` --- Rackspace Cloud Block Storage | ||
================================================== | ||
|
||
.. automodule:: vaporize.volumes | ||
|
||
``Volume`` --- Volumes | ||
---------------------- | ||
.. autoclass:: Volume | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ API | |
domains | ||
loadbalancers | ||
servers | ||
blockstorage | ||
|
||
Indices and tables | ||
================== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from vaporize.core import get_url, handle_request | ||
from vaporize.utils import DotDict | ||
|
||
|
||
class Volume(DotDict): | ||
"""A CloudBlockStorage Volume.""" | ||
|
||
def delete(self): | ||
"""Delete this CloudBlockStorage volum.""" | ||
assert 'id' in self | ||
url = '/'.join((get_url('cloudblockstorage'), 'volumes', | ||
str(self['id']))) | ||
handle_request('delete', url) | ||
|
||
@classmethod | ||
def list(cls, detail=False): | ||
"""Returns a list of volumes. | ||
:param detail: Provides more details about the volume | ||
:type detail: bool | ||
:type: A list of :class:`Volume` | ||
""" | ||
url = [get_url('cloudblockstorage'), 'volumes'] | ||
if detail: | ||
url.append('detail') | ||
url = '/'.join(url) | ||
return handle_request('get', url, wrapper=cls, container='volumes') | ||
|
||
@classmethod | ||
def get(cls, volume_id): | ||
"""Returns a Volume by id | ||
:param volume_id: The ``volume_id`` of the Volume to be retrieved | ||
:type volume_id: str | ||
:returns: A :class:`Volume` | ||
""" | ||
url = '/'.join((get_url('cloudblockstorage'), 'volumes', | ||
str(volume_id))) | ||
return handle_request('get', url, wrapper=cls, container='volume') | ||
|
||
@classmethod | ||
def types(cls): | ||
"""Returns a list of volume types.""" | ||
url = '/'.join((get_url('cloudblockstorage'), 'types')) | ||
return handle_request('get', url, container='volume_types') | ||
|
||
@classmethod | ||
def describe_type(cls, volume_type_id): | ||
"""Returns info about :param volume_type_id. | ||
:param volume_type_id: One of the ids returned by the types() call. | ||
:type volume_type_id: int | ||
""" | ||
url = '/'.join((get_url('cloudblockstorage'), 'types', | ||
str(volume_type_id))) | ||
return handle_request('get', url, container='volume_type') |