class Stackit::ManagedStackService
Attributes
options[RW]
stack_action[RW]
stacks[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 9 def initialize(options) self.options = options || {} end
Public Instance Methods
capabilities()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 102 def capabilities options[:capabilities] end
change_set!()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 28 def change_set! self.stack_action = :change_set! final_stack.change_set! end
change_set_name()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 122 def change_set_name options[:change_set_name] end
create!()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 13 def create! self.stack_action = :create! final_stack.create! end
debug()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 90 def debug !!options[:debug] end
delete!()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 23 def delete! self.stack_action = :delete! final_stack.delete! end
depends()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 54 def depends options[:depends] end
depends_on(deps)
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 58 def depends_on(deps) options[:depends] = deps end
depends_stacks()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 151 def depends_stacks return @depends_stacks unless @depends_stacks.nil? @depends_stacks = [] return @depends_stacks unless options[:depends] options[:depends].each do |stack| @depends_stacks << Stackit::Stack.new(stack_name: stack) end @depends_stacks end
disable_rollback()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 74 def disable_rollback !!options[:debug] ? true : !!options[:disable_rollback] end
dry_run()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 86 def dry_run options[:dry_run] end
force()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 82 def force options[:force] end
notification_arns()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 98 def notification_arns options[:notification_arns] end
on_failure()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 110 def on_failure options[:on_failure] end
parameter_mappings()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 62 def parameter_mappings {} end
parameters_file()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 49 def parameters_file return options[:parameters_file] || File.expand_path("#{options[:stack_name]}.parameters", template_dir) end
resolve_parameter(key)
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 165 def resolve_parameter(key) Stackit.logger.debug "Resolving parameter: #{key}" Stackit::ParameterResolver.new(depends_stacks).resolve(key) end
resolve_parameters(keys)
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 170 def resolve_parameters(keys) Stackit.logger.debug "Resolving parameters: #{keys.join(', ')}" Stackit::ParameterResolver.new(depends_stacks).resolve(keys) end
retain_resources()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 114 def retain_resources options[:retain_resources] end
stack()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 126 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: tags, on_failure: on_failure, use_previous_template: use_previous_template, retain_resources: retain_resources, change_set_name: change_set_name ) end
stack_name()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 33 def stack_name options[:stack_name] || "#{Stackit.environment}-#{options[:stack_name]}" end
stack_policy()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 41 def stack_policy options[:template] end
stack_policy_during_update()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 45 def stack_policy_during_update options[:stack_policy_during_update] end
template()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 37 def template options[:template] || File.expand_path("#{options[:stack_name]}.json", template_dir) end
template_dir()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 70 def template_dir dir = options[:template_dir] ? options[:template_dir] : __dir__ end
timeout_in_minutes()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 94 def timeout_in_minutes options[:timeout_in_minutes] end
update!()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 18 def update! self.stack_action = :update! final_stack.update! end
use_previous_template()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 118 def use_previous_template options[:use_previous_template] end
user_defined_parameters()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 66 def user_defined_parameters {} end
wait()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 78 def wait options[:wait] end
Private Instance Methods
final_stack()
click to toggle source
# File lib/stackit/stack/managed_stack_service.rb, line 177 def final_stack params = user_defined_parameters params.merge!(options[:parameters]) if options[:parameters] stack.instance_variable_set(:@user_defined_parameters, user_defined_parameters) stack end