Class: Awshark::CloudFormation::Stack
- Inherits:
-
Object
- Object
- Awshark::CloudFormation::Stack
- Extended by:
- Forwardable
- Defined in:
- lib/awshark/cloud_formation/stack.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #create_or_update(params) ⇒ Object
- #events ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(name:) ⇒ Stack
constructor
A new instance of Stack.
- #reload ⇒ Object
- #template ⇒ Hash
Constructor Details
#initialize(name:) ⇒ Stack
Returns a new instance of Stack.
31 32 33 34 |
# File 'lib/awshark/cloud_formation/stack.rb', line 31 def initialize(name:) @name = name @stack = get_stack(name) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/awshark/cloud_formation/stack.rb', line 13 def name @name end |
Instance Method Details
#create_or_update(params) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/awshark/cloud_formation/stack.rb', line 46 def create_or_update(params) if exists? client.update_stack(params) else client.create_stack(params) end end |
#events ⇒ Object
41 42 43 44 |
# File 'lib/awshark/cloud_formation/stack.rb', line 41 def events response = client.describe_stack_events(stack_name: stack_id) response.stack_events end |
#exists? ⇒ Boolean
37 38 39 |
# File 'lib/awshark/cloud_formation/stack.rb', line 37 def exists? @stack.present? end |
#reload ⇒ Object
54 55 56 57 58 |
# File 'lib/awshark/cloud_formation/stack.rb', line 54 def reload @stack = get_stack(name) self end |
#template ⇒ Hash
61 62 63 64 65 66 67 |
# File 'lib/awshark/cloud_formation/stack.rb', line 61 def template return nil unless exists? return @template if @template.present? response = client.get_template(stack_name: stack_id) @template = response.template_body end |