Module: AwsExtensions::EC2::Volume

Defined in:
lib/aws_extensions/ec2/Volume.rb

Instance Method Summary collapse

Instance Method Details

#attached?Boolean

Public: Returns true if the volume is attached or attaching to anything

Returns:

  • (Boolean)


13
14
15
# File 'lib/aws_extensions/ec2/Volume.rb', line 13

def attached?
  self.attachments.map(&:state).any? { |state| state == "attached" || state == "attaching" }
end

#detached?Boolean

Public: Returns true if the volume is not attached or attaching to anything

Returns:

  • (Boolean)


18
19
20
# File 'lib/aws_extensions/ec2/Volume.rb', line 18

def detached?
  !self.attached?
end

#groupObject

Public: Returns the value of the “Group” tag for the Volume



6
7
8
9
10
# File 'lib/aws_extensions/ec2/Volume.rb', line 6

def group
  self.tags.select { |tag| tag.key == "Group" }.first.value
rescue
	nil
end