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 LBCookieSessionPersistenceConfigurationDetails(object): 12 """ 13 The configuration details for implementing load balancer cookie session persistence (LB cookie stickiness). 14 15 Session persistence enables the Load Balancing service to direct all requests that originate from a single logical 16 client to a single backend web server. For more information, see 17 `Session Persistence`__. 18 19 When you configure LB cookie stickiness, the load balancer inserts a cookie into the response. The parameters configured 20 in the cookie enable session stickiness. This method is useful when you have applications and Web backend services 21 that cannot generate their own cookies. 22 23 Path route rules take precedence to determine the target backend server. The load balancer verifies that session stickiness 24 is enabled for the backend server and that the cookie configuration (domain, path, and cookie hash) is valid for the 25 target. The system ignores invalid cookies. 26 27 To disable LB cookie stickiness on a running load balancer, use the 28 :func:`update_backend_set` operation and specify `null` for the 29 `LBCookieSessionPersistenceConfigurationDetails` object. 30 31 Example: `LBCookieSessionPersistenceConfigurationDetails: null` 32 33 **Note:** `SessionPersistenceConfigurationDetails` (application cookie stickiness) and `LBCookieSessionPersistenceConfigurationDetails` 34 (LB cookie stickiness) are mutually exclusive. An error results if you try to enable both types of session persistence. 35 36 **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API. 37 38 __ https://docs.cloud.oracle.com/Content/Balance/Reference/sessionpersistence.htm 39 """ 40 41 def __init__(self, **kwargs): 42 """ 43 Initializes a new LBCookieSessionPersistenceConfigurationDetails object with values from keyword arguments. 44 The following keyword arguments are supported (corresponding to the getters/setters of this class): 45 46 :param cookie_name: 47 The value to assign to the cookie_name property of this LBCookieSessionPersistenceConfigurationDetails. 48 :type cookie_name: str 49 50 :param disable_fallback: 51 The value to assign to the disable_fallback property of this LBCookieSessionPersistenceConfigurationDetails. 52 :type disable_fallback: bool 53 54 :param domain: 55 The value to assign to the domain property of this LBCookieSessionPersistenceConfigurationDetails. 56 :type domain: str 57 58 :param path: 59 The value to assign to the path property of this LBCookieSessionPersistenceConfigurationDetails. 60 :type path: str 61 62 :param max_age_in_seconds: 63 The value to assign to the max_age_in_seconds property of this LBCookieSessionPersistenceConfigurationDetails. 64 :type max_age_in_seconds: int 65 66 :param is_secure: 67 The value to assign to the is_secure property of this LBCookieSessionPersistenceConfigurationDetails. 68 :type is_secure: bool 69 70 :param is_http_only: 71 The value to assign to the is_http_only property of this LBCookieSessionPersistenceConfigurationDetails. 72 :type is_http_only: bool 73 74 """ 75 self.swagger_types = { 76 'cookie_name': 'str', 77 'disable_fallback': 'bool', 78 'domain': 'str', 79 'path': 'str', 80 'max_age_in_seconds': 'int', 81 'is_secure': 'bool', 82 'is_http_only': 'bool' 83 } 84 85 self.attribute_map = { 86 'cookie_name': 'cookieName', 87 'disable_fallback': 'disableFallback', 88 'domain': 'domain', 89 'path': 'path', 90 'max_age_in_seconds': 'maxAgeInSeconds', 91 'is_secure': 'isSecure', 92 'is_http_only': 'isHttpOnly' 93 } 94 95 self._cookie_name = None 96 self._disable_fallback = None 97 self._domain = None 98 self._path = None 99 self._max_age_in_seconds = None 100 self._is_secure = None 101 self._is_http_only = None 102 103 @property 104 def cookie_name(self): 105 """ 106 Gets the cookie_name of this LBCookieSessionPersistenceConfigurationDetails. 107 The name of the cookie inserted by the load balancer. If this field is not configured, the cookie name defaults 108 to \"X-Oracle-BMC-LBS-Route\". 109 110 Example: `example_cookie` 111 112 **Notes:** 113 114 * Ensure that the cookie name used at the backend application servers is different from the cookie name used 115 at the load balancer. To minimize the chance of name collision, Oracle recommends that you use a prefix 116 such as \"X-Oracle-OCI-\" for this field. 117 118 * If a backend server and the load balancer both insert cookies with the same name, the client or browser 119 behavior can vary depending on the domain and path values associated with the cookie. If the name, domain, 120 and path values of the `Set-cookie` generated by a backend server and the `Set-cookie` generated by the 121 load balancer are all the same, the client or browser treats them as one cookie and returns only one of 122 the cookie values in subsequent requests. If both `Set-cookie` names are the same, but the domain and path 123 names are different, the client or browser treats them as two different cookies. 124 125 126 :return: The cookie_name of this LBCookieSessionPersistenceConfigurationDetails. 127 :rtype: str 128 """ 129 return self._cookie_name 130 131 @cookie_name.setter 132 def cookie_name(self, cookie_name): 133 """ 134 Sets the cookie_name of this LBCookieSessionPersistenceConfigurationDetails. 135 The name of the cookie inserted by the load balancer. If this field is not configured, the cookie name defaults 136 to \"X-Oracle-BMC-LBS-Route\". 137 138 Example: `example_cookie` 139 140 **Notes:** 141 142 * Ensure that the cookie name used at the backend application servers is different from the cookie name used 143 at the load balancer. To minimize the chance of name collision, Oracle recommends that you use a prefix 144 such as \"X-Oracle-OCI-\" for this field. 145 146 * If a backend server and the load balancer both insert cookies with the same name, the client or browser 147 behavior can vary depending on the domain and path values associated with the cookie. If the name, domain, 148 and path values of the `Set-cookie` generated by a backend server and the `Set-cookie` generated by the 149 load balancer are all the same, the client or browser treats them as one cookie and returns only one of 150 the cookie values in subsequent requests. If both `Set-cookie` names are the same, but the domain and path 151 names are different, the client or browser treats them as two different cookies. 152 153 154 :param cookie_name: The cookie_name of this LBCookieSessionPersistenceConfigurationDetails. 155 :type: str 156 """ 157 self._cookie_name = cookie_name 158 159 @property 160 def disable_fallback(self): 161 """ 162 Gets the disable_fallback of this LBCookieSessionPersistenceConfigurationDetails. 163 Whether the load balancer is prevented from directing traffic from a persistent session client to 164 a different backend server if the original server is unavailable. Defaults to false. 165 166 Example: `false` 167 168 169 :return: The disable_fallback of this LBCookieSessionPersistenceConfigurationDetails. 170 :rtype: bool 171 """ 172 return self._disable_fallback 173 174 @disable_fallback.setter 175 def disable_fallback(self, disable_fallback): 176 """ 177 Sets the disable_fallback of this LBCookieSessionPersistenceConfigurationDetails. 178 Whether the load balancer is prevented from directing traffic from a persistent session client to 179 a different backend server if the original server is unavailable. Defaults to false. 180 181 Example: `false` 182 183 184 :param disable_fallback: The disable_fallback of this LBCookieSessionPersistenceConfigurationDetails. 185 :type: bool 186 """ 187 self._disable_fallback = disable_fallback 188 189 @property 190 def domain(self): 191 """ 192 Gets the domain of this LBCookieSessionPersistenceConfigurationDetails. 193 The domain in which the cookie is valid. The `Set-cookie` header inserted by the load balancer contains a 194 domain attribute with the specified value. 195 196 This attribute has no default value. If you do not specify a value, the load balancer does not insert the domain 197 attribute into the `Set-cookie` header. 198 199 **Notes:** 200 201 * `RFC 6265 - HTTP State Management Mechanism`__ describes client and 202 browser behavior when the domain attribute is present or not present in the `Set-cookie` header. 203 204 If the value of the `Domain` attribute is `example.com` in the `Set-cookie` header, the client includes 205 the same cookie in the `Cookie` header when making HTTP requests to `example.com`, `www.example.com`, and 206 `www.abc.example.com`. If the `Domain` attribute is not present, the client returns the cookie only for 207 the domain to which the original request was made. 208 209 * Ensure that this attribute specifies the correct domain value. If the `Domain` attribute in the `Set-cookie` 210 header does not include the domain to which the original request was made, the client or browser might reject 211 the cookie. As specified in RFC 6265, the client accepts a cookie with the `Domain` attribute value `example.com` 212 or `www.example.com` sent from `www.example.com`. It does not accept a cookie with the `Domain` attribute 213 `abc.example.com` or `www.abc.example.com` sent from `www.example.com`. 214 215 Example: `example.com` 216 217 __ https://www.ietf.org/rfc/rfc6265.txt 218 219 220 :return: The domain of this LBCookieSessionPersistenceConfigurationDetails. 221 :rtype: str 222 """ 223 return self._domain 224 225 @domain.setter 226 def domain(self, domain): 227 """ 228 Sets the domain of this LBCookieSessionPersistenceConfigurationDetails. 229 The domain in which the cookie is valid. The `Set-cookie` header inserted by the load balancer contains a 230 domain attribute with the specified value. 231 232 This attribute has no default value. If you do not specify a value, the load balancer does not insert the domain 233 attribute into the `Set-cookie` header. 234 235 **Notes:** 236 237 * `RFC 6265 - HTTP State Management Mechanism`__ describes client and 238 browser behavior when the domain attribute is present or not present in the `Set-cookie` header. 239 240 If the value of the `Domain` attribute is `example.com` in the `Set-cookie` header, the client includes 241 the same cookie in the `Cookie` header when making HTTP requests to `example.com`, `www.example.com`, and 242 `www.abc.example.com`. If the `Domain` attribute is not present, the client returns the cookie only for 243 the domain to which the original request was made. 244 245 * Ensure that this attribute specifies the correct domain value. If the `Domain` attribute in the `Set-cookie` 246 header does not include the domain to which the original request was made, the client or browser might reject 247 the cookie. As specified in RFC 6265, the client accepts a cookie with the `Domain` attribute value `example.com` 248 or `www.example.com` sent from `www.example.com`. It does not accept a cookie with the `Domain` attribute 249 `abc.example.com` or `www.abc.example.com` sent from `www.example.com`. 250 251 Example: `example.com` 252 253 __ https://www.ietf.org/rfc/rfc6265.txt 254 255 256 :param domain: The domain of this LBCookieSessionPersistenceConfigurationDetails. 257 :type: str 258 """ 259 self._domain = domain 260 261 @property 262 def path(self): 263 """ 264 Gets the path of this LBCookieSessionPersistenceConfigurationDetails. 265 The path in which the cookie is valid. The `Set-cookie header` inserted by the load balancer contains a `Path` 266 attribute with the specified value. 267 268 Clients include the cookie in an HTTP request only if the path portion of the request-uri matches, or is a 269 subdirectory of, the cookie's `Path` attribute. 270 271 The default value is `/`. 272 273 Example: `/example` 274 275 276 :return: The path of this LBCookieSessionPersistenceConfigurationDetails. 277 :rtype: str 278 """ 279 return self._path 280 281 @path.setter 282 def path(self, path): 283 """ 284 Sets the path of this LBCookieSessionPersistenceConfigurationDetails. 285 The path in which the cookie is valid. The `Set-cookie header` inserted by the load balancer contains a `Path` 286 attribute with the specified value. 287 288 Clients include the cookie in an HTTP request only if the path portion of the request-uri matches, or is a 289 subdirectory of, the cookie's `Path` attribute. 290 291 The default value is `/`. 292 293 Example: `/example` 294 295 296 :param path: The path of this LBCookieSessionPersistenceConfigurationDetails. 297 :type: str 298 """ 299 self._path = path 300 301 @property 302 def max_age_in_seconds(self): 303 """ 304 Gets the max_age_in_seconds of this LBCookieSessionPersistenceConfigurationDetails. 305 The amount of time the cookie remains valid. The `Set-cookie` header inserted by the load balancer contains 306 a `Max-Age` attribute with the specified value. 307 308 The specified value must be at least one second. There is no default value for this attribute. If you do not 309 specify a value, the load balancer does not include the `Max-Age` attribute in the `Set-cookie` header. In 310 most cases, the client or browser retains the cookie until the current session ends, as defined by the client. 311 312 Example: `3600` 313 314 315 :return: The max_age_in_seconds of this LBCookieSessionPersistenceConfigurationDetails. 316 :rtype: int 317 """ 318 return self._max_age_in_seconds 319 320 @max_age_in_seconds.setter 321 def max_age_in_seconds(self, max_age_in_seconds): 322 """ 323 Sets the max_age_in_seconds of this LBCookieSessionPersistenceConfigurationDetails. 324 The amount of time the cookie remains valid. The `Set-cookie` header inserted by the load balancer contains 325 a `Max-Age` attribute with the specified value. 326 327 The specified value must be at least one second. There is no default value for this attribute. If you do not 328 specify a value, the load balancer does not include the `Max-Age` attribute in the `Set-cookie` header. In 329 most cases, the client or browser retains the cookie until the current session ends, as defined by the client. 330 331 Example: `3600` 332 333 334 :param max_age_in_seconds: The max_age_in_seconds of this LBCookieSessionPersistenceConfigurationDetails. 335 :type: int 336 """ 337 self._max_age_in_seconds = max_age_in_seconds 338 339 @property 340 def is_secure(self): 341 """ 342 Gets the is_secure of this LBCookieSessionPersistenceConfigurationDetails. 343 Whether the `Set-cookie` header should contain the `Secure` attribute. If `true`, the `Set-cookie` header 344 inserted by the load balancer contains the `Secure` attribute, which directs the client or browser to send the 345 cookie only using a secure protocol. 346 347 **Note:** If you set this field to `true`, you cannot associate the corresponding backend set with an HTTP 348 listener. 349 350 Example: `true` 351 352 353 :return: The is_secure of this LBCookieSessionPersistenceConfigurationDetails. 354 :rtype: bool 355 """ 356 return self._is_secure 357 358 @is_secure.setter 359 def is_secure(self, is_secure): 360 """ 361 Sets the is_secure of this LBCookieSessionPersistenceConfigurationDetails. 362 Whether the `Set-cookie` header should contain the `Secure` attribute. If `true`, the `Set-cookie` header 363 inserted by the load balancer contains the `Secure` attribute, which directs the client or browser to send the 364 cookie only using a secure protocol. 365 366 **Note:** If you set this field to `true`, you cannot associate the corresponding backend set with an HTTP 367 listener. 368 369 Example: `true` 370 371 372 :param is_secure: The is_secure of this LBCookieSessionPersistenceConfigurationDetails. 373 :type: bool 374 """ 375 self._is_secure = is_secure 376 377 @property 378 def is_http_only(self): 379 """ 380 Gets the is_http_only of this LBCookieSessionPersistenceConfigurationDetails. 381 Whether the `Set-cookie` header should contain the `HttpOnly` attribute. If `true`, the `Set-cookie` header 382 inserted by the load balancer contains the `HttpOnly` attribute, which limits the scope of the cookie to HTTP 383 requests. This attribute directs the client or browser to omit the cookie when providing access to cookies 384 through non-HTTP APIs. For example, it restricts the cookie from JavaScript channels. 385 386 Example: `true` 387 388 389 :return: The is_http_only of this LBCookieSessionPersistenceConfigurationDetails. 390 :rtype: bool 391 """ 392 return self._is_http_only 393 394 @is_http_only.setter 395 def is_http_only(self, is_http_only): 396 """ 397 Sets the is_http_only of this LBCookieSessionPersistenceConfigurationDetails. 398 Whether the `Set-cookie` header should contain the `HttpOnly` attribute. If `true`, the `Set-cookie` header 399 inserted by the load balancer contains the `HttpOnly` attribute, which limits the scope of the cookie to HTTP 400 requests. This attribute directs the client or browser to omit the cookie when providing access to cookies 401 through non-HTTP APIs. For example, it restricts the cookie from JavaScript channels. 402 403 Example: `true` 404 405 406 :param is_http_only: The is_http_only of this LBCookieSessionPersistenceConfigurationDetails. 407 :type: bool 408 """ 409 self._is_http_only = is_http_only 410 411 def __repr__(self): 412 return formatted_flat_dict(self) 413 414 def __eq__(self, other): 415 if other is None: 416 return False 417 418 return self.__dict__ == other.__dict__ 419 420 def __ne__(self, other): 421 return not self == other 422