Sha256: bb4ec0547f42a7bd664526da0f16c5aa0a012d2454e825449686b52ac02ac4bc

Contents?: true

Size: 924 Bytes

Versions: 14

Compression:

Stored size: 924 Bytes

Contents

class Lono::Cfn
  class Delete
    include Lono::AwsServices
    include Util

    def initialize(stack_name, options={})
      @stack_name = switch_current(stack_name)
      @options = options
    end

    def run
      message = "Deleting #{@stack_name} stack."
      if @options[:noop]
        puts "NOOP #{message}"
      else
        are_you_sure?(@stack_name, :delete)

        if stack_exists?(@stack_name)
          cfn.delete_stack(stack_name: @stack_name)
          puts message
        else
          puts "#{@stack_name.inspect} stack does not exist".color(:red)
          return
        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

    def status
      @status ||= Status.new(@stack_name)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
lono-6.1.11 lib/lono/cfn/delete.rb
lono-6.1.10 lib/lono/cfn/delete.rb
lono-6.1.9 lib/lono/cfn/delete.rb
lono-6.1.8 lib/lono/cfn/delete.rb
lono-6.1.7 lib/lono/cfn/delete.rb
lono-6.1.6 lib/lono/cfn/delete.rb
lono-6.1.5 lib/lono/cfn/delete.rb
lono-6.1.4 lib/lono/cfn/delete.rb
lono-6.1.3 lib/lono/cfn/delete.rb
lono-6.1.2 lib/lono/cfn/delete.rb
lono-6.1.1 lib/lono/cfn/delete.rb
lono-6.1.0 lib/lono/cfn/delete.rb
lono-6.0.1 lib/lono/cfn/delete.rb
lono-6.0.0 lib/lono/cfn/delete.rb