class Cumulus::ELB::HealthCheckConfig

Public: An object representing configuration for a load balancer

Attributes

healthy[R]
interval[R]
target[R]
timeout[R]
unhealthy[R]

Public Class Methods

new(json = nil) click to toggle source

Public: Constructor

json - a hash containing the JSON configuration for the load balancer

# File lib/elb/models/HealthCheckConfig.rb, line 18
def initialize(json = nil)
  if !json.nil?
    @target = json["target"]
    @interval = json["interval"]
    @timeout = json["timeout"]
    @healthy = json["healthy"]
    @unhealthy = json["unhealthy"]
  end
end

Public Instance Methods

diff(aws) click to toggle source

Public: Produce an array of differences between this local configuration and the configuration in AWS

aws - the AWS resource

Returns an array of the HealthCheckDiffs that were found

# File lib/elb/models/HealthCheckConfig.rb, line 62
def diff(aws)
  diffs = []

  if @target != aws.target
    diffs << HealthCheckDiff.new(HealthCheckChange::TARGET, aws.target, @target)
  end

  if @interval != aws.interval
    diffs << HealthCheckDiff.new(HealthCheckChange::INTERVAL, aws.interval, @interval)
  end

  if @timeout != aws.timeout
    diffs << HealthCheckDiff.new(HealthCheckChange::TIMEOUT, aws.timeout, @timeout)
  end

  if @healthy != aws.healthy_threshold
    diffs << HealthCheckDiff.new(HealthCheckChange::HEALTHY, aws.healthy_threshold, @healthy)
  end

  if @unhealthy != aws.unhealthy_threshold
    diffs << HealthCheckDiff.new(HealthCheckChange::UNHEALTHY, aws.unhealthy_threshold, @unhealthy)
  end

  diffs
end
populate!(aws) click to toggle source
# File lib/elb/models/HealthCheckConfig.rb, line 48
def populate!(aws)
  @target = aws.target
  @interval = aws.interval
  @timeout = aws.timeout
  @healthy = aws.healthy_threshold
  @unhealthy = aws.unhealthy_threshold
end
to_aws() click to toggle source
# File lib/elb/models/HealthCheckConfig.rb, line 38
def to_aws
  {
    target: @target,
    interval: @interval,
    timeout: @timeout,
    healthy_threshold: @healthy,
    unhealthy_threshold: @unhealthy,
  }
end
to_hash() click to toggle source
# File lib/elb/models/HealthCheckConfig.rb, line 28
def to_hash
  {
    "target" => @target,
    "interval" => @interval,
    "timeout" => @timeout,
    "healthy" => @healthy,
    "unhealthy" => @unhealthy,
  }.reject { |k, v| v.nil? }
end