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

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #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

#cooldownString (readonly)

Returns The group’s cooldown.

Returns:

  • (String)

    The group’s cooldown



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

attribute :cooldown

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

Returns The parent group.

Returns:



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

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



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

attribute :max_entities, :aliases => 'maxEntities'

#metadataHash (readonly)

Returns The group’s metadata.

Returns:

  • (Hash)

    The group’s metadata



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

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



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

attribute :min_entities, :aliases => 'minEntities'

#nameString (readonly)

Returns The name of the group.

Returns:

  • (String)

    The name of the group



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

attribute :name

Instance Method Details

#reloadObject

Reloads group configuration



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

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



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

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:



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

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