Sha256: 61cd760054989f50d71ce61312fef32c56ee9dba4dfcdec434f5ea9a9e63dc3f

Contents?: true

Size: 1.67 KB

Versions: 14

Compression:

Stored size: 1.67 KB

Contents

require 'fog/core/collection'
require 'fog/rackspace/models/compute_v2/image'

module Fog
  module Compute
    class RackspaceV2
      class Images < Fog::Collection

        model Fog::Compute::RackspaceV2::Image

        # Returns list of images 
        # @return [Fog::Compute::RackspaceV2::Images] Retrieves a list images.
        # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404
        # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400
        # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500
        # @raise [Fog::Compute::RackspaceV2::ServiceError]
        # @note Fog's current implementation only returns 1000 images.
        # @note Fog does not retrieve all image details. Please use get to retrieve all details for a specific image.
        # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html
        def all
          data = service.list_images.body['images']
          load(data)
        end

        # Retrieve image
        # @param [String] image_id id of image
        # @return [Fog::Compute::RackspaceV2:Image] image
        # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404
        # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400
        # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500
        # @raise [Fog::Compute::RackspaceV2::ServiceError]
        # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Get_Image_Details-d1e4848.html 
        def get(image_id)
          data = service.get_image(image_id).body['image']
          new(data)
        rescue Fog::Compute::RackspaceV2::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.15.0 lib/fog/rackspace/models/compute_v2/images.rb
gapinc-fog-1.14.0 lib/fog/rackspace/models/compute_v2/images.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.14.0 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.13.0 lib/fog/rackspace/models/compute_v2/images.rb
gapinc-fog-1.12.1.2 lib/fog/rackspace/models/compute_v2/images.rb
gapinc-fog-1.12.1.1 lib/fog/rackspace/models/compute_v2/images.rb
gapinc-fog-1.12.1a lib/fog/rackspace/models/compute_v2/images.rb
gapinc-fog-1.12.1 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.12.1 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.12.0 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.11.1 lib/fog/rackspace/models/compute_v2/images.rb
fog-1.11.0 lib/fog/rackspace/models/compute_v2/images.rb