Sha256: 5644170953d02a7d99a6d8d90ffae7151d7869a664288b821b17b40ed13458af

Contents?: true

Size: 1.35 KB

Versions: 79

Compression:

Stored size: 1.35 KB

Contents

module Fog
  module Compute
    class HP
      class Real

        # List all images
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'id'<~Integer> - Id of the image
        #     * 'name'<~String> - Name of the image
        #     * 'updated'<~String> - Last update timestamp for image
        #     * 'created'<~String> - Creation timestamp for image
        #     * 'status'<~String> - Status of image
        def list_images_detail
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => 'images/detail.json'
          )
        end

      end

      class Mock

        def list_images_detail
          response = Excon::Response.new

          images = self.data[:images].values
          for image in images
            case image['status']
            when 'SAVING'
              if Time.now - self.data[:last_modified][:images][image['id']] >= Fog::Mock.delay
                image['status'] = 'ACTIVE'
              end
            end
          end

          response.status = [200, 203][rand(1)]
          response.body = { 'images' => images.map {|image| image.reject {|key, value| !['id', 'name', 'links', 'metadata', 'progress' ,'status', 'created', 'updated'].include?(key)}} }
          response
        end

      end
    end
  end
end

Version data entries

79 entries across 79 versions & 12 rubygems

Version Path
fog-maestrodev-1.15.0.20130927082724 lib/fog/hp/requests/compute/list_images_detail.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.15.0 lib/fog/hp/requests/compute/list_images_detail.rb
gapinc-fog-1.14.0 lib/fog/hp/requests/compute/list_images_detail.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.14.0 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.13.0 lib/fog/hp/requests/compute/list_images_detail.rb
gapinc-fog-1.12.1.2 lib/fog/hp/requests/compute/list_images_detail.rb
gapinc-fog-1.12.1.1 lib/fog/hp/requests/compute/list_images_detail.rb
gapinc-fog-1.12.1a lib/fog/hp/requests/compute/list_images_detail.rb
gapinc-fog-1.12.1 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.12.1 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.12.0 lib/fog/hp/requests/compute/list_images_detail.rb
hpfog-0.0.20 lib/fog/hp/requests/compute/list_images_detail.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/hp/requests/compute/list_images_detail.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/hp/requests/compute/list_images_detail.rb
fog-nirvanix-1.8.2 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.11.1 lib/fog/hp/requests/compute/list_images_detail.rb
fog-1.11.0 lib/fog/hp/requests/compute/list_images_detail.rb
fog-nirvanix-1.8.1 lib/fog/hp/requests/compute/list_images_detail.rb