1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. 4 5 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class HealthCheckerDetails(object): 12 """ 13 The health check policy configuration. 14 For more information, see `Editing Health Check Policies`__. 15 16 __ https://docs.cloud.oracle.com/Content/Balance/Tasks/editinghealthcheck.htm 17 """ 18 19 #: A constant which can be used with the protocol property of a HealthCheckerDetails. 20 #: This constant has a value of "HTTP" 21 PROTOCOL_HTTP = "HTTP" 22 23 #: A constant which can be used with the protocol property of a HealthCheckerDetails. 24 #: This constant has a value of "HTTPS" 25 PROTOCOL_HTTPS = "HTTPS" 26 27 #: A constant which can be used with the protocol property of a HealthCheckerDetails. 28 #: This constant has a value of "TCP" 29 PROTOCOL_TCP = "TCP" 30 31 #: A constant which can be used with the protocol property of a HealthCheckerDetails. 32 #: This constant has a value of "UDP" 33 PROTOCOL_UDP = "UDP" 34 35 def __init__(self, **kwargs): 36 """ 37 Initializes a new HealthCheckerDetails object with values from keyword arguments. 38 The following keyword arguments are supported (corresponding to the getters/setters of this class): 39 40 :param protocol: 41 The value to assign to the protocol property of this HealthCheckerDetails. 42 Allowed values for this property are: "HTTP", "HTTPS", "TCP", "UDP" 43 :type protocol: str 44 45 :param port: 46 The value to assign to the port property of this HealthCheckerDetails. 47 :type port: int 48 49 :param retries: 50 The value to assign to the retries property of this HealthCheckerDetails. 51 :type retries: int 52 53 :param timeout_in_millis: 54 The value to assign to the timeout_in_millis property of this HealthCheckerDetails. 55 :type timeout_in_millis: int 56 57 :param interval_in_millis: 58 The value to assign to the interval_in_millis property of this HealthCheckerDetails. 59 :type interval_in_millis: int 60 61 :param url_path: 62 The value to assign to the url_path property of this HealthCheckerDetails. 63 :type url_path: str 64 65 :param response_body_regex: 66 The value to assign to the response_body_regex property of this HealthCheckerDetails. 67 :type response_body_regex: str 68 69 :param return_code: 70 The value to assign to the return_code property of this HealthCheckerDetails. 71 :type return_code: int 72 73 :param request_data: 74 The value to assign to the request_data property of this HealthCheckerDetails. 75 :type request_data: str 76 77 :param response_data: 78 The value to assign to the response_data property of this HealthCheckerDetails. 79 :type response_data: str 80 81 """ 82 self.swagger_types = { 83 'protocol': 'str', 84 'port': 'int', 85 'retries': 'int', 86 'timeout_in_millis': 'int', 87 'interval_in_millis': 'int', 88 'url_path': 'str', 89 'response_body_regex': 'str', 90 'return_code': 'int', 91 'request_data': 'str', 92 'response_data': 'str' 93 } 94 95 self.attribute_map = { 96 'protocol': 'protocol', 97 'port': 'port', 98 'retries': 'retries', 99 'timeout_in_millis': 'timeoutInMillis', 100 'interval_in_millis': 'intervalInMillis', 101 'url_path': 'urlPath', 102 'response_body_regex': 'responseBodyRegex', 103 'return_code': 'returnCode', 104 'request_data': 'requestData', 105 'response_data': 'responseData' 106 } 107 108 self._protocol = None 109 self._port = None 110 self._retries = None 111 self._timeout_in_millis = None 112 self._interval_in_millis = None 113 self._url_path = None 114 self._response_body_regex = None 115 self._return_code = None 116 self._request_data = None 117 self._response_data = None 118 119 @property 120 def protocol(self): 121 """ 122 **[Required]** Gets the protocol of this HealthCheckerDetails. 123 The protocol the health check must use; either HTTP or HTTPS, or UDP or TCP. 124 125 Example: `HTTP` 126 127 Allowed values for this property are: "HTTP", "HTTPS", "TCP", "UDP" 128 129 130 :return: The protocol of this HealthCheckerDetails. 131 :rtype: str 132 """ 133 return self._protocol 134 135 @protocol.setter 136 def protocol(self, protocol): 137 """ 138 Sets the protocol of this HealthCheckerDetails. 139 The protocol the health check must use; either HTTP or HTTPS, or UDP or TCP. 140 141 Example: `HTTP` 142 143 144 :param protocol: The protocol of this HealthCheckerDetails. 145 :type: str 146 """ 147 allowed_values = ["HTTP", "HTTPS", "TCP", "UDP"] 148 if not value_allowed_none_or_none_sentinel(protocol, allowed_values): 149 raise ValueError( 150 "Invalid value for `protocol`, must be None or one of {0}" 151 .format(allowed_values) 152 ) 153 self._protocol = protocol 154 155 @property 156 def port(self): 157 """ 158 Gets the port of this HealthCheckerDetails. 159 The backend server port against which to run the health check. If the port is not specified, then the network load balancer uses the 160 port information from the `Backend` object. The port must be specified if the backend port is 0. 161 162 Example: `8080` 163 164 165 :return: The port of this HealthCheckerDetails. 166 :rtype: int 167 """ 168 return self._port 169 170 @port.setter 171 def port(self, port): 172 """ 173 Sets the port of this HealthCheckerDetails. 174 The backend server port against which to run the health check. If the port is not specified, then the network load balancer uses the 175 port information from the `Backend` object. The port must be specified if the backend port is 0. 176 177 Example: `8080` 178 179 180 :param port: The port of this HealthCheckerDetails. 181 :type: int 182 """ 183 self._port = port 184 185 @property 186 def retries(self): 187 """ 188 Gets the retries of this HealthCheckerDetails. 189 The number of retries to attempt before a backend server is considered \"unhealthy\". This number also applies 190 when recovering a server to the \"healthy\" state. The default value is 3. 191 192 Example: `3` 193 194 195 :return: The retries of this HealthCheckerDetails. 196 :rtype: int 197 """ 198 return self._retries 199 200 @retries.setter 201 def retries(self, retries): 202 """ 203 Sets the retries of this HealthCheckerDetails. 204 The number of retries to attempt before a backend server is considered \"unhealthy\". This number also applies 205 when recovering a server to the \"healthy\" state. The default value is 3. 206 207 Example: `3` 208 209 210 :param retries: The retries of this HealthCheckerDetails. 211 :type: int 212 """ 213 self._retries = retries 214 215 @property 216 def timeout_in_millis(self): 217 """ 218 Gets the timeout_in_millis of this HealthCheckerDetails. 219 The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply 220 returns within this timeout period. The default value is 3000 (3 seconds). 221 222 Example: `3000` 223 224 225 :return: The timeout_in_millis of this HealthCheckerDetails. 226 :rtype: int 227 """ 228 return self._timeout_in_millis 229 230 @timeout_in_millis.setter 231 def timeout_in_millis(self, timeout_in_millis): 232 """ 233 Sets the timeout_in_millis of this HealthCheckerDetails. 234 The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply 235 returns within this timeout period. The default value is 3000 (3 seconds). 236 237 Example: `3000` 238 239 240 :param timeout_in_millis: The timeout_in_millis of this HealthCheckerDetails. 241 :type: int 242 """ 243 self._timeout_in_millis = timeout_in_millis 244 245 @property 246 def interval_in_millis(self): 247 """ 248 Gets the interval_in_millis of this HealthCheckerDetails. 249 The interval between health checks, in milliseconds. The default value is 10000 (10 seconds). 250 251 Example: `10000` 252 253 254 :return: The interval_in_millis of this HealthCheckerDetails. 255 :rtype: int 256 """ 257 return self._interval_in_millis 258 259 @interval_in_millis.setter 260 def interval_in_millis(self, interval_in_millis): 261 """ 262 Sets the interval_in_millis of this HealthCheckerDetails. 263 The interval between health checks, in milliseconds. The default value is 10000 (10 seconds). 264 265 Example: `10000` 266 267 268 :param interval_in_millis: The interval_in_millis of this HealthCheckerDetails. 269 :type: int 270 """ 271 self._interval_in_millis = interval_in_millis 272 273 @property 274 def url_path(self): 275 """ 276 Gets the url_path of this HealthCheckerDetails. 277 The path against which to run the health check. 278 279 Example: `/healthcheck` 280 281 282 :return: The url_path of this HealthCheckerDetails. 283 :rtype: str 284 """ 285 return self._url_path 286 287 @url_path.setter 288 def url_path(self, url_path): 289 """ 290 Sets the url_path of this HealthCheckerDetails. 291 The path against which to run the health check. 292 293 Example: `/healthcheck` 294 295 296 :param url_path: The url_path of this HealthCheckerDetails. 297 :type: str 298 """ 299 self._url_path = url_path 300 301 @property 302 def response_body_regex(self): 303 """ 304 Gets the response_body_regex of this HealthCheckerDetails. 305 A regular expression for parsing the response body from the backend server. 306 307 Example: `^((?!false).|\\s)*$` 308 309 310 :return: The response_body_regex of this HealthCheckerDetails. 311 :rtype: str 312 """ 313 return self._response_body_regex 314 315 @response_body_regex.setter 316 def response_body_regex(self, response_body_regex): 317 """ 318 Sets the response_body_regex of this HealthCheckerDetails. 319 A regular expression for parsing the response body from the backend server. 320 321 Example: `^((?!false).|\\s)*$` 322 323 324 :param response_body_regex: The response_body_regex of this HealthCheckerDetails. 325 :type: str 326 """ 327 self._response_body_regex = response_body_regex 328 329 @property 330 def return_code(self): 331 """ 332 Gets the return_code of this HealthCheckerDetails. 333 The status code a healthy backend server should return. If you configure the health check policy to use the HTTP protocol, 334 then you can use common HTTP status codes such as \"200\". 335 336 Example: `200` 337 338 339 :return: The return_code of this HealthCheckerDetails. 340 :rtype: int 341 """ 342 return self._return_code 343 344 @return_code.setter 345 def return_code(self, return_code): 346 """ 347 Sets the return_code of this HealthCheckerDetails. 348 The status code a healthy backend server should return. If you configure the health check policy to use the HTTP protocol, 349 then you can use common HTTP status codes such as \"200\". 350 351 Example: `200` 352 353 354 :param return_code: The return_code of this HealthCheckerDetails. 355 :type: int 356 """ 357 self._return_code = return_code 358 359 @property 360 def request_data(self): 361 """ 362 Gets the request_data of this HealthCheckerDetails. 363 Base64 encoded pattern to be sent as UDP or TCP health check probe. 364 365 366 :return: The request_data of this HealthCheckerDetails. 367 :rtype: str 368 """ 369 return self._request_data 370 371 @request_data.setter 372 def request_data(self, request_data): 373 """ 374 Sets the request_data of this HealthCheckerDetails. 375 Base64 encoded pattern to be sent as UDP or TCP health check probe. 376 377 378 :param request_data: The request_data of this HealthCheckerDetails. 379 :type: str 380 """ 381 self._request_data = request_data 382 383 @property 384 def response_data(self): 385 """ 386 Gets the response_data of this HealthCheckerDetails. 387 Base64 encoded pattern to be validated as UDP or TCP health check probe response. 388 389 390 :return: The response_data of this HealthCheckerDetails. 391 :rtype: str 392 """ 393 return self._response_data 394 395 @response_data.setter 396 def response_data(self, response_data): 397 """ 398 Sets the response_data of this HealthCheckerDetails. 399 Base64 encoded pattern to be validated as UDP or TCP health check probe response. 400 401 402 :param response_data: The response_data of this HealthCheckerDetails. 403 :type: str 404 """ 405 self._response_data = response_data 406 407 def __repr__(self): 408 return formatted_flat_dict(self) 409 410 def __eq__(self, other): 411 if other is None: 412 return False 413 414 return self.__dict__ == other.__dict__ 415 416 def __ne__(self, other): 417 return not self == other 418