Class: Lono::Cfn::Delete
- Inherits:
-
Object
- Object
- Lono::Cfn::Delete
- Includes:
- AwsServices, Util
- Defined in:
- lib/lono/cfn/delete.rb
Instance Method Summary collapse
-
#initialize(stack_name, options = {}) ⇒ Delete
constructor
A new instance of Delete.
- #run ⇒ Object
- #status ⇒ Object
Methods included from Util
#are_you_sure?, #switch_current
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Util
#find_stack, #rollback_complete?, #stack_exists?, #testing_update?
Constructor Details
#initialize(stack_name, options = {}) ⇒ Delete
Returns a new instance of Delete.
6 7 8 9 |
# File 'lib/lono/cfn/delete.rb', line 6 def initialize(stack_name, ={}) @stack_name = switch_current(stack_name) @options = end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lono/cfn/delete.rb', line 11 def run = "Deleted #{@stack_name} stack." if @options[:noop] puts "NOOP #{}" else are_you_sure?(@stack_name, :delete) if stack_exists?(@stack_name) cfn.delete_stack(stack_name: @stack_name) puts else puts "#{@stack_name.inspect} stack does not exist".color(:red) end end return unless @options[:wait] start_time = Time.now status.wait unless @options[:noop] took = Time.now - start_time puts "Time took for stack deletion: #{status.pretty_time(took).color(:green)}." end |