module Ropenstack::BlockStorage::Version1
-
Name:
Version1
-
Description: Module used to contain the version 1 methods.
-
Author: Sam ‘Tehsmash’ Betts
-
Date: 01/15/2013
Public Instance Methods
create_volume(display_name, size, volume_type, options = {})
click to toggle source
Create a new volume given size, volume_type and a name Optional parameters include:
* :description -> string * :metadata -> array * :zone -> string
# File lib/ropenstack/blockStorage/v1.rb, line 41 def create_volume(display_name, size, volume_type, options = {}) data = { "volume" => { "display_name" => display_name, "size" => size, "volume_type" => volume_type } } data["volume"]["display_description"] = options[:description] unless options[:description].nil? data["volume"]["metadata"] = options[:metadata] unless options[:metadata].nil? data["volume"]["availability_zone"] = options[:zone] unless options[:zone].nil? return post_request(address("/volumes"), data, @token) end
delete(id)
click to toggle source
Delete a volume given an ID.
# File lib/ropenstack/blockStorage/v1.rb, line 60 def delete(id) return delete_request(address("/volumes/#{id}"), @token) end
types(id = nil)
click to toggle source
Gets the list of volume types from cinder.
# 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()
click to toggle source
# File lib/ropenstack/blockStorage/v1.rb, line 64 def version "V1" end
volumes(id = nil)
click to toggle source
Gets the volumes from cinder, and provides them in a ruby hash with all information about them.
# 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()
click to toggle source
Gets the detailed list of volumes from cinder.
# File lib/ropenstack/blockStorage/v1.rb, line 21 def volumes_detailed() return get_request(address("/volumes/detail"), @token) end