Module: Cumulus::AutoScaling::Loader

Includes:
Common::BaseLoader
Defined in:
lib/autoscaling/loader/Loader.rb

Overview

Public: Load AutoScaling assets

Constant Summary collapse

@@groups_dir =
Configuration.instance.autoscaling.groups_directory
@@group_loader =
Proc.new { |name, json| GroupConfig.new(name, json) }
@@static_dir =
Configuration.instance.autoscaling.static_policy_directory
@@template_dir =
Configuration.instance.autoscaling.template_policy_directory
@@policy_loader =
Proc.new { |name, json| PolicyConfig.new(json) }

Class Method Summary collapse

Methods included from Common::BaseLoader

load_file, resource, resources, template

Class Method Details

.group(file) ⇒ Object

Public: Load a single autoscaling group configuration as a GroupConfig object

file - the name of the file the configuration is located in

Returns the corresponding GroupConfig object



31
32
33
# File 'lib/autoscaling/loader/Loader.rb', line 31

def Loader.group(file)
  Common::BaseLoader.resource(file, @@groups_dir, &@@group_loader)
end

.groupsObject

Public: Load all autoscaling group configurations as GroupConfig objects

Returns an array of GroupConfig objects



21
22
23
# File 'lib/autoscaling/loader/Loader.rb', line 21

def Loader.groups
  Common::BaseLoader.resources(@@groups_dir, &@@group_loader)
end

.static_policy(file) ⇒ Object

Public: Load a static scaling policy

file - the file the policy definition is found in

Returns a PolicyConfig object that contains the configuration



40
41
42
# File 'lib/autoscaling/loader/Loader.rb', line 40

def Loader.static_policy(file)
  Common::BaseLoader.resource(file, @@static_dir, &@@policy_loader)
end

.template_policy(file, variables) ⇒ Object

Public: Load a template scaling policy

file - the file the template definition is found in variables - a Hash of variables to apply to the template

Returns a PolicyConfig object corresponding to the applied template



50
51
52
# File 'lib/autoscaling/loader/Loader.rb', line 50

def Loader.template_policy(file, variables)
  Common::BaseLoader.template(file, @@template_dir, variables, &@@policy_loader)
end