Sha256: ec152af1c783255bcdae9e42fb4c9f0de840f2b794514dabf9f0411041571970

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 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",
              "displayDescription" => "",
              "availabilityZone" => "nova",
              "displayName" => "test 1",
              "attachments" => [{}],
              "volumeType" => nil,
              "snapshotId" => Fog::Mock.random_numbers(2),
              "size" => 1,
              "id" => "6",
              "createdAt" => Time.now },
            { "status" => "available",
              "displayDescription" => "",
              "availabilityZone" => "nova",
              "displayName" => "test 2",
              "attachments" => [{}],
              "volumeType" => nil,
              "snapshotId" => Fog::Mock.random_numbers(2),
              "size" => 1,
              "id" => "8",
              "createdAt" => Time.now}
            ]
          response.body = { 'volumes' => self.data[:volumes] }
          response
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/openstack/requests/compute/list_volumes.rb
fog-test-again-1.6.0 lib/fog/openstack/requests/compute/list_volumes.rb
fog-parser-fix-1.6.0 lib/fog/openstack/requests/compute/list_volumes.rb
fog-1.6.0 lib/fog/openstack/requests/compute/list_volumes.rb
fog-1.5.0 lib/fog/openstack/requests/compute/list_volumes.rb