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.
-
#stacks ⇒ Object
Returns the value of attribute stacks.
Instance Method Summary collapse
- #capabilities ⇒ Object
- #create! ⇒ Object
- #debug ⇒ Object
- #delete! ⇒ Object
- #depends ⇒ 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
8 9 10 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 8 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 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
89 90 91 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 89 def capabilities [:capabilities] end |
#create! ⇒ Object
12 13 14 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 12 def create! final_stack.create! end |
#debug ⇒ Object
77 78 79 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 77 def debug !![:debug] end |
#delete! ⇒ Object
20 21 22 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 20 def delete! final_stack.delete! end |
#depends ⇒ Object
45 46 47 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 45 def depends [:depends] end |
#depends_stacks ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 133 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
61 62 63 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 61 def disable_rollback !![:debug] ? true : !![:disable_rollback] end |
#dry_run ⇒ Object
73 74 75 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 73 def dry_run [:dry_run] end |
#force ⇒ Object
69 70 71 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 69 def force [:force] end |
#notification_arns ⇒ Object
85 86 87 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 85 def notification_arns [:notification_arns] end |
#on_failure ⇒ Object
97 98 99 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 97 def on_failure [:on_failure] end |
#parameter_mappings ⇒ Object
49 50 51 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 49 def parameter_mappings {} end |
#parameters_file ⇒ Object
40 41 42 43 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 40 def parameters_file return [:parameters_file] || File.("#{options[:stack_name]}.parameters", template_dir) end |
#resolve_parameter(key) ⇒ Object
147 148 149 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 147 def resolve_parameter(key) Stackit::ParameterResolver.new(depends_stacks).resolve(key) end |
#resolve_parameters(keys) ⇒ Object
151 152 153 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 151 def resolve_parameters(keys) Stackit::ParameterResolver.new(depends_stacks).resolve(keys) end |
#retain_resources ⇒ Object
101 102 103 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 101 def retain_resources [:retain_resources] end |
#stack ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 109 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
24 25 26 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 24 def stack_name [:stack_name] || "#{Stackit.environment}-#{options[:stack_name]}" end |
#stack_policy ⇒ Object
32 33 34 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 32 def stack_policy [:template] end |
#stack_policy_during_update ⇒ Object
36 37 38 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 36 def stack_policy_during_update [:stack_policy_during_update] end |
#tags ⇒ Object
93 94 95 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 93 def [:tags] end |
#template ⇒ Object
28 29 30 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 28 def template [:template] || File.("#{options[:stack_name]}.json", template_dir) end |
#template_dir ⇒ Object
57 58 59 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 57 def template_dir dir = [:template_dir] ? [:template_dir] : __dir__ end |
#timeout_in_minutes ⇒ Object
81 82 83 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 81 def timeout_in_minutes [:timeout_in_minutes] end |
#update! ⇒ Object
16 17 18 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 16 def update! final_stack.update! end |
#use_previous_template ⇒ Object
105 106 107 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 105 def use_previous_template [:use_previous_template] end |
#user_defined_parameters ⇒ Object
53 54 55 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 53 def user_defined_parameters {} end |
#wait ⇒ Object
65 66 67 |
# File 'lib/stackit/stack/managed_stack_service.rb', line 65 def wait [:wait] end |