Class: CloudwatchCleanup

Inherits:
AwsCleanup show all
Defined in:
lib/modules/cloudwatch.rb

Constant Summary

Constants inherited from AwsCleanup

AwsCleanup::DELETE_LIMIT, AwsCleanup::TEST_GROUP_ID, AwsCleanup::TEST_GROUP_NAME, AwsCleanup::TEST_INSTANCE_EXPIRE_AGE, AwsCleanup::VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AwsCleanup

#run

Class Method Details

.runObject



2
3
4
# File 'lib/modules/cloudwatch.rb', line 2

def self.run
  CloudwatchCleanup.new.cleaup_alarms
end

Instance Method Details

#cleaup_alarmsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/modules/cloudwatch.rb', line 6

def cleaup_alarms
  oa = orphaned_alarms.map(&:alarm_name)

  if oa.any?
    puts 'Deleting alarms: ' + oa.join(', ')
    cloudwatch.delete_alarms alarm_names: oa
    return
  end

  puts 'No alarms to clean up'
end