Class: Fog::Rackspace::AutoScale::LaunchConfig

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/auto_scale/launch_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

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

Returns The arguments for the operation.

Returns:



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

attribute :args

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

Returns The parent group.

Returns:



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

attribute :group

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

Returns The type of operation (usually “launch_server”).

Returns:



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

attribute :type

Instance Method Details

#reloadObject

Reloads group launch configuration



54
55
56
57
58
59
# File 'lib/fog/rackspace/models/auto_scale/launch_config.rb', line 54

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

#saveBoolean

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

Returns:

  • (Boolean)

    true if launch group was saved



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

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 launch configuration

Returns:

  • (Boolean)

    returns true if launch 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:



30
31
32
33
34
35
36
37
38
# File 'lib/fog/rackspace/models/auto_scale/launch_config.rb', line 30

def update
  
  options = {}
  options['type'] = type unless type.nil?
  options['args'] = args unless args.nil?

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