Class: Fog::Storage::IBM::Real
- Inherits:
-
Object
- Object
- Fog::Storage::IBM::Real
- Defined in:
- lib/fog/ibm/storage.rb,
lib/fog/ibm/requests/storage/get_volume.rb,
lib/fog/ibm/requests/storage/list_volumes.rb,
lib/fog/ibm/requests/storage/create_volume.rb,
lib/fog/ibm/requests/storage/delete_volume.rb,
lib/fog/ibm/requests/storage/list_offerings.rb
Instance Method Summary collapse
-
#create_volume(name, offering_id, format, location_id, size) ⇒ Object
Requests a new Storage Volume be created.
-
#delete_volume(volume_id) ⇒ Object
Deletes the storage that the authenticated user manages with the specified :storage_id.
-
#get_volume(volume_id) ⇒ Object
Used to retrieve the specified storage volume for specified volume_id.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#list_offerings ⇒ Object
Returns the offerings of storage for the authenticated user.
-
#list_volumes ⇒ Object
Returns the list of storage volumes.
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
28 29 30 |
# File 'lib/fog/ibm/storage.rb', line 28 def initialize(={}) @connection = Fog::IBM::Connection.new([:ibm_username], [:ibm_password]) end |
Instance Method Details
#create_volume(name, offering_id, format, location_id, size) ⇒ Object
Requests a new Storage Volume be created.
Parameters
- name<~String> - The alias to use to referance storage volume
- offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage
- format<~String> - filesystem format for volume
- location<~String> - datacenter location for volume
- size<~String> - size of volume desired (Small, Medium, Large) (varies by location what size actually is)
- storageAreaID<~String> - (not supported yet)
Returns
- response<~Excon::Response>:
- body<~Hash>:
- name<~String> - The alias to use to referance storage volume
- format<~String> - filesystem format for storage
- location<~String> - datacenter location for storage
- createdTime<~Integer> - Epoch time of creation
- size<~String> - size of storage desired (Small, Medium, Large) (varies by location what size actually is)
- productCodes<~Array> -
- offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage
- id<~String> - id of new storage
- owner<~String> - owner of new storage
- state<~Integer> - state of newly requested storage
- body<~Hash>:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/ibm/requests/storage/create_volume.rb', line 29 def create_volume(name, offering_id, format, location_id, size) request( :method => 'POST', :expects => 200, :path => '/storage', :body => { 'name' => name, 'offeringID' => offering_id, 'format' => format, 'location' => location_id, 'size' => size } ) end |
#delete_volume(volume_id) ⇒ Object
Deletes the storage that the authenticated user manages with the specified :storage_id
Parameters
- volume_id<~String> - Id of storage volume
Returns
- response<~Excon::Response>:
- body<~Hash>: *'success'<~Bool>: true or false for success
15 16 17 18 19 20 21 |
# File 'lib/fog/ibm/requests/storage/delete_volume.rb', line 15 def delete_volume(volume_id) request( :method => 'DELETE', :expects => 200, :path => "/storage/#{volume_id}" ) end |
#get_volume(volume_id) ⇒ Object
Used to retrieve the specified storage volume for specified volume_id
Parameters
- volume_id<~String> - Id of storage volume
Returns
- response<~Excon::Response>:
- body<~Hash>:
14 15 16 17 18 19 20 |
# File 'lib/fog/ibm/requests/storage/get_volume.rb', line 14 def get_volume(volume_id) request( :method => 'GET', :expects => 200, :path => "/storage/#{volume_id}" ) end |
#list_offerings ⇒ Object
Returns the offerings of storage for the authenticated user
Parameters
No parameters
Returns
- response<~Excon::Response>:
- body<~Hash>:
- 'volumes'<~Array>: list of images
- 'name'<~String>: Name of storage offering
- 'price'<~Hash>: hash containing pricing information
- 'pricePerQuantity'<~Integer>:
- 'effectiveDate'<~Integer>: starting date price is effective
- 'rate'<~Float>: rate per unit
- 'countryCode'<~String>:
- 'currencyCode'<~String>: currency used
- 'location'<~String>: datacenter location string
- 'id'<~String>: id of offering
- 'formats'<~Array>: filesystem format storage offered with
- 'label'<~String>: label for filesystem
- 'id'<~String>: string used for id of format
- 'capacity'<~Integer>: size in GB's
- 'volumes'<~Array>: list of images
- body<~Hash>:
28 29 30 31 32 33 34 |
# File 'lib/fog/ibm/requests/storage/list_offerings.rb', line 28 def list_offerings request( :method => 'GET', :expects => 200, :path => '/offerings/storage' ) end |
#list_volumes ⇒ Object
Returns the list of storage volumes
Parameters
No parameters
Returns
- response<~Excon::Response>:
- body<~Hash>:
- 'volumes'<~Array>: list of images
- 'name'<~String>: Name of image
- 'format'<~String>: filesystem volume is formatted with
- 'location'<~String>: datacenter location string
- 'createdTime'<~Integer>: creation time in Epoch int
- 'size'<~String>: size in GB's (as a string)
- 'productCodes'<~Array>: unsure..
- 'offeringId'<~String>:
- 'id'<~String>: volume id
- 'owner'<~String>: owner's email address
- 'state'<~Integer>: known so far: 4 provisioned, unattached; 5 provisioned, attached
- 'volumes'<~Array>: list of images
- body<~Hash>:
25 26 27 28 29 30 31 |
# File 'lib/fog/ibm/requests/storage/list_volumes.rb', line 25 def list_volumes request( :method => 'GET', :expects => 200, :path => '/storage' ) end |