Sha256: eed02b589d8ad379f483fa2e7b2ce957b48acf0212a937eee61b86a1b5f4c464

Contents?: true

Size: 846 Bytes

Versions: 4

Compression:

Stored size: 846 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def detach_volume(server_id, attachment_id)
          request(
            :expects => 202,
            :method  => 'DELETE',
            :path    => "servers/%s/os-volume_attachments/%s" % [server_id, attachment_id]
          )
        end
      end

      class Mock
        def detach_volume(server_id, attachment_id)
          response = Excon::Response.new
          if data[:volumes][attachment_id] &&
             data[:volumes][attachment_id]['attachments'].reject! { |attachment| attachment['serverId'] == server_id }
            data[:volumes][attachment_id]['status'] = 'available'
            response.status = 202
            response
          else
            raise Fog::Compute::HuaweiCloud::NotFound
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/detach_volume.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/detach_volume.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/detach_volume.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/detach_volume.rb