Class: Fog::AWS::AutoScaling::Instance

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

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 Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Fog::Attributes::InstanceMethods

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

Constructor Details

#initialize(attributes = {}) ⇒ Instance

Returns a new instance of Instance.



15
16
17
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 15

def initialize(attributes={})
  super
end

Instance Method Details

#configurationObject



23
24
25
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 23

def configuration
  service.configurations.get(attributes['LaunchConfigurationName'])
end

#groupObject



19
20
21
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 19

def group
  service.groups.get(attributes['AutoScalingGroupName'])
end

#healthy?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 39

def healthy?
  health_status == 'HEALTHY'
end

#ready?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 43

def ready?
  life_cycle_state == 'InService'
end

#reloadObject



47
48
49
50
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 47

def reload
  super
  self
end

#set_health(health_status, options) ⇒ Object



27
28
29
30
31
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 27

def set_health(health_status, options)
  requires :id
  service.set_instance_health(health_status, id, options)
  reload
end

#terminate(should_decrement_desired_capacity) ⇒ Object



33
34
35
36
37
# File 'lib/fog/aws/models/auto_scaling/instance.rb', line 33

def terminate(should_decrement_desired_capacity)
  requires :id
  service.terminate_instance_in_auto_scaling_group(id, should_decrement_desired_capacity)
  reload
end