Class: CFnDK::StackCommand
- Inherits:
-
Thor
- Object
- Thor
- CFnDK::StackCommand
- Defined in:
- lib/cfndk/stack_command.rb
Instance Method Summary collapse
Methods included from SubcommandHelpReturnable
Methods included from CFnDK::SubcommandHelpReturnable::ClassMethods
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cfndk/stack_command.rb', line 15 def create CFnDK.logger.info 'create...'.color(:green) data = load_config_data() credentials = resolve_credential(data, ) global_config = CFnDK::GlobalConfig.new(data, ) stacks = CFnDK::Stacks.new(data, , credentials) global_config.pre_command_execute stacks.pre_command_execute stacks.validate stacks.create stacks.post_command_execute global_config.post_command_execute return 0 rescue => e CFnDK.logger.error "#{e.class}: #{e.}".color(:red) e.backtrace_locations.each do |line| CFnDK.logger.debug line end return 1 end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cfndk/stack_command.rb', line 65 def destroy CFnDK.logger.info 'destroy...'.color(:green) data = load_config_data() credentials = resolve_credential(data, ) stacks = CFnDK::Stacks.new(data, , credentials) if [:force] || yes?('Are you sure you want to destroy? (y/n)', :yellow) stacks.destroy return 0 else CFnDK.logger.info 'destroy command was canceled'.color(:green) return 2 end rescue => e CFnDK.logger.error "#{e.class}: #{e.}".color(:red) e.backtrace_locations.each do |line| CFnDK.logger.debug line end return 1 end |
#report ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/cfndk/stack_command.rb', line 112 def report CFnDK.logger.info 'report...'.color(:green) data = load_config_data() credentials = resolve_credential(data, ) stacks = CFnDK::Stacks.new(data, , credentials) stacks.report return 0 rescue => e CFnDK.logger.error "#{e.class}: #{e.}".color(:red) e.backtrace_locations.each do |line| CFnDK.logger.debug line end return 1 end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cfndk/stack_command.rb', line 40 def update CFnDK.logger.info 'update...'.color(:green) data = load_config_data() credentials = resolve_credential(data, ) global_config = CFnDK::GlobalConfig.new(data, ) stacks = CFnDK::Stacks.new(data, , credentials) global_config.pre_command_execute stacks.pre_command_execute stacks.validate stacks.update stacks.post_command_execute global_config.post_command_execute return 0 rescue => e CFnDK.logger.error "#{e.class}: #{e.}".color(:red) e.backtrace_locations.each do |line| CFnDK.logger.debug line end return 1 end |
#validate ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cfndk/stack_command.rb', line 88 def validate CFnDK.logger.info 'validate...'.color(:green) data = load_config_data() credentials = resolve_credential(data, ) global_config = CFnDK::GlobalConfig.new(data, ) stacks = CFnDK::Stacks.new(data, , credentials) global_config.pre_command_execute stacks.pre_command_execute stacks.validate stacks.post_command_execute global_config.post_command_execute return 0 rescue => e CFnDK.logger.error "#{e.class}: #{e.}".color(:red) e.backtrace_locations.each do |line| CFnDK.logger.debug line end return 1 end |