Class: Fog::Compute::DigitalOcean::Volumes

Inherits:
PagingCollection show all
Defined in:
lib/fog/compute/digitalocean/models/volumes.rb

Instance Method Summary collapse

Methods inherited from PagingCollection

#next_page, #previous_page

Instance Method Details

#all(filters = {}) ⇒ Fog::Compute::DigitalOcean::Volume

Retrieves volumes

Returns:

Raises:

  • (Fog::Compute::DigitalOcean::NotFound)
    • HTTP 404

  • (Fog::Compute::DigitalOcean::BadRequest)
    • HTTP 400

  • (Fog::Compute::DigitalOcean::InternalServerError)
    • HTTP 500

  • (Fog::Compute::DigitalOcean::ServiceError)

See Also:



16
17
18
19
20
21
22
# File 'lib/fog/compute/digitalocean/models/volumes.rb', line 16

def all(filters = {})
  data = service.list_volumes(filters)
  links = data.body["links"]
  get_paged_links(links) 
  volumes = data.body["volumes"]
  load(volumes)
end

#get(id) ⇒ Fog::Compute::DigitalOcean:Image

Retrieves volume

Parameters:

  • id (String)

    for volume to be returned

Returns:

  • (Fog::Compute::DigitalOcean:Image)

Raises:

  • (Fog::Compute::DigitalOcean::NotFound)
    • HTTP 404

  • (Fog::Compute::DigitalOcean::BadRequest)
    • HTTP 400

  • (Fog::Compute::DigitalOcean::InternalServerError)
    • HTTP 500

  • (Fog::Compute::DigitalOcean::ServiceError)

See Also:



32
33
34
35
36
37
# File 'lib/fog/compute/digitalocean/models/volumes.rb', line 32

def get(id)
  volume = service.get_volume_details(id).body['volume']
  new(volume) if volume
rescue Fog::Errors::NotFound
  nil
end