Sha256: d52d0e21a036d5e560b11214210c6aa10ffdd6cb6436c50ff166415a80146077

Contents?: true

Size: 1.31 KB

Versions: 39

Compression:

Stored size: 1.31 KB

Contents

module Fog
  module Compute
    class Rackspace
      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', 'status', 'updated'].include?(key)}} }
          response
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
fog-rackspace-0.1.6 lib/fog/rackspace/requests/compute/list_images_detail.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/requests/compute/list_images_detail.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/requests/compute/list_images_detail.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.5 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.4 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.3 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.2 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.1 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-rackspace-0.1.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.37.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.36.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.35.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-2.0.0.pre.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.34.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.33.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.32.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
fog-1.31.0 lib/fog/rackspace/requests/compute/list_images_detail.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/rackspace/requests/compute/list_images_detail.rb