Sha256: e283919c58c720f94ba89a8d6eeccfad8bede6ddcaeab5fa68c5b6f3fc09b86d

Contents?: true

Size: 906 Bytes

Versions: 14

Compression:

Stored size: 906 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 = "Deleted #{@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)
        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-5.3.4 lib/lono/cfn/delete.rb
lono-5.3.3 lib/lono/cfn/delete.rb
lono-5.3.2 lib/lono/cfn/delete.rb
lono-5.3.1 lib/lono/cfn/delete.rb
lono-5.3.0 lib/lono/cfn/delete.rb
lono-5.2.8 lib/lono/cfn/delete.rb
lono-5.2.7 lib/lono/cfn/delete.rb
lono-5.2.6 lib/lono/cfn/delete.rb
lono-5.2.5 lib/lono/cfn/delete.rb
lono-5.2.4 lib/lono/cfn/delete.rb
lono-5.2.3 lib/lono/cfn/delete.rb
lono-5.2.2 lib/lono/cfn/delete.rb
lono-5.2.1 lib/lono/cfn/delete.rb
lono-5.2.0 lib/lono/cfn/delete.rb