Class: Pipedream::Delete

Inherits:
Object
  • Object
show all
Includes:
AwsServices
Defined in:
lib/pipedream/delete.rb

Instance Method Summary collapse

Methods included from AwsServices

#cfn, #codepipeline, #s3

Methods included from AwsServices::Helpers

#are_you_sure?, #inferred_pipeline_name, #inferred_stack_name, #pipeline_name_convention, #stack_exists?

Constructor Details

#initialize(options) ⇒ Delete

Returns a new instance of Delete.



5
6
7
8
9
# File 'lib/pipedream/delete.rb', line 5

def initialize(options)
  @options = options
  @pipeline_name = options[:pipeline_name] || inferred_pipeline_name
  @stack_name = options[:stack_name] || inferred_stack_name(@pipeline_name)
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pipedream/delete.rb', line 11

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
end