Class: AWS::Instance

Inherits:
Object
  • Object
show all
Includes:
AWS
Defined in:
lib/aws_cloud_map.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AWS

connect, ec2

Constructor Details

#initialize(attributes) ⇒ Instance

Returns a new instance of Instance.



74
75
76
# File 'lib/aws_cloud_map.rb', line 74

def initialize(attributes)
  @attributes = attributes
end

Class Method Details

.allObject



170
171
172
# File 'lib/aws_cloud_map.rb', line 170

def self.all
  @@ec2.describe_instances.map { |instance| new(instance) }
end

.find(instance_id) ⇒ Object



174
175
176
# File 'lib/aws_cloud_map.rb', line 174

def self.find(instance_id)
  new(@@ec2.describe_instances([instance_id]).first)
end

Instance Method Details

#addressObject



156
157
158
# File 'lib/aws_cloud_map.rb', line 156

def address
  #TODO
end

#ami_launch_indexObject



106
107
108
# File 'lib/aws_cloud_map.rb', line 106

def ami_launch_index
  @attributes[:ami_launch_index]
end

#aws_availability_zoneObject



126
127
128
# File 'lib/aws_cloud_map.rb', line 126

def aws_availability_zone
  @attributes[:aws_availability_zone]
end

#aws_groupsObject



90
91
92
# File 'lib/aws_cloud_map.rb', line 90

def aws_groups
  @attributes[:aws_groups]
end

#aws_image_idObject



130
131
132
# File 'lib/aws_cloud_map.rb', line 130

def aws_image_id
  @attributes[:aws_image_id]
end

#aws_instance_idObject Also known as: id



134
135
136
# File 'lib/aws_cloud_map.rb', line 134

def aws_instance_id
  @attributes[:aws_instance_id]
end

#aws_instance_typeObject



86
87
88
# File 'lib/aws_cloud_map.rb', line 86

def aws_instance_type
  @attributes[:aws_instance_type]
end

#aws_kernel_idObject



98
99
100
# File 'lib/aws_cloud_map.rb', line 98

def aws_kernel_id
  @attributes[:aws_kernel_id]
end

#aws_launch_timeObject



102
103
104
# File 'lib/aws_cloud_map.rb', line 102

def aws_launch_time
  @attributes[:aws_launch_time]
end

#aws_ownerObject



114
115
116
# File 'lib/aws_cloud_map.rb', line 114

def aws_owner
  @attributes[:aws_owner]
end

#aws_product_codesObject



138
139
140
# File 'lib/aws_cloud_map.rb', line 138

def aws_product_codes
  @attributes[:aws_product_codes]
end

#aws_ramdisk_idObject



122
123
124
# File 'lib/aws_cloud_map.rb', line 122

def aws_ramdisk_id
  @attributes[:aws_ramdisk_id]
end

#aws_reasonObject



142
143
144
# File 'lib/aws_cloud_map.rb', line 142

def aws_reason
  @attributes[:aws_reason]
end

#aws_reservation_idObject



78
79
80
# File 'lib/aws_cloud_map.rb', line 78

def aws_reservation_id
  @attributes[:aws_reservation_id]
end

#aws_stateObject



110
111
112
# File 'lib/aws_cloud_map.rb', line 110

def aws_state
  @attributes[:aws_state]
end

#aws_state_codeObject



146
147
148
# File 'lib/aws_cloud_map.rb', line 146

def aws_state_code
  @attributes[:aws_state_code]
end

#dns_nameObject



82
83
84
# File 'lib/aws_cloud_map.rb', line 82

def dns_name
  @attributes[:dns_name]
end

#imageObject



152
153
154
# File 'lib/aws_cloud_map.rb', line 152

def image
  @image ||= Image.find(aws_image_id)
end

#private_dns_nameObject



94
95
96
# File 'lib/aws_cloud_map.rb', line 94

def private_dns_name
  @attributes[:private_dns_name]
end

#ssh_key_nameObject



118
119
120
# File 'lib/aws_cloud_map.rb', line 118

def ssh_key_name
  @attributes[:ssh_key_name]
end

#terminate!Object

TODO test



166
167
168
# File 'lib/aws_cloud_map.rb', line 166

def terminate!
  @@ec2.terminate_instances [id]
end

#volumesObject



160
161
162
163
# File 'lib/aws_cloud_map.rb', line 160

def volumes
  #TODO
  []
end