Class: Elbas::AWS::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/elbas/aws/instance.rb

Constant Summary collapse

STATE_RUNNING =
16.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, public_dns, state) ⇒ Instance

Returns a new instance of Instance.



8
9
10
11
12
13
# File 'lib/elbas/aws/instance.rb', line 8

def initialize(id, public_dns, state)
  @id = id
  @public_dns = public_dns
  @state = state
  @aws_counterpart = ::Aws::EC2::Instance.new id
end

Instance Attribute Details

#aws_counterpartObject (readonly)

Returns the value of attribute aws_counterpart.



6
7
8
# File 'lib/elbas/aws/instance.rb', line 6

def aws_counterpart
  @aws_counterpart
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/elbas/aws/instance.rb', line 6

def id
  @id
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/elbas/aws/instance.rb', line 6

def state
  @state
end

Instance Method Details

#hostnameObject



15
16
17
# File 'lib/elbas/aws/instance.rb', line 15

def hostname
  @public_dns
end

#running?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/elbas/aws/instance.rb', line 19

def running?
  state == STATE_RUNNING
end