Class: Fog::Compute::DigitalOcean::Images

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

Instance Method Summary collapse

Methods inherited from PagingCollection

#next_page, #previous_page

Instance Method Details

#all(filters = {}) ⇒ Fog::Compute::DigitalOceanV2:Image

Retrieves images

Returns:

  • (Fog::Compute::DigitalOceanV2:Image)

Raises:

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

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

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

  • (Fog::Compute::DigitalOceanV2::ServiceError)

See Also:



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

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

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

Retrieves image

Parameters:

  • id (String)

    for image to be returned

Returns:

  • (Fog::Compute::DigitalOceanV2:Image)

Raises:

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

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

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

  • (Fog::Compute::DigitalOceanV2::ServiceError)

See Also:



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

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