Sha256: 7abe22cf57e44f5eccd16094c655075a5e81c8785d0c45deb7e933a151636613

Contents?: true

Size: 1.53 KB

Versions: 65

Compression:

Stored size: 1.53 KB

Contents

require 'fog/core/model'

module Fog
  module AWS
    class AutoScaling
      class Instance < Fog::Model

        identity  :id,                        :aliases => 'InstanceId'
        attribute :auto_scaling_group_name,   :aliases => 'AutoScalingGroupName'
        attribute :availability_zone,         :aliases => 'AvailabilityZone'
        attribute :health_status,             :aliases => 'HealthStatus'
        attribute :launch_configuration_name, :aliases => 'LaunchConfigurationName'
        attribute :life_cycle_state,          :aliases => 'LifecycleState'

        def initialize(attributes={})
          super
        end

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

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

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

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

        def healthy?
          health_status == 'HEALTHY'
        end

        def ready?
          life_cycle_state == 'InService'
        end

        def reload
          super
          self
        end

        #def destroy
        #  requires :id
        #  service.delete_auto_scaling_group(id)
        #end

      end
    end
  end
end

Version data entries

65 entries across 65 versions & 6 rubygems

Version Path
fog-1.22.0 lib/fog/aws/models/auto_scaling/instance.rb
fog-1.21.0 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/models/auto_scaling/instance.rb
fog-1.20.0 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/models/auto_scaling/instance.rb
fog-1.19.0 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/models/auto_scaling/instance.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/models/auto_scaling/instance.rb