Class: OCI::NetworkLoadBalancer::Models::HealthCheckerDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/network_load_balancer/models/health_checker_details.rb

Overview

The health check policy configuration. For more information, see Editing Health Check Policies.

Constant Summary collapse

PROTOCOL_ENUM =
[
  PROTOCOL_HTTP = 'HTTP'.freeze,
  PROTOCOL_HTTPS = 'HTTPS'.freeze,
  PROTOCOL_TCP = 'TCP'.freeze,
  PROTOCOL_UDP = 'UDP'.freeze,
  PROTOCOL_DNS = 'DNS'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ HealthCheckerDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 147

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 }

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

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

  self.retries = attributes[:'retries'] if attributes[:'retries']
  self.retries = 3 if retries.nil? && !attributes.key?(:'retries') # rubocop:disable Style/StringLiterals

  self.timeout_in_millis = attributes[:'timeoutInMillis'] if attributes[:'timeoutInMillis']
  self.timeout_in_millis = 3000 if timeout_in_millis.nil? && !attributes.key?(:'timeoutInMillis') # rubocop:disable Style/StringLiterals

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

  self.timeout_in_millis = attributes[:'timeout_in_millis'] if attributes[:'timeout_in_millis']
  self.timeout_in_millis = 3000 if timeout_in_millis.nil? && !attributes.key?(:'timeoutInMillis') && !attributes.key?(:'timeout_in_millis') # rubocop:disable Style/StringLiterals

  self.interval_in_millis = attributes[:'intervalInMillis'] if attributes[:'intervalInMillis']
  self.interval_in_millis = 10000 if interval_in_millis.nil? && !attributes.key?(:'intervalInMillis') # rubocop:disable Style/StringLiterals

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

  self.interval_in_millis = attributes[:'interval_in_millis'] if attributes[:'interval_in_millis']
  self.interval_in_millis = 10000 if interval_in_millis.nil? && !attributes.key?(:'intervalInMillis') && !attributes.key?(:'interval_in_millis') # rubocop:disable Style/StringLiterals

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

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

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

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

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

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

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

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

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

  self.request_data = attributes[:'requestData'] if attributes[:'requestData']

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

  self.request_data = attributes[:'request_data'] if attributes[:'request_data']

  self.response_data = attributes[:'responseData'] if attributes[:'responseData']

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

  self.response_data = attributes[:'response_data'] if attributes[:'response_data']

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

Instance Attribute Details

#dnsOCI::NetworkLoadBalancer::Models::DnsHealthCheckerDetails



90
91
92
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 90

def dns
  @dns
end

#interval_in_millisInteger

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

Example: 10000

Returns:

  • (Integer)


57
58
59
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 57

def interval_in_millis
  @interval_in_millis
end

#portInteger

The backend server port against which to run the health check. If the port is not specified, then the network load balancer uses the port information from the Backend object. The port must be specified if the backend port is 0.

Example: 8080

Returns:

  • (Integer)


34
35
36
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 34

def port
  @port
end

#protocolString

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

Example: HTTP

Returns:

  • (String)


26
27
28
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 26

def protocol
  @protocol
end

#request_dataString

Base64 encoded pattern to be sent as UDP or TCP health check probe.

Returns:

  • (String)


83
84
85
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 83

def request_data
  @request_data
end

#response_body_regexString

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

Example: ^((?!false).|\s)*$

Returns:

  • (String)


71
72
73
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 71

def response_body_regex
  @response_body_regex
end

#response_dataString

Base64 encoded pattern to be validated as UDP or TCP health check probe response.

Returns:

  • (String)


87
88
89
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 87

def response_data
  @response_data
end

#retriesInteger

The number of retries to attempt before a backend server is considered "unhealthy". This number also applies when recovering a server to the "healthy" state. The default value is 3.

Example: 3

Returns:

  • (Integer)


42
43
44
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 42

def retries
  @retries
end

#return_codeInteger

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

Example: 200

Returns:

  • (Integer)


79
80
81
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 79

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. The default value is 3000 (3 seconds).

Example: 3000

Returns:

  • (Integer)


50
51
52
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 50

def timeout_in_millis
  @timeout_in_millis
end

#url_pathString

The path against which to run the health check.

Example: /healthcheck

Returns:

  • (String)


64
65
66
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 64

def url_path
  @url_path
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 93

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'protocol': :'protocol',
    'port': :'port',
    'retries': :'retries',
    'timeout_in_millis': :'timeoutInMillis',
    'interval_in_millis': :'intervalInMillis',
    'url_path': :'urlPath',
    'response_body_regex': :'responseBodyRegex',
    'return_code': :'returnCode',
    'request_data': :'requestData',
    'response_data': :'responseData',
    'dns': :'dns'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 112

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'protocol': :'String',
    'port': :'Integer',
    'retries': :'Integer',
    'timeout_in_millis': :'Integer',
    'interval_in_millis': :'Integer',
    'url_path': :'String',
    'response_body_regex': :'String',
    'return_code': :'Integer',
    'request_data': :'String',
    'response_data': :'String',
    'dns': :'OCI::NetworkLoadBalancer::Models::DnsHealthCheckerDetails'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 224

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    protocol == other.protocol &&
    port == other.port &&
    retries == other.retries &&
    timeout_in_millis == other.timeout_in_millis &&
    interval_in_millis == other.interval_in_millis &&
    url_path == other.url_path &&
    response_body_regex == other.response_body_regex &&
    return_code == other.return_code &&
    request_data == other.request_data &&
    response_data == other.response_data &&
    dns == other.dns
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



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 264

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)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      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) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


244
245
246
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 244

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



253
254
255
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 253

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



297
298
299
300
301
302
303
304
305
306
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 297

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



291
292
293
# File 'lib/oci/network_load_balancer/models/health_checker_details.rb', line 291

def to_s
  to_hash.to_s
end