Class: OracleBMC::LoadBalancer::Models::HealthChecker
- Inherits:
-
Object
- Object
- OracleBMC::LoadBalancer::Models::HealthChecker
- Defined in:
- lib/oraclebmc/load_balancer/models/health_checker.rb
Instance Attribute Summary collapse
-
#interval_in_millis ⇒ Integer
The interval between health checks, in milliseconds.
-
#port ⇒ Integer
The backend server port against which to run the health check.
-
#protocol ⇒ String
The protocol the health check must use; either HTTP or TCP.
-
#response_body_regex ⇒ String
A regular expression for parsing the response body from the backend server.
-
#retries ⇒ Integer
The number of retries to attempt before a backend server is considered "unhealthy".
-
#return_code ⇒ Integer
The status code a healthy backend server should return.
-
#timeout_in_millis ⇒ Integer
The maximum timeout before a retry, in milliseconds.
-
#url_path ⇒ String
The path against which to run the health check.
Instance Method Summary collapse
-
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other_object) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ HealthChecker
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ HealthChecker
Initializes the object
68 69 70 71 72 73 74 75 76 77 78 79 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 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 68 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 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 if attributes[:'retries'] self.retries = attributes[:'retries'] end if attributes[:'returnCode'] self.return_code = attributes[:'returnCode'] end if attributes[:'timeoutInMillis'] self.timeout_in_millis = attributes[:'timeoutInMillis'] end if attributes[:'urlPath'] self.url_path = attributes[:'urlPath'] end end |
Instance Attribute Details
#interval_in_millis ⇒ Integer
The interval between health checks, in milliseconds. The default is 10000 (10 seconds).
Example: ‘30000`
12 13 14 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 12 def interval_in_millis @interval_in_millis end |
#port ⇒ Integer
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`
20 21 22 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 20 def port @port end |
#protocol ⇒ String
The protocol the health check must use; either HTTP or TCP.
Example: ‘HTTP`
27 28 29 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 27 def protocol @protocol end |
#response_body_regex ⇒ String
A regular expression for parsing the response body from the backend server.
Example: ‘^(500|40)$`
34 35 36 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 34 def response_body_regex @response_body_regex end |
#retries ⇒ Integer
The number of retries to attempt before a backend server is considered "unhealthy". Defaults to 3.
Example: ‘3`
41 42 43 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 41 def retries @retries end |
#return_code ⇒ Integer
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`
49 50 51 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 49 def return_code @return_code end |
#timeout_in_millis ⇒ Integer
The maximum timeout before a retry, in milliseconds. Defaults to 3000 (3 seconds).
Example: ‘6000`
56 57 58 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 56 def timeout_in_millis @timeout_in_millis end |
#url_path ⇒ String
The path against which to run the health check.
Example: ‘/healthcheck`
63 64 65 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 63 def url_path @url_path end |
Instance Method Details
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 111 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
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 139 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.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", OracleBMC::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
126 127 128 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 126 def eql?(other_object) self == other_object end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
132 133 134 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 132 def hash [interval_in_millis, port, protocol, response_body_regex, retries, return_code, timeout_in_millis, url_path].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
164 165 166 167 168 169 170 171 172 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 164 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
158 159 160 |
# File 'lib/oraclebmc/load_balancer/models/health_checker.rb', line 158 def to_s to_hash.to_s end |