Sha256: b4ea47162e9bb3081928483360ef5c38391747061b0dc70c049874d2aec0323e

Contents?: true

Size: 1.01 KB

Versions: 36

Compression:

Stored size: 1.01 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real
        def attach_volume(volume_id, server_id, device)
          data = {
            'volumeAttachment' => {
              'volumeId' => volume_id.to_s,
              'device'   => device
            }
          }
          request(
            :body     => Fog::JSON.encode(data),
            :expects  => [200, 202],
            :method   => 'POST',
            :path     => "servers/%s/os-volume_attachments" % [server_id]
          )
        end
      end

      class Mock
        def attach_volume(volume_id, server_id, device)
          response = Excon::Response.new
          response.status = 200
          data = {
             'id'       => volume_id,
             'volumeId' => volume_id,
             'serverId' => server_id,
             'device'   => device
          }
          self.data[:volumes][volume_id]['attachments'] << data
          response.body = { 'volumeAttachment' => data }
          response
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
fog-openstack-0.1.6 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/compute/attach_volume.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.37.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.36.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.35.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-2.0.0.pre.0 lib/fog/openstack/requests/compute/attach_volume.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.34.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.33.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.32.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.31.0 lib/fog/openstack/requests/compute/attach_volume.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.30.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.29.0 lib/fog/openstack/requests/compute/attach_volume.rb
fog-1.28.0 lib/fog/openstack/requests/compute/attach_volume.rb