Class: Stackit::ManagedStackService
- Inherits:
-
Object
- Object
- Stackit::ManagedStackService
- Defined in:
- lib/stackit/stack/managed_stack_service.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#stack_action ⇒ Object
Returns the value of attribute stack_action.
-
#stacks ⇒ Object
Returns the value of attribute stacks.
Instance Method Summary collapse
- #capabilities ⇒ Object
- #create! ⇒ Object
- #debug ⇒ Object
- #delete! ⇒ Object
- #depends ⇒ Object
- #depends_on(deps) ⇒ Object
- #depends_stacks ⇒ Object
- #disable_rollback ⇒ Object
- #dry_run ⇒ Object
- #force ⇒ Object
-
#initialize(options) ⇒ ManagedStackService
constructor
A new instance of ManagedStackService.
- #notification_arns ⇒ Object
- #on_failure ⇒ Object
- #parameter_mappings ⇒ Object
- #parameters_file ⇒ Object
- #resolve_parameter(key) ⇒ Object
- #resolve_parameters(keys) ⇒ Object
- #retain_resources ⇒ Object
- #stack ⇒ Object
- #stack_name ⇒ Object
- #stack_policy ⇒ Object
- #stack_policy_during_update ⇒ Object
- #tags ⇒ Object
- #template ⇒ Object
- #template_dir ⇒ Object
- #timeout_in_minutes ⇒ Object
- #update! ⇒ Object
- #use_previous_template ⇒ Object
- #user_defined_parameters ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize(options) ⇒ ManagedStackService
Returns a new instance of ManagedStackService.
9 10 11 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 9 def initialize() self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 5 def @options end |
#stack_action ⇒ Object
Returns the value of attribute stack_action.
7 8 9 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 7 def stack_action @stack_action end |
#stacks ⇒ Object
Returns the value of attribute stacks.
6 7 8 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 6 def stacks @stacks end |
Instance Method Details
#capabilities ⇒ Object
99 100 101 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 99 def capabilities [:capabilities] end |
#create! ⇒ Object
13 14 15 16 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 13 def create! self.stack_action = :create! final_stack.create! end |
#debug ⇒ Object
87 88 89 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 87 def debug !![:debug] end |
#delete! ⇒ Object
23 24 25 26 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 23 def delete! self.stack_action = :delete! final_stack.delete! end |
#depends ⇒ Object
49 50 51 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 49 def depends [:depends] end |
#depends_on(deps) ⇒ Object
53 54 55 56 57 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 53 def depends_on(deps) if [:depends] && [:depends].empty? [:depends] = deps end end |
#depends_stacks ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 143 def depends_stacks return @depends_stacks unless @depends_stacks.nil? @depends_stacks = [] return @depends_stacks unless [:depends] [:depends].each do |stack| @depends_stacks << Stackit::Stack.new(stack_name: stack) end @depends_stacks end |
#disable_rollback ⇒ Object
71 72 73 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 71 def disable_rollback !![:debug] ? true : !![:disable_rollback] end |
#dry_run ⇒ Object
83 84 85 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 83 def dry_run [:dry_run] end |
#force ⇒ Object
79 80 81 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 79 def force [:force] end |
#notification_arns ⇒ Object
95 96 97 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 95 def notification_arns [:notification_arns] end |
#on_failure ⇒ Object
107 108 109 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 107 def on_failure [:on_failure] end |
#parameter_mappings ⇒ Object
59 60 61 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 59 def parameter_mappings {} end |
#parameters_file ⇒ Object
44 45 46 47 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 44 def parameters_file return [:parameters_file] || File.("#{[:stack_name]}.parameters", template_dir) end |
#resolve_parameter(key) ⇒ Object
157 158 159 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 157 def resolve_parameter(key) Stackit::ParameterResolver.new(depends_stacks).resolve(key) end |
#resolve_parameters(keys) ⇒ Object
161 162 163 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 161 def resolve_parameters(keys) Stackit::ParameterResolver.new(depends_stacks).resolve(keys) end |
#retain_resources ⇒ Object
111 112 113 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 111 def retain_resources [:retain_resources] end |
#stack ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 119 def stack @stack ||= ManagedStack.new( template: template, stack_name: stack_name, stack_policy: stack_policy, stack_policy_during_update: stack_policy_during_update, depends: depends, parameters_file: parameters_file, parameter_map: parameter_mappings, disable_rollback: disable_rollback, wait: wait, force: force, dry_run: dry_run, debug: debug, timeout_in_minutes: timeout_in_minutes, notification_arns: notification_arns, capabilities: capabilities, tags: , on_failure: on_failure, use_previous_template: use_previous_template, retain_resources: retain_resources ) end |
#stack_name ⇒ Object
28 29 30 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 28 def stack_name [:stack_name] || "#{Stackit.environment}-#{[:stack_name]}" end |
#stack_policy ⇒ Object
36 37 38 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 36 def stack_policy [:template] end |
#stack_policy_during_update ⇒ Object
40 41 42 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 40 def stack_policy_during_update [:stack_policy_during_update] end |
#tags ⇒ Object
103 104 105 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 103 def [:tags] end |
#template ⇒ Object
32 33 34 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 32 def template [:template] || File.("#{[:stack_name]}.json", template_dir) end |
#template_dir ⇒ Object
67 68 69 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 67 def template_dir dir = [:template_dir] ? [:template_dir] : __dir__ end |
#timeout_in_minutes ⇒ Object
91 92 93 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 91 def timeout_in_minutes [:timeout_in_minutes] end |
#update! ⇒ Object
18 19 20 21 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 18 def update! self.stack_action = :update! final_stack.update! end |
#use_previous_template ⇒ Object
115 116 117 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 115 def use_previous_template [:use_previous_template] end |
#user_defined_parameters ⇒ Object
63 64 65 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 63 def user_defined_parameters {} end |
#wait ⇒ Object
75 76 77 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 75 def wait [:wait] end |