Class: Fog::AWS::AutoScaling::Configuration

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/auto_scaling/configuration.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #symbolize_keys, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ Configuration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/models/auto_scaling/configuration.rb', line 22

def initialize(attributes={})
  #attributes[:availability_zones] ||= %w(us-east-1a us-east-1b us-east-1c us-east-1d)
  #attributes['ListenerDescriptions'] ||= [{
  #  'Listener' => {'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'http'},
  #  'PolicyNames' => []
  #}]
  #attributes['Policies'] ||= {'AppCookieStickinessPolicies' => [], 'LBCookieStickinessPolicies' => []}
  super
end

Instance Method Details

#destroyObject



57
58
59
60
# File 'lib/fog/aws/models/auto_scaling/configuration.rb', line 57

def destroy
  requires :id
  connection.delete_launch_configuration(id)
end

#ready?Boolean

Returns:

  • (Boolean)


32
33
34
35
# File 'lib/fog/aws/models/auto_scaling/configuration.rb', line 32

def ready?
  # AutoScaling requests are synchronous
  true
end

#reloadObject



52
53
54
55
# File 'lib/fog/aws/models/auto_scaling/configuration.rb', line 52

def reload
  super
  self
end

#saveObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/aws/models/auto_scaling/configuration.rb', line 37

def save
  requires :id
  requires :image_id
  requires :instance_type

  options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
  options.delete_if { |key, value| value.nil? }
  connection.create_launch_configuration(image_id, instance_type, id, options) #, listeners.map{|l| l.to_params})

  # reload instead of merge attributes b/c some attrs (like HealthCheck)
  # may be set, but only the DNS name is returned in the create_load_balance
  # API call
  reload
end