Sha256: 0068533e5dc9c3290f70a29b8eac37b1aed32a88abd7a59451f3f25c1ff741d7

Contents?: true

Size: 680 Bytes

Versions: 31

Compression:

Stored size: 680 Bytes

Contents

module Awspec::Type
  class Ebs < Base
    def initialize(id)
      super
      @resource = find_ebs(id)
      @id = @resource[:volume_id] if @resource
    end

    states = %w(
      creating available in-use deleting deleted error
    )

    states.each do |state|
      define_method state.tr('-', '_') + '?' do
        @resource[:state] == state
      end
    end

    def attached_to?(instance_id)
      instance = find_ec2(instance_id)
      return false unless instance
      return false unless @resource[:attachments]
      @resource[:attachments][0][:instance_id] == instance[:instance_id] && \
        @resource[:attachments][0][:state] == 'attached'
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
awspec-0.22.1 lib/awspec/type/ebs.rb
awspec-0.22.0 lib/awspec/type/ebs.rb
awspec-0.21.6 lib/awspec/type/ebs.rb
awspec-0.21.5 lib/awspec/type/ebs.rb
awspec-0.21.4 lib/awspec/type/ebs.rb
awspec-0.21.3 lib/awspec/type/ebs.rb
awspec-0.21.2 lib/awspec/type/ebs.rb
awspec-0.21.1 lib/awspec/type/ebs.rb
awspec-0.21.0 lib/awspec/type/ebs.rb
awspec-0.20.2 lib/awspec/type/ebs.rb
awspec-0.20.1 lib/awspec/type/ebs.rb
awspec-0.20.0 lib/awspec/type/ebs.rb
awspec-0.19.0 lib/awspec/type/ebs.rb
awspec-0.18.2 lib/awspec/type/ebs.rb
awspec-0.18.1 lib/awspec/type/ebs.rb
awspec-0.18.0 lib/awspec/type/ebs.rb
awspec-0.17.1 lib/awspec/type/ebs.rb
awspec-0.17.0 lib/awspec/type/ebs.rb
awspec-0.16.0 lib/awspec/type/ebs.rb
awspec-0.15.0 lib/awspec/type/ebs.rb