Class: Fog::Rackspace::AutoScale::Group
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::AutoScale::Group
- Defined in:
- lib/fog/rackspace/models/auto_scale/group.rb
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The autoscale group’s id.
-
#links ⇒ Array
readonly
Group links.
Instance Method Summary collapse
-
#destroy ⇒ Boolean
Destroy the group.
-
#group_config ⇒ Fog::Rackspace::AutoScale::GroupConfiguration
Gets the group configuration for this autoscale group.
-
#group_config=(object = {}) ⇒ Object
Sets the configuration when this object is populated.
-
#launch_config ⇒ Fog::Rackspace::AutoScale::LaunchConfiguration
Gets the launch configuration for this autoscale group.
-
#launch_config=(object = {}) ⇒ Object
Sets the configuration when this object is populated.
-
#pause ⇒ Boolean
This operation pauses all execution of autoscaling policies.
-
#policies ⇒ Fog::Rackspace::AutoScale::Policies
For the specified autoscaling group, this operation returns a list of the scaling policies that are available to the group.
-
#resume ⇒ Boolean
This operation resumes all execution of autoscaling policies.
-
#save ⇒ Boolean
Creates group * requires attributes: :launch_config, :group_config, :policies.
-
#state ⇒ String
Get the current state of the autoscale group.
Instance Attribute Details
#id ⇒ String (readonly)
Returns The autoscale group’s id.
12 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 12 identity :id |
#links ⇒ Array (readonly)
Returns group links.
16 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 16 attribute :links |
Instance Method Details
#destroy ⇒ Boolean
Destroy the group
143 144 145 146 147 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 143 def destroy requires :identity service.delete_group(identity) true end |
#group_config ⇒ Fog::Rackspace::AutoScale::GroupConfiguration
Gets the group configuration for this autoscale group. The configuration describes the minimum number of entities in the group, the maximum number of entities in the group, the global cooldown time for the group, and other metadata.
30 31 32 33 34 35 36 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 30 def group_config if attributes[:group_config].nil? && persisted? data = service.get_group_config(identity) attributes[:group_config] = load_model('GroupConfig', data.body['groupConfiguration']) end attributes[:group_config] end |
#group_config=(object = {}) ⇒ Object
Sets the configuration when this object is populated.
41 42 43 44 45 46 47 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 41 def group_config=(object = {}) if object.is_a?(Hash) attributes[:group_config] = load_model('GroupConfig', object) else attributes[:group_config] = object end end |
#launch_config ⇒ Fog::Rackspace::AutoScale::LaunchConfiguration
Gets the launch configuration for this autoscale group. The launch configuration describes the details of how to create a server, from what image to create a server, which load balancers to join the server to, which networks to add the server to, and other metadata.
61 62 63 64 65 66 67 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 61 def launch_config if attributes[:launch_config].nil? && persisted? data = service.get_launch_config(identity) attributes[:launch_config] = load_model('LaunchConfig', data.body['launchConfiguration']) end attributes[:launch_config] end |
#launch_config=(object = {}) ⇒ Object
Sets the configuration when this object is populated.
72 73 74 75 76 77 78 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 72 def launch_config=(object={}) if object.is_a?(Hash) attributes[:launch_config] = load_model('LaunchConfig', object) else attributes[:launch_config] = object end end |
#pause ⇒ Boolean
NOT IMPLEMENTED YET
This operation pauses all execution of autoscaling policies.
176 177 178 179 180 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 176 def pause requires :identity data = service.pause_group_state(identity) true end |
#policies ⇒ Fog::Rackspace::AutoScale::Policies
For the specified autoscaling group, this operation returns a list of the scaling policies that are available to the group. Each policy is described in terms of an ID, name, type, adjustment, cooldown time, and links.
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 87 def policies return @policies if @policies if persisted? @policies = load_model('Policies') else @policies = Fog::Rackspace::AutoScale::Policies.new(:service => service, :group => self) @policies.clear end @policies # return nil unless persisted? # @policies ||= load_model('Policies') end |
#resume ⇒ Boolean
NOT IMPLEMENTED YET
This operation resumes all execution of autoscaling policies.
193 194 195 196 197 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 193 def resume requires :identity data = service.resume_group_state(identity) true end |
#save ⇒ Boolean
Creates group
-
requires attributes: :launch_config, :group_config, :policies
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 112 def save requires :launch_config, :group_config, :policies raise Fog::Errors::Error.new("You should update launch_config and group_config directly") if persisted? launch_config_hash = { 'args' => launch_config.args, 'type' => launch_config.type } group_config_hash = { 'name' => group_config.name, 'cooldown' => group_config.cooldown, 'maxEntities' => group_config.max_entities, 'minEntities' => group_config.min_entities } group_config_hash['metadata'] = group_config. if group_config. data = service.create_group(launch_config_hash, group_config_hash, policies) merge_attributes(data.body['group']) true end |
#state ⇒ String
Get the current state of the autoscale group
159 160 161 162 163 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 159 def state requires :identity data = service.get_group_state(identity) data.body['group'] end |