Class: Fog::Rackspace::AutoScale::GroupBuilder
- Inherits:
-
Object
- Object
- Fog::Rackspace::AutoScale::GroupBuilder
- Defined in:
- lib/fog/rackspace/models/auto_scale/group_builder.rb
Class Method Summary collapse
- .build(service, attributes) ⇒ Object
- .build_group_config(attributes) ⇒ Object
- .build_server_launch_config(attributes) ⇒ Object
Class Method Details
.build(service, attributes) ⇒ Object
11 12 13 |
# File 'lib/fog/rackspace/models/auto_scale/group_builder.rb', line 11 def build(service, attributes) service.groups.new :group_config => build_group_config(attributes), :launch_config => build_server_launch_config(attributes) end |
.build_group_config(attributes) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/fog/rackspace/models/auto_scale/group_builder.rb', line 15 def build_group_config(attributes) Fog::Rackspace::AutoScale::GroupConfig.new :max_entities => attributes[:max_entities], :min_entities => attributes[:min_entities], :cooldown => attributes[:cooldown], :name => attributes[:name], :metadata => attributes[:metadata] || {} end |
.build_server_launch_config(attributes) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fog/rackspace/models/auto_scale/group_builder.rb', line 23 def build_server_launch_config(attributes) return nil unless attributes[:launch_config_type] == :launch_server args = {"server" => build_server_template(attributes) } args["loadBalancers"] = build_load_balancers(attributes) if attributes[:load_balancers] Fog::Rackspace::AutoScale::LaunchConfig.new :type => :launch_server, :args => args end |