Sha256: b5809025a1a3a881651b49b5bca3d341a1725f0b950879e198f4636df3c8c7a7

Contents?: true

Size: 1.41 KB

Versions: 55

Compression:

Stored size: 1.41 KB

Contents

require 'fog/core/collection'
require 'fog/rackspace/models/compute_v2/attachment'

module Fog
  module Compute
    class RackspaceV2
      class Attachments < Fog::Collection

        model Fog::Compute::RackspaceV2::Attachment

        attr_accessor :server

        # Retrieves attachments belonging to server
        # @return [Fog::Compute::RackspaceV2::Attachments] list of attachments
        # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404
        # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400
        # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500
        # @raise [Fog::Compute::RackspaceV2::ServiceError]
        # @see Server#attachments
        def all
          data = service.list_attachments(server.id).body['volumeAttachments']
          load(data)
        end

        # Retrieves attachment belonging to server
        # @param [String] volume_id
        # @return [Fog::Compute::RackspaceV2::Attachment] attachment for volume id
        # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404
        # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400
        # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500
        # @raise [Fog::Compute::RackspaceV2::ServiceError]
        def get(volume_id)
          data = service.get_attachment(server.id, volume_id).body['volumeAttachment']
          data && new(data)
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 3 rubygems

Version Path
fog-1.22.0 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-1.21.0 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-1.20.0 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-1.19.0 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/models/compute_v2/attachments.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/models/compute_v2/attachments.rb