Class: Builderator::Model::Cleaner::LaunchConfigs

Inherits:
Base
  • Object
show all
Defined in:
lib/builderator/model/cleaner/launch_configs.rb

Overview

ASG LaunchConfiguration Resources

Constant Summary collapse

PROPERTIES =
%w(launch_configuration_arn key_name security_groups
user_data instance_type spot_price iam_instance_profile
ebs_optimized associate_public_ip_address placement_tenancy)

Instance Attribute Summary

Attributes inherited from Base

#resources

Instance Method Summary collapse

Methods inherited from Base

#find, #in_use?, #initialize, #select, #unused

Constructor Details

This class inherits a constructor from Builderator::Model::Cleaner::Base

Instance Method Details

#fetchObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/builderator/model/cleaner/launch_configs.rb', line 20

def fetch
  @resources = {}.tap do |i|
    Util.asg.describe_launch_configurations.each do |page|
      page.launch_configurations.each do |l|
        properties = { 'creation_date' => l.created_time.to_datetime }
        PROPERTIES.each { |pp| properties[pp] = l[pp.to_sym] }

        i[l.launch_configuration_name] = {
          :id => l.launch_configuration_name,
          :properties => properties,
          :image => l.image_id
        }
      end
    end
  end
end

#imagesObject



37
38
39
# File 'lib/builderator/model/cleaner/launch_configs.rb', line 37

def images
  resources.values.map { |l| l[:image] }
end

#in_useObject



41
42
43
# File 'lib/builderator/model/cleaner/launch_configs.rb', line 41

def in_use
  select(Cleaner.scaling_groups.launch_configs)
end