Sha256: 51f1cc690f777163100c58975e4147bff4ac4dfb917221492d3267309121239a

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real

        def list_volumes(detailed=true)
          path = detailed ? 'os-volumes/detail' : 'os-volumes'
          request(
            :expects  => 200,
            :method   => 'GET',
            :path     => path
          )
        end

      end

      class Mock

        def list_volumes(detailed=true)
          response = Excon::Response.new
          response.status = 200
          self.data[:volumes] ||= [
            { "status" => "available",
              "display_description" => "",
              "availability_zone" => "nova",
              "display_name" => "test 1",
              "attachments" => [{}],
              "volume_type" => nil,
              "snapshot_id" => nil,
              "size" => 1,
              "id" => Fog::Mock.random_hex(32),
              "created_at" => Time.now },
            { "status" => "available",
              "display_description" => "",
              "availability_zone" => "nova",
              "display_name" => "test 2",
              "attachments" => [{}],
              "volume_type" => nil,
              "snapshot_id" => nil,
              "size" => 1,
              "id" => Fog::Mock.random_hex(32),
              "created_at" => Time.now }
            ]
          response.body = { 'volumes' => self.data[:volumes] }
          response
        end
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 9 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
cifrado-0.2.0 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
hpfog-0.0.20 lib/fog/openstack/requests/compute/list_volumes.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/openstack/requests/compute/list_volumes.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/openstack/requests/compute/list_volumes.rb
fog-nirvanix-1.8.2 lib/fog/openstack/requests/compute/list_volumes.rb
fog-nirvanix-1.8.1 lib/fog/openstack/requests/compute/list_volumes.rb
fog-1.10.1 lib/fog/openstack/requests/compute/list_volumes.rb
fog-test-me-1.10.0 lib/fog/openstack/requests/compute/list_volumes.rb
cifrado-0.1.3 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
fog-1.10.0 lib/fog/openstack/requests/compute/list_volumes.rb
cifrado-0.1.2 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
cifrado-0.1.1 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
cifrado-0.1 vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb
fog-1.9.0 lib/fog/openstack/requests/compute/list_volumes.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/openstack/requests/compute/list_volumes.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/openstack/requests/compute/list_volumes.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/openstack/requests/compute/list_volumes.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/requests/compute/list_volumes.rb
fog-sgonyea-1.8.1 lib/fog/openstack/requests/compute/list_volumes.rb