Sha256: ef98bd57b4a43f75a471135f06e0a17b043709240186cf297eaeb8d6729d87e9

Contents?: true

Size: 1.77 KB

Versions: 35

Compression:

Stored size: 1.77 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 data[:health_states].include?(health_status)
            raise Fog::AWS::AutoScaling::ValidationError.new('Valid instance health states are: [#{data[:health_states].join(", ")}].')
          end

          Fog::Mock.not_implemented
        end

      end

    end
  end
end

Version data entries

35 entries across 35 versions & 9 rubygems

Version Path
fog-1.1.2 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog_tractical-1.1.4 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog_tractical-1.1.3 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.1.1 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.1.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
tag-fog-1.0.1 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-1.0.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-0.11.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb
fog-0.10.0 lib/fog/aws/requests/auto_scaling/set_instance_health.rb