Sha256: 773b00238edb9d783b9b321403b05b6dc4548417e2971decda3ab7ff14f3173f

Contents?: true

Size: 1.78 KB

Versions: 72

Compression:

Stored size: 1.78 KB

Contents

module Fog
  module AWS
    class AutoScaling

      class Real

        require 'fog/aws/parsers/auto_scaling/basic'

        # Sets the health status of an instance.
        #
        # ==== Parameters
        # * health_status<~String> - The health status of the instance.
        #   "Healthy" means that the instance is healthy and should remain in
        #   service. "Unhealthy" means that the instance is unhealthy. Auto
        #   Scaling should terminate and replace it.
        # * instance_id<~String> - The identifier of the EC2 instance.
        # * options<~Hash>:
        #   * 'ShouldRespectGracePeriod'<~Boolean> - If true, this call should
        #   respect the grace period associated with the group.
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ResponseMetadata'<~Hash>:
        #       * 'RequestId'<~String> - Id of request
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_SetInstanceHealth.html
        #
        def set_instance_health(health_status, instance_id, options = {})
          request({
            'Action'       => 'SetInstanceHealth',
            'HealthStatus' => health_status,
            'InstanceId'   => instance_id,
            :parser        => Fog::Parsers::AWS::AutoScaling::Basic.new
          }.merge!(options))
        end

      end

      class Mock

        def set_instance_health(health_status, instance_id, options = {})
          unless self.data[:health_states].include?(health_status)
            raise Fog::AWS::AutoScaling::ValidationError.new('Valid instance health states are: [#{self.data[:health_states].join(", ")}].')
          end

          Fog::Mock.not_implemented
        end

      end

    end
  end
end

Version data entries

72 entries across 72 versions & 9 rubygems

Version Path
fog-1.10.1 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-test-me-1.10.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.10.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.9.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-sgonyea-1.8.1 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.8.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.7.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb