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](docs.cloud.oracle.com/Content/Balance/Reference/sessionpersistence.htm).
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 verfies 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 the `HttpOnly` attribute.
-
#is_secure ⇒ BOOLEAN
Whether the ‘Set-cookie` header should contain the `Secure` 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
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 179 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 the `Set-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 both `Set-cookie` names are the same, but the domain and path names are different, the client or browser treats them as two different cookies.
52 53 54 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 52 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`
60 61 62 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 60 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](www.ietf.org/rfc/rfc6265.txt) 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 origianl request was made.
-
Ensure that this attribute specifies the correct domain value. If the ‘Domain` attribute in the `Set-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 the `Domain` attribute value `example.com` or `www.example.com` sent from `www.example.com`. It does not accept a cookie with the `Domain` attribute `abc.example.com` or `www.abc.example.com` sent from `www.example.com`.
Example: ‘example.com`
87 88 89 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 87 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`
134 135 136 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 134 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`
124 125 126 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 124 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`
112 113 114 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 112 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`
100 101 102 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 100 def path @path end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 137 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.
152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 152 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.
233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 233 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
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 269 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
249 250 251 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 249 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
258 259 260 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 258 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
302 303 304 305 306 307 308 309 310 311 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 302 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
296 297 298 |
# File 'lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb', line 296 def to_s to_hash.to_s end |