Class: Rudy::AWS::EC2::Instance
- Inherits:
-
Storable
- Object
- Storable
- Rudy::AWS::EC2::Instance
- Defined in:
- lib/rudy/aws/ec2/instance.rb
Constant Summary collapse
- @@sformat =
" -> %10s; %10s; %12s; %10s; groups: %s"
Instance Method Summary collapse
- #degraded? ⇒ Boolean
- #init ⇒ Object
- #inspect ⇒ Object
- #liner_note ⇒ Object
- #pending? ⇒ Boolean
- #running? ⇒ Boolean
- #shutting_down? ⇒ Boolean
- #terminated? ⇒ Boolean
- #to_s(with_title = false) ⇒ Object
Instance Method Details
#degraded? ⇒ Boolean
63 |
# File 'lib/rudy/aws/ec2/instance.rb', line 63 def degraded?; self.state && self.state == 'degraded'; end |
#init ⇒ Object
22 23 24 |
# File 'lib/rudy/aws/ec2/instance.rb', line 22 def init @groups ||= [] end |
#inspect ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rudy/aws/ec2/instance.rb', line 49 def inspect lines = [] lines << liner_note field_names.each do |key| next unless self.respond_to?(key) val = self.send(key) lines << sprintf(" %22s: %s", key, (val.is_a?(Array) ? val.join(', ') : val)) end lines.join($/) end |
#liner_note ⇒ Object
26 27 28 29 |
# File 'lib/rudy/aws/ec2/instance.rb', line 26 def liner_note info = self.running? ? self.dns_public : self.state "%s %-30s" % [self.awsid.bright, info] end |
#pending? ⇒ Boolean
61 |
# File 'lib/rudy/aws/ec2/instance.rb', line 61 def pending?; self.state && self.state == 'pending'; end |
#running? ⇒ Boolean
60 |
# File 'lib/rudy/aws/ec2/instance.rb', line 60 def running?; self.state && self.state == 'running'; end |
#shutting_down? ⇒ Boolean
64 |
# File 'lib/rudy/aws/ec2/instance.rb', line 64 def shutting_down?; self.state && self.state == 'shutting-down'; end |
#terminated? ⇒ Boolean
62 |
# File 'lib/rudy/aws/ec2/instance.rb', line 62 def terminated?; self.state && self.state == 'terminated'; end |
#to_s(with_title = false) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rudy/aws/ec2/instance.rb', line 31 def to_s(with_title=false) lines = [] if @groups gpstr = [@groups].flatten.compact.join(', ') gpstr &&= "(#{gpstr})" else gpstr = '' end lines << "%s %s" % [liner_note, gpstr] #if self.running? # k, g = @keyname || 'no-keypair', self.groups.join(', ') # lines << @@sformat % %w{zone size ami keyname groups} if with_title # lines << @@sformat % [@zone, @size, @ami, k, g] #end lines.join($/) end |