Class: Dumbwaiter::Instance

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(layer, opsworks_instance, opsworks = Aws::OpsWorks.new(region: "us-east-1")) ⇒ Instance

Returns a new instance of Instance.



9
10
11
12
13
# File 'lib/dumbwaiter/instance.rb', line 9

def initialize(layer, opsworks_instance, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
  @layer = layer
  @opsworks_instance = opsworks_instance
  @opsworks = opsworks
end

Instance Attribute Details

#layerObject (readonly)

Returns the value of attribute layer.



2
3
4
# File 'lib/dumbwaiter/instance.rb', line 2

def layer
  @layer
end

#opsworksObject (readonly)

Returns the value of attribute opsworks.



2
3
4
# File 'lib/dumbwaiter/instance.rb', line 2

def opsworks
  @opsworks
end

#opsworks_instanceObject (readonly)

Returns the value of attribute opsworks_instance.



2
3
4
# File 'lib/dumbwaiter/instance.rb', line 2

def opsworks_instance
  @opsworks_instance
end

Class Method Details

.all(layer, opsworks = Aws::OpsWorks.new(region: "us-east-1")) ⇒ Object



4
5
6
7
# File 'lib/dumbwaiter/instance.rb', line 4

def self.all(layer, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
  instances = opsworks.describe_instances(layer_id: layer.id).instances
  instances.map { |instance| new(layer, instance, opsworks) }
end

Instance Method Details

#idObject



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

def id
  opsworks_instance.instance_id
end