Sha256: b2e169d4b8e2f1ada6220d74eda351162e9a95ca89379b0860aa2d44025e7f8a

Contents?: true

Size: 1007 Bytes

Versions: 11

Compression:

Stored size: 1007 Bytes

Contents

unless Fog.mocking?

  module Fog
    module Rackspace
      class Servers

        # List all images (IDs and names only)
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'id'<~Integer> - Id of the image
        #     * 'name'<~String> - Name of the image
        def list_images
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => 'images.json'
          )
        end

      end
    end
  end

else

  module Fog
    module Rackspace
      class Servers

        def list_images
          response = Excon::Response.new
          data = list_images_detail.body['images']
          images = []
          for image in data
            images << image.reject { |key, value| !['id', 'name'].include?(key) }
          end
          response.status = [200, 203][rand(1)]
          response.body = { 'images' => images }
          response

        end

      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-0.0.42 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.41 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.40 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.39 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.38 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.37 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.36 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.35 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.34 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.33 lib/fog/rackspace/requests/servers/list_images.rb
fog-0.0.32 lib/fog/rackspace/requests/servers/list_images.rb