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

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Instance

Returns a new instance of Instance.



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

def initialize(attributes={})
  super
end

Instance Method Details

#configurationObject



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

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

#groupObject



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

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

#healthy?Boolean

Returns:

  • (Boolean)


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

def healthy?
  health_status == 'Healthy'
end

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  life_cycle_state == 'InService'
end

#reloadObject



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

def reload
  super
  self
end

#set_health(health_status, options) ⇒ Object



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

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

#terminate(should_decrement_desired_capacity) ⇒ Object



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

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