Class: Lono::Cfn::Delete
- Inherits:
-
Object
- Object
- Lono::Cfn::Delete
- Includes:
- AwsServices, Utils::Sure
- Defined in:
- lib/lono/cfn/delete.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Delete
constructor
A new instance of Delete.
- #run ⇒ Object
- #status ⇒ Object
Methods included from Utils::Sure
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Helper
#rollback_complete?, #testing_update?
Methods included from AwsServices::StackSet
#find_stack_set, #stack_set_exists?
Methods included from AwsServices::Stack
Constructor Details
#initialize(options = {}) ⇒ Delete
Returns a new instance of Delete.
6 7 8 9 |
# File 'lib/lono/cfn/delete.rb', line 6 def initialize(={}) = @stack = .delete(:stack) 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 32 |
# File 'lib/lono/cfn/delete.rb', line 11 def run = "Deleting #{@stack} stack." if [:noop] puts "NOOP #{message}" else sure?("Are you sure you want to delete the #{@stack} stack?") if stack_exists?(@stack) cfn.delete_stack(stack_name: @stack) puts else puts "#{@stack.inspect} stack does not exist".color(:red) return end end return unless [:wait] start_time = Time.now status.wait unless [:noop] took = Time.now - start_time puts "Time took for stack deletion: #{status.pretty_time(took).color(:green)}." end |
#status ⇒ Object
34 35 36 |
# File 'lib/lono/cfn/delete.rb', line 34 def status @status ||= Status.new(@stack) end |