Class: Cumulus::ELB::HealthCheckConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/elb/models/HealthCheckConfig.rb

Overview

Public: An object representing configuration for a load balancer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json = nil) ⇒ HealthCheckConfig

Public: Constructor

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



18
19
20
21
22
23
24
25
26
# 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

Instance Attribute Details

#healthyObject (readonly)

Returns the value of attribute healthy.



12
13
14
# File 'lib/elb/models/HealthCheckConfig.rb', line 12

def healthy
  @healthy
end

#intervalObject (readonly)

Returns the value of attribute interval.



10
11
12
# File 'lib/elb/models/HealthCheckConfig.rb', line 10

def interval
  @interval
end

#targetObject (readonly)

Returns the value of attribute target.



9
10
11
# File 'lib/elb/models/HealthCheckConfig.rb', line 9

def target
  @target
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



11
12
13
# File 'lib/elb/models/HealthCheckConfig.rb', line 11

def timeout
  @timeout
end

#unhealthyObject (readonly)

Returns the value of attribute unhealthy.



13
14
15
# File 'lib/elb/models/HealthCheckConfig.rb', line 13

def unhealthy
  @unhealthy
end

Instance Method Details

#diff(aws) ⇒ Object

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 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) ⇒ Object



48
49
50
51
52
53
54
# 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_awsObject



38
39
40
41
42
43
44
45
46
# 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_hashObject



28
29
30
31
32
33
34
35
36
# 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