Class: Ec2::Blackout::Shutdown

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2-blackout/shutdown.rb

Instance Method Summary collapse

Constructor Details

#initialize(ui, options) ⇒ Shutdown

Returns a new instance of Shutdown


5
6
7
# File 'lib/ec2-blackout/shutdown.rb', line 5

def initialize(ui, options)
  @ui, @options = ui, options
end

Instance Method Details

#executeObject


9
10
11
12
13
14
15
16
17
18
# File 'lib/ec2-blackout/shutdown.rb', line 9

def execute
  @ui.say 'Dry run specified - no instances will be stopped'.bold if @options.dry_run
  @ui.say "Stopping instances"
  @options.regions.each do |region|
    @ui.say "Checking region #{region}"
    shutdown(Ec2::Blackout::AutoScalingGroup.groups(region, @options))
    shutdown(Ec2::Blackout::Ec2Instance.running_instances(region, @options))
  end
  @ui.say 'Done!'
end