Class: OCI::LoadBalancer::Models::HealthChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/load_balancer/models/health_checker.rb

Overview

The health check policy configuration. For more information, see [Editing Health Check Policies](docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/editinghealthcheck.htm).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ HealthChecker

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :interval_in_millis (Integer)

    The value to assign to the #interval_in_millis property

  • :port (Integer)

    The value to assign to the #port property

  • :protocol (String)

    The value to assign to the #protocol property

  • :response_body_regex (String)

    The value to assign to the #response_body_regex property

  • :retries (Integer)

    The value to assign to the #retries property

  • :return_code (Integer)

    The value to assign to the #return_code property

  • :timeout_in_millis (Integer)

    The value to assign to the #timeout_in_millis property

  • :url_path (String)

    The value to assign to the #url_path property



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/oci/load_balancer/models/health_checker.rb', line 80

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes[:'intervalInMillis']
    self.interval_in_millis = attributes[:'intervalInMillis']
  end

  raise 'You cannot provide both :intervalInMillis and :interval_in_millis' if attributes.key?(:'intervalInMillis') && attributes.key?(:'interval_in_millis')

  if attributes[:'interval_in_millis']
    self.interval_in_millis = attributes[:'interval_in_millis']
  end

  if attributes[:'port']
    self.port = attributes[:'port']
  end

  if attributes[:'protocol']
    self.protocol = attributes[:'protocol']
  end

  if attributes[:'responseBodyRegex']
    self.response_body_regex = attributes[:'responseBodyRegex']
  end

  raise 'You cannot provide both :responseBodyRegex and :response_body_regex' if attributes.key?(:'responseBodyRegex') && attributes.key?(:'response_body_regex')

  if attributes[:'response_body_regex']
    self.response_body_regex = attributes[:'response_body_regex']
  end

  if attributes[:'retries']
    self.retries = attributes[:'retries']
  end

  if attributes[:'returnCode']
    self.return_code = attributes[:'returnCode']
  end

  raise 'You cannot provide both :returnCode and :return_code' if attributes.key?(:'returnCode') && attributes.key?(:'return_code')

  if attributes[:'return_code']
    self.return_code = attributes[:'return_code']
  end

  if attributes[:'timeoutInMillis']
    self.timeout_in_millis = attributes[:'timeoutInMillis']
  end

  raise 'You cannot provide both :timeoutInMillis and :timeout_in_millis' if attributes.key?(:'timeoutInMillis') && attributes.key?(:'timeout_in_millis')

  if attributes[:'timeout_in_millis']
    self.timeout_in_millis = attributes[:'timeout_in_millis']
  end

  if attributes[:'urlPath']
    self.url_path = attributes[:'urlPath']
  end

  raise 'You cannot provide both :urlPath and :url_path' if attributes.key?(:'urlPath') && attributes.key?(:'url_path')

  if attributes[:'url_path']
    self.url_path = attributes[:'url_path']
  end

end

Instance Attribute Details

#interval_in_millisInteger

The interval between health checks, in milliseconds. The default is 10000 (10 seconds).

Example: ‘30000`

Returns:

  • (Integer)


15
16
17
# File 'lib/oci/load_balancer/models/health_checker.rb', line 15

def interval_in_millis
  @interval_in_millis
end

#portInteger

[Required] The backend server port against which to run the health check. If the port is not specified, the load balancer uses the port information from the ‘Backend` object.

Example: ‘8080`

Returns:

  • (Integer)


23
24
25
# File 'lib/oci/load_balancer/models/health_checker.rb', line 23

def port
  @port
end

#protocolString

[Required] The protocol the health check must use; either HTTP or TCP.

Example: ‘HTTP`

Returns:

  • (String)


30
31
32
# File 'lib/oci/load_balancer/models/health_checker.rb', line 30

def protocol
  @protocol
end

#response_body_regexString

[Required] A regular expression for parsing the response body from the backend server.

Example: ‘^(500|40)$`

Returns:

  • (String)


37
38
39
# File 'lib/oci/load_balancer/models/health_checker.rb', line 37

def response_body_regex
  @response_body_regex
end

#retriesInteger

The number of retries to attempt before a backend server is considered "unhealthy". Defaults to 3.

Example: ‘3`

Returns:

  • (Integer)


44
45
46
# File 'lib/oci/load_balancer/models/health_checker.rb', line 44

def retries
  @retries
end

#return_codeInteger

[Required] The status code a healthy backend server should return. If you configure the health check policy to use the HTTP protocol, you can use common HTTP status codes such as "200".

Example: ‘200`

Returns:

  • (Integer)


52
53
54
# File 'lib/oci/load_balancer/models/health_checker.rb', line 52

def return_code
  @return_code
end

#timeout_in_millisInteger

The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply returns within this timeout period. Defaults to 3000 (3 seconds).

Example: ‘6000`

Returns:

  • (Integer)


60
61
62
# File 'lib/oci/load_balancer/models/health_checker.rb', line 60

def timeout_in_millis
  @timeout_in_millis
end

#url_pathString

The path against which to run the health check.

Example: ‘/healthcheck`

Returns:

  • (String)


67
68
69
# File 'lib/oci/load_balancer/models/health_checker.rb', line 67

def url_path
  @url_path
end

Instance Method Details

#==(other_object) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other_object (Object)

    to be compared



152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/load_balancer/models/health_checker.rb', line 152

def ==(other_object)
  return true if self.equal?(other_object)
  self.class == other_object.class &&
      interval_in_millis == other_object.interval_in_millis &&
      port == other_object.port &&
      protocol == other_object.protocol &&
      response_body_regex == other_object.response_body_regex &&
      retries == other_object.retries &&
      return_code == other_object.return_code &&
      timeout_in_millis == other_object.timeout_in_millis &&
      url_path == other_object.url_path
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/oci/load_balancer/models/health_checker.rb', line 180

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other_object) ⇒ Boolean

Parameters:

  • other_object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


167
168
169
# File 'lib/oci/load_balancer/models/health_checker.rb', line 167

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



173
174
175
# File 'lib/oci/load_balancer/models/health_checker.rb', line 173

def hash
  [interval_in_millis, port, protocol, response_body_regex, retries, return_code, timeout_in_millis, url_path].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



205
206
207
208
209
210
211
212
213
# File 'lib/oci/load_balancer/models/health_checker.rb', line 205

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



199
200
201
# File 'lib/oci/load_balancer/models/health_checker.rb', line 199

def to_s
  to_hash.to_s
end