Class: Fog::Rackspace::AutoScale::GroupConfig

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/auto_scale/group_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cooldownString (readonly)

Returns The group’s cooldown.

Returns:

  • (String)

    The group’s cooldown



17
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 17

attribute :cooldown

#groupFog::Rackspace::AutoScale::Group (readonly)

Returns The parent group.

Returns:



9
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 9

attribute :group

#max_entitiesFixnum (readonly)

Returns The maximum amount of units which should exist in the group.

Returns:

  • (Fixnum)

    The maximum amount of units which should exist in the group



25
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 25

attribute :max_entities, :aliases => 'maxEntities'

#metadataHash (readonly)

Returns The group’s metadata.

Returns:

  • (Hash)

    The group’s metadata



29
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 29

attribute :metadata

#min_entitiesFixnum (readonly)

Returns The minimum amount of units which should exist in the group.

Returns:

  • (Fixnum)

    The minimum amount of units which should exist in the group



21
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 21

attribute :min_entities, :aliases => 'minEntities'

#nameString (readonly)

Returns The name of the group.

Returns:

  • (String)

    The name of the group



13
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 13

attribute :name

Instance Method Details

#reloadObject

Reloads group configuration



67
68
69
70
71
72
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 67

def reload
  if group.id
    data = service.get_group_config(group.id)
    merge_attributes data.body['groupConfiguration']
  end
end

#saveBoolean

Saves group configuration. This method will only save existing group configurations. New group configurations are created when a scaling group is created

Returns:

  • (Boolean)

    true if group config was saved



57
58
59
60
61
62
63
64
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 57

def save
  if group.id
    update
    true
  else
    raise "New #{self.class} are created when a new Fog::Rackspace::AutoScale::Group is created"
  end
end

#updateBoolean

Update this group’s configuration

Returns:

  • (Boolean)

    returns true if group config has been updated

Raises:

  • (Fog::Rackspace::AutoScale:::NotFound)
    • HTTP 404

  • (Fog::Rackspace::AutoScale:::BadRequest)
    • HTTP 400

  • (Fog::Rackspace::AutoScale:::InternalServerError)
    • HTTP 500

  • (Fog::Rackspace::AutoScale:::ServiceError)

See Also:



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/rackspace/models/auto_scale/group_config.rb', line 41

def update
  options = {}
  options['name'] = name unless name.nil?
  options['cooldown'] = cooldown unless cooldown.nil?
  options['minEntities'] = min_entities
  options['maxEntities'] = max_entities
  options['metadata'] =  unless .nil?

  service.update_group_config(group.id, options)
  true
end