Sha256: a21e8fb4a35a5c1b2a95c106983529a41cd077e1817330b0153534b9c6f30076

Contents?: true

Size: 1.46 KB

Versions: 21

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Volume
    class OpenStack
      class Real
        def list_volumes(detailed=true, options={})
          path = detailed ? 'volumes/detail' : 'volumes'
          request(
            :expects  => 200,
            :method   => 'GET',
            :path     => path,
            :query    => options
          )
        end
      end

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

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
fog-1.22.1 lib/fog/openstack/requests/volume/list_volumes.rb