Class: OCI::LoadBalancer::Models::LBCookieSessionPersistenceConfigurationDetails
- Inherits:
-
Object
- Object
- OCI::LoadBalancer::Models::LBCookieSessionPersistenceConfigurationDetails
- Defined in:
- lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb
Overview
The configuration details for implementing load balancer cookie session persistence (LB cookie stickiness).
Session persistence enables the Load Balancing service to direct all requests that originate from a single logical client to a single backend web server. For more information, see Session Persistence.
When you configure LB cookie stickiness, the load balancer inserts a cookie into the response. The parameters configured in the cookie enable session stickiness. This method is useful when you have applications and Web backend services that cannot generate their own cookies.
Path route rules take precedence to determine the target backend server. The load balancer verifies that session stickiness is enabled for the backend server and that the cookie configuration (domain, path, and cookie hash) is valid for the target. The system ignores invalid cookies.
To disable LB cookie stickiness on a running load balancer, use the update_backend_set operation and specify null
for the LBCookieSessionPersistenceConfigurationDetails
object.
Example: LBCookieSessionPersistenceConfigurationDetails: null
Note: SessionPersistenceConfigurationDetails
(application cookie stickiness) and LBCookieSessionPersistenceConfigurationDetails
(LB cookie stickiness) are mutually exclusive. An error results if you try to enable both types of session persistence.
Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.
Instance Attribute Summary collapse
-
#cookie_name ⇒ String
The name of the cookie inserted by the load balancer.
-
#disable_fallback ⇒ BOOLEAN
Whether the load balancer is prevented from directing traffic from a persistent session client to a different backend server if the original server is unavailable.
-
#domain ⇒ String
The domain in which the cookie is valid.
-
#is_http_only ⇒ BOOLEAN
Whether the
Set-cookie
header should contain theHttpOnly
attribute. -
#is_secure ⇒ BOOLEAN
Whether the
Set-cookie
header should contain theSecure
attribute. -
#max_age_in_seconds ⇒ Integer
The amount of time the cookie remains valid.
-
#path ⇒ String
The path in which the cookie is valid.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ LBCookieSessionPersistenceConfigurationDetails
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 = {}) ⇒ LBCookieSessionPersistenceConfigurationDetails
Initializes the object
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 181 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. = attributes[:'cookieName'] if attributes[:'cookieName'] raise 'You cannot provide both :cookieName and :cookie_name' if attributes.key?(:'cookieName') && attributes.key?(:'cookie_name') self. = attributes[:'cookie_name'] if attributes[:'cookie_name'] self.disable_fallback = attributes[:'disableFallback'] unless attributes[:'disableFallback'].nil? self.disable_fallback = false if disable_fallback.nil? && !attributes.key?(:'disableFallback') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :disableFallback and :disable_fallback' if attributes.key?(:'disableFallback') && attributes.key?(:'disable_fallback') self.disable_fallback = attributes[:'disable_fallback'] unless attributes[:'disable_fallback'].nil? self.disable_fallback = false if disable_fallback.nil? && !attributes.key?(:'disableFallback') && !attributes.key?(:'disable_fallback') # rubocop:disable Style/StringLiterals self.domain = attributes[:'domain'] if attributes[:'domain'] self.path = attributes[:'path'] if attributes[:'path'] self.max_age_in_seconds = attributes[:'maxAgeInSeconds'] if attributes[:'maxAgeInSeconds'] raise 'You cannot provide both :maxAgeInSeconds and :max_age_in_seconds' if attributes.key?(:'maxAgeInSeconds') && attributes.key?(:'max_age_in_seconds') self.max_age_in_seconds = attributes[:'max_age_in_seconds'] if attributes[:'max_age_in_seconds'] self.is_secure = attributes[:'isSecure'] unless attributes[:'isSecure'].nil? self.is_secure = true if is_secure.nil? && !attributes.key?(:'isSecure') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isSecure and :is_secure' if attributes.key?(:'isSecure') && attributes.key?(:'is_secure') self.is_secure = attributes[:'is_secure'] unless attributes[:'is_secure'].nil? self.is_secure = true if is_secure.nil? && !attributes.key?(:'isSecure') && !attributes.key?(:'is_secure') # rubocop:disable Style/StringLiterals self.is_http_only = attributes[:'isHttpOnly'] unless attributes[:'isHttpOnly'].nil? self.is_http_only = true if is_http_only.nil? && !attributes.key?(:'isHttpOnly') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isHttpOnly and :is_http_only' if attributes.key?(:'isHttpOnly') && attributes.key?(:'is_http_only') self.is_http_only = attributes[:'is_http_only'] unless attributes[:'is_http_only'].nil? self.is_http_only = true if is_http_only.nil? && !attributes.key?(:'isHttpOnly') && !attributes.key?(:'is_http_only') # rubocop:disable Style/StringLiterals end |
Instance Attribute Details
#cookie_name ⇒ String
The name of the cookie inserted by the load balancer. If this field is not configured, the cookie name defaults to "X-Oracle-BMC-LBS-Route".
Example: example_cookie
Notes:
-
Ensure that the cookie name used at the backend application servers is different from the cookie name used at the load balancer. To minimize the chance of name collision, Oracle recommends that you use a prefix such as "X-Oracle-OCI-" for this field.
-
If a backend server and the load balancer both insert cookies with the same name, the client or browser behavior can vary depending on the domain and path values associated with the cookie. If the name, domain, and path values of the
Set-cookie
generated by a backend server and theSet-cookie
generated by the load balancer are all the same, the client or browser treats them as one cookie and returns only one of the cookie values in subsequent requests. If bothSet-cookie
names are the same, but the domain and path names are different, the client or browser treats them as two different cookies.
54 55 56 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 54 def @cookie_name end |
#disable_fallback ⇒ BOOLEAN
Whether the load balancer is prevented from directing traffic from a persistent session client to a different backend server if the original server is unavailable. Defaults to false.
Example: false
62 63 64 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 62 def disable_fallback @disable_fallback end |
#domain ⇒ String
The domain in which the cookie is valid. The Set-cookie
header inserted by the load balancer contains a domain attribute with the specified value.
This attribute has no default value. If you do not specify a value, the load balancer does not insert the domain attribute into the Set-cookie
header.
Notes:
-
RFC 6265 - HTTP State Management Mechanism describes client and browser behavior when the domain attribute is present or not present in the
Set-cookie
header.
If the value of the Domain
attribute is example.com
in the Set-cookie
header, the client includes the same cookie in the Cookie
header when making HTTP requests to example.com
, www.example.com
, and www.abc.example.com
. If the Domain
attribute is not present, the client returns the cookie only for the domain to which the original request was made.
-
Ensure that this attribute specifies the correct domain value. If the
Domain
attribute in theSet-cookie
header does not include the domain to which the original request was made, the client or browser might reject the cookie. As specified in RFC 6265, the client accepts a cookie with theDomain
attribute valueexample.com
orwww.example.com
sent fromwww.example.com
. It does not accept a cookie with theDomain
attributeabc.example.com
orwww.abc.example.com
sent fromwww.example.com
.
Example: example.com
89 90 91 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 89 def domain @domain end |
#is_http_only ⇒ BOOLEAN
Whether the Set-cookie
header should contain the HttpOnly
attribute. If true
, the Set-cookie
header inserted by the load balancer contains the HttpOnly
attribute, which limits the scope of the cookie to HTTP requests. This attribute directs the client or browser to omit the cookie when providing access to cookies through non-HTTP APIs. For example, it restricts the cookie from JavaScript channels.
Example: true
136 137 138 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 136 def is_http_only @is_http_only end |
#is_secure ⇒ BOOLEAN
Whether the Set-cookie
header should contain the Secure
attribute. If true
, the Set-cookie
header inserted by the load balancer contains the Secure
attribute, which directs the client or browser to send the cookie only using a secure protocol.
Note: If you set this field to true
, you cannot associate the corresponding backend set with an HTTP listener.
Example: true
126 127 128 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 126 def is_secure @is_secure end |
#max_age_in_seconds ⇒ Integer
The amount of time the cookie remains valid. The Set-cookie
header inserted by the load balancer contains a Max-Age
attribute with the specified value.
The specified value must be at least one second. There is no default value for this attribute. If you do not specify a value, the load balancer does not include the Max-Age
attribute in the Set-cookie
header. In most cases, the client or browser retains the cookie until the current session ends, as defined by the client.
Example: 3600
114 115 116 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 114 def max_age_in_seconds @max_age_in_seconds end |
#path ⇒ String
The path in which the cookie is valid. The Set-cookie header
inserted by the load balancer contains a Path
attribute with the specified value.
Clients include the cookie in an HTTP request only if the path portion of the request-uri matches, or is a subdirectory of, the cookie's Path
attribute.
The default value is /
.
Example: /example
102 103 104 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 102 def path @path end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 139 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'cookie_name': :'cookieName', 'disable_fallback': :'disableFallback', 'domain': :'domain', 'path': :'path', 'max_age_in_seconds': :'maxAgeInSeconds', 'is_secure': :'isSecure', 'is_http_only': :'isHttpOnly' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 154 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'cookie_name': :'String', 'disable_fallback': :'BOOLEAN', 'domain': :'String', 'path': :'String', 'max_age_in_seconds': :'Integer', 'is_secure': :'BOOLEAN', 'is_http_only': :'BOOLEAN' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 235 def ==(other) return true if equal?(other) self.class == other.class && == other. && disable_fallback == other.disable_fallback && domain == other.domain && path == other.path && max_age_in_seconds == other.max_age_in_seconds && is_secure == other.is_secure && is_http_only == other.is_http_only end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 271 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
251 252 253 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 251 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
260 261 262 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 260 def hash [, disable_fallback, domain, path, max_age_in_seconds, is_secure, is_http_only].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
304 305 306 307 308 309 310 311 312 313 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 304 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_s ⇒ String
Returns the string representation of the object
298 299 300 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 298 def to_s to_hash.to_s end |