Class: OpsWorker::Stack
- Inherits:
-
Object
- Object
- OpsWorker::Stack
- Defined in:
- lib/ops_worker/stack.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
- #apps ⇒ Object
-
#initialize(id, name, region, opsworks_client) ⇒ Stack
constructor
A new instance of Stack.
- #layers ⇒ Object
- #reload ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, name, region, opsworks_client) ⇒ Stack
Returns a new instance of Stack.
5 6 7 8 9 10 |
# File 'lib/ops_worker/stack.rb', line 5 def initialize(id, name, region, opsworks_client) @id = id @name = name @region = region @opsworks_client = opsworks_client end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/ops_worker/stack.rb', line 3 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/ops_worker/stack.rb', line 3 def name @name end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
3 4 5 |
# File 'lib/ops_worker/stack.rb', line 3 def region @region end |
Instance Method Details
#apps ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ops_worker/stack.rb', line 12 def apps if @apps return @apps end apps_result = @opsworks_client.describe_apps(:stack_id => @id)[:apps] @apps = apps_result.map do |app_hash| App.new(app_hash[:app_id], app_hash[:name], app_hash[:app_source][:revision], self, @opsworks_client) end end |
#layers ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ops_worker/stack.rb', line 23 def layers if @layers return @layers end layers_result = @opsworks_client.describe_layers(:stack_id => @id)[:layers] @layers = layers_result.map do |layer_hash| Layer.new(layer_hash[:layer_id], layer_hash[:name], layer_hash[:type], self, @opsworks_client) end end |
#reload ⇒ Object
38 39 40 41 |
# File 'lib/ops_worker/stack.rb', line 38 def reload @layers = nil @apps = nil end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/ops_worker/stack.rb', line 34 def to_s "#<OpsWorker::Stack #{@id}, #{@name}, #{@region}>" end |