Class: Instance::EBS

Inherits:
Instance show all
Defined in:
lib/maws/instance/ebs.rb

Overview

for EC2 instances aws_id is a random id name is a value of 'Name' tag

Constant Summary

Constants inherited from Instance

NA_STATUS

Instance Attribute Summary

Attributes inherited from Instance

#description, #groups, #index, #name, #prefix, #region, #role, #zone

Instance Method Summary collapse

Methods inherited from Instance

#alive?, #aws_id, #config, #connection, create, #display, #has_approximate_status?, #initialize, #inspect, #instances, #logical_zone, #matches?, #method_missing, name_for, #region_physical_zone, #region_zone, #security_groups, #status, #terminated?, #to_s

Constructor Details

This class inherits a constructor from Instance

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Instance

Instance Method Details

#attached?Boolean

Returns:

  • (Boolean)

12
13
14
# File 'lib/maws/instance/ebs.rb', line 12

def attached?
  aws_attachment_status == 'attached'
end

#attached_to_instance_idObject


16
17
18
19
# File 'lib/maws/instance/ebs.rb', line 16

def attached_to_instance_id
  return "" unless attached_instance_name
  device[:aws_instance_id]
end

#attachment_statusObject


41
42
43
# File 'lib/maws/instance/ebs.rb', line 41

def attachment_status
  description.aws_attachment_status
end

#destroyObject


7
8
9
10
# File 'lib/maws/instance/ebs.rb', line 7

def destroy
  connection.ec2.delete_volume(aws_id)
  info "destroying EBS volume #{name}:#{device} (#{aws_id})"
end

#deviceObject


37
38
39
# File 'lib/maws/instance/ebs.rb', line 37

def device
  description.aws_device
end

#display_fieldsObject


21
22
23
24
25
26
27
# File 'lib/maws/instance/ebs.rb', line 21

def display_fields
  if attached?
    super + [:device, :aws_id, :attachment_status, :aws_instance_id]
  else
    super + [:aws_id]
  end
end

#physical_zoneObject


33
34
35
# File 'lib/maws/instance/ebs.rb', line 33

def physical_zone
  super || @config.available_zones.first
end

#serviceObject


29
30
31
# File 'lib/maws/instance/ebs.rb', line 29

def service
  :ebs
end