Module: Ropenstack::BlockStorage::Version1
- Defined in:
- lib/ropenstack/blockStorage/v1.rb
Overview
-
Name: Version1
* Description: Module used to contain the version 1 methods.
* Author: Sam ‘Tehsmash’ Betts * Date: 01/15/2013
Instance Method Summary collapse
-
#create_volume(display_name, size, volume_type, options = {}) ⇒ Object
Create a new volume given size, volume_type and a name Optional parameters include: * :description -> string * :metadata -> array * :zone -> string.
-
#delete(id) ⇒ Object
Delete a volume given an ID.
-
#types(id = nil) ⇒ Object
Gets the list of volume types from cinder.
- #version ⇒ Object
-
#volumes(id = nil) ⇒ Object
Gets the volumes from cinder, and provides them in a ruby hash with all information about them.
-
#volumes_detailed ⇒ Object
Gets the detailed list of volumes from cinder.
Instance Method Details
#create_volume(display_name, size, volume_type, options = {}) ⇒ Object
Create a new volume given size, volume_type and a name Optional parameters include:
* :description -> string
* :metadata -> array
* :zone -> string
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 41 def create_volume(display_name, size, volume_type, = {}) data = { "volume" => { "display_name" => display_name, "size" => size, "volume_type" => volume_type } } data["volume"]["display_description"] = [:description] unless [:description].nil? data["volume"]["metadata"] = [:metadata] unless [:metadata].nil? data["volume"]["availability_zone"] = [:zone] unless [:zone].nil? return post_request(address("/volumes"), data, @token) end |
#delete(id) ⇒ Object
Delete a volume given an ID.
60 61 62 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 60 def delete(id) return delete_request(address("/volumes/#{id}"), @token) end |
#types(id = nil) ⇒ Object
Gets the list of volume types from cinder.
28 29 30 31 32 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 28 def types(id = nil) endpoint = "/types" endpoint = "#{endpoint}/#{id}" unless id.nil? return get_request(address(endpoint), @token) end |
#version ⇒ Object
64 65 66 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 64 def version "V1" end |
#volumes(id = nil) ⇒ Object
Gets the volumes from cinder, and provides them in a ruby hash with all information about them.
12 13 14 15 16 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 12 def volumes(id = nil) endpoint = "/volumes" endpoint = "#{endpoint}/#{id}" unless id.nil? return get_request(address(endpoint), @token) end |
#volumes_detailed ⇒ Object
Gets the detailed list of volumes from cinder.
21 22 23 |
# File 'lib/ropenstack/blockStorage/v1.rb', line 21 def volumes_detailed() return get_request(address("/volumes/detail"), @token) end |