Class: 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.
Attributes inherited from Model
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.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#id ⇒ String (readonly)
Returns The autoscale group’s id.
13 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 13 identity :id |
#links ⇒ Array (readonly)
Returns group links.
17 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 17 attribute :links |
Instance Method Details
#destroy ⇒ Boolean
Destroy the group
135 136 137 138 139 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 135 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.
31 32 33 34 35 36 37 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 31 def group_config if attributes[:group_config].nil? 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.
42 43 44 45 46 47 48 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 42 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.
62 63 64 65 66 67 68 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 62 def launch_config if attributes[:launch_config].nil? 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.
73 74 75 76 77 78 79 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 73 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.
168 169 170 171 172 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 168 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.
88 89 90 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 88 def policies @policies ||= load_model('Policies') end |
#resume ⇒ Boolean
NOT IMPLEMENTED YET
This operation resumes all execution of autoscaling policies.
185 186 187 188 189 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 185 def resume requires :identity data = service.resume_group_state(identity) true end |
#save ⇒ Boolean
Creates group
-
requires attributes: :launch_config, :group_config, :policies
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 104 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
151 152 153 154 155 |
# File 'lib/fog/rackspace/models/auto_scale/group.rb', line 151 def state requires :identity data = service.get_group_state(identity) data.body['group'] end |