Class: Opsicle::ManageableLayer

Inherits:
Object
  • Object
show all
Defined in:
lib/opsicle/manageable_layer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, layer_id, stack, opsworks, ec2, cli) ⇒ ManageableLayer



5
6
7
8
9
10
11
12
13
# File 'lib/opsicle/manageable_layer.rb', line 5

def initialize(name, layer_id, stack, opsworks, ec2, cli)
  self.name = name
  self.layer_id = layer_id
  self.stack = stack
  self.opsworks = opsworks
  self.ec2 = ec2
  self.cli = cli
  self.instances = []
end

Instance Attribute Details

#agent_versionObject

Returns the value of attribute agent_version.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def agent_version
  @agent_version
end

#ami_idObject

Returns the value of attribute ami_id.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def ami_id
  @ami_id
end

#cliObject

Returns the value of attribute cli.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def cli
  @cli
end

#ec2Object

Returns the value of attribute ec2.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def ec2
  @ec2
end

#instancesObject

Returns the value of attribute instances.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def instances
  @instances
end

#layer_idObject

Returns the value of attribute layer_id.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def layer_id
  @layer_id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def name
  @name
end

#opsworksObject

Returns the value of attribute opsworks.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def opsworks
  @opsworks
end

#stackObject

Returns the value of attribute stack.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def stack
  @stack
end

#subnet_idObject

Returns the value of attribute subnet_id.



3
4
5
# File 'lib/opsicle/manageable_layer.rb', line 3

def subnet_id
  @subnet_id
end

Instance Method Details

#add_new_instance(instance_id) ⇒ Object



23
24
25
26
# File 'lib/opsicle/manageable_layer.rb', line 23

def add_new_instance(instance_id)
  instance = @opsworks.describe_instances({ :instance_ids => [instance_id] }).instances.first
  self.instances << ManageableInstance.new(instance, self, stack, @opsworks, @ec2, @cli)
end

#get_cloneable_instancesObject



15
16
17
18
19
20
21
# File 'lib/opsicle/manageable_layer.rb', line 15

def get_cloneable_instances
  ops_instances = @opsworks.describe_instances({ :layer_id => layer_id }).instances
  ops_instances.each do |instance|
    self.instances << ManageableInstance.new(instance, self, stack, @opsworks, @ec2, @cli)
  end
  self.instances
end