Sha256: e1a6562f74a098ae2f807b132fb9a1afda9fb4757b1d46af4e987429316f951d

Contents?: true

Size: 1.61 KB

Versions: 37

Compression:

Stored size: 1.61 KB

Contents

module Fog
  module Compute
    class HPV2
      class Real

        # List all images (IDs and names only)
        #
        # ==== Parameters
        # * options<~Hash>: filter options
        #   * 'name'<~String> - Filters by the name of the image
        #   * 'status'<~String> - Filters by the status of the image
        #   * 'server'<~String> - Filters by the UUId of the server
        #   * 'marker'<~String> - The ID of the last item in the previous list
        #   * 'limit'<~Integer> - Sets the page size
        #   * 'changes-since'<~DateTime> - Filters by the changes-since time. The list contains servers that have been deleted since the changes-since time.
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #   * 'images'<~Array>:
        #     * 'id'<~String> - UUId of the image
        #     * 'name'<~String> - Name of the image
        #     * 'links'<~Array> - array of image links
        def list_images(options = {})
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => 'images',
            :query    => options
          )
        end

      end

      class Mock

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

      end
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/hp/requests/compute_v2/list_images.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/hp/requests/compute_v2/list_images.rb
fog-1.18.0 lib/fog/hp/requests/compute_v2/list_images.rb