Class: OCI::LoadBalancer::Models::RedirectUri
- Inherits:
-
Object
- Object
- OCI::LoadBalancer::Models::RedirectUri
- Defined in:
- lib/oci/load_balancer/models/redirect_uri.rb
Overview
An object that defines the redirect URI applied to the original request. The object property values compose the redirect URI.
NOTE: The Load Balancing service cannot automatically detect or avoid infinite redirects. Be sure to provide meaningful, complete, and correct field values. If any component field of this object has no value, the system retains the value from the incoming HTTP request URI.
For example, if you specify only the protocol field https
, and the incoming request URI is http://example.com:8080
, the resulting runtime redirect URI is https://example.com:8080
. The system retains the host and port from the incoming URI and does not automatically change the port setting from 8080
to 443
.
Be sure to configure valid percent-encoding (URL encoding) when needed.
In addition to static string values, you can use the following tokens to construct the redirect URI. These tokens extract values from the incoming HTTP request URI.
-
#protocol : The protocol from the incoming HTTP request URI.
-
#host : The domain name from the incoming HTTP request URI.
-
#port : The port from the incoming HTTP request URI.
-
#path : The path from the incoming HTTP request URI.
-
#query : The query string from the incoming HTTP request URI.
The tokens are case sensitive. For example, {host}
is a valid token, but {HOST}
is not.
You can retain the literal characters of a token when you specify values for the path and query properties of the redirect URI. Use a backslash (\) as the escape character for the \, {, and } characters. For example, if the incoming HTTP request URI is /video
, the path property value:
/example{path}123\{path\}
appears in the constructed redirect URI as:
/example/video123{path}
Instance Attribute Summary collapse
-
#host ⇒ String
The valid domain name (hostname) or IP address to use in the redirect URI.
-
#path ⇒ String
The HTTP URI path to use in the redirect URI.
-
#port ⇒ Integer
The communication port to use in the redirect URI.
-
#protocol ⇒ String
The HTTP protocol to use in the redirect URI.
-
#query ⇒ String
The query string to use in the redirect URI.
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 = {}) ⇒ RedirectUri
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 = {}) ⇒ RedirectUri
Initializes the object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 202 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.protocol = attributes[:'protocol'] if attributes[:'protocol'] self.host = attributes[:'host'] if attributes[:'host'] self.port = attributes[:'port'] if attributes[:'port'] self.path = attributes[:'path'] if attributes[:'path'] self.query = attributes[:'query'] if attributes[:'query'] end |
Instance Attribute Details
#host ⇒ String
The valid domain name (hostname) or IP address to use in the redirect URI.
When this value is null, not set, or set to {host}
, the service preserves the original domain name from the incoming HTTP request URI.
All RedirectUri tokens are valid for this property. You can use any token more than once.
Curly braces are valid in this property only to surround tokens, such as {host}
Examples:
-
example.com appears as
example.com
in the redirect URI. -
in#host appears as
inexample.com
in the redirect URI ifexample.com
is the hostname in the incoming HTTP request URI. -
#port#host appears as
8081example.com
in the redirect URI ifexample.com
is the hostname and the port is8081
in the incoming HTTP request URI.
80 81 82 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 80 def host @host end |
#path ⇒ String
The HTTP URI path to use in the redirect URI.
When this value is null, not set, or set to {path}
, the service preserves the original path from the incoming HTTP request URI. To omit the path from the redirect URI, set this value to an empty string, "".
All RedirectUri tokens are valid for this property. You can use any token more than once.
The path string must begin with /
if it does not begin with the {path}
token.
Examples:
-
/example/video/123 appears as
/example/video/123
in the redirect URI. -
/example#path appears as
/example/video/123
in the redirect URI if/video/123
is the path in the incoming HTTP request URI. -
#path/123 appears as
/example/video/123
in the redirect URI if/example/video
is the path in the incoming HTTP request URI. -
#path123 appears as
/example/video123
in the redirect URI if/example/video
is the path in the incoming HTTP request URI. -
/#host/123 appears as
/example.com/123
in the redirect URI ifexample.com
is the hostname in the incoming HTTP request URI. -
/#host/#port appears as
/example.com/123
in the redirect URI ifexample.com
is the hostname and123
is the port in the incoming HTTP request URI. -
/#query appears as
/lang=en
in the redirect URI if the query islang=en
in the incoming HTTP request URI.
125 126 127 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 125 def path @path end |
#port ⇒ Integer
The communication port to use in the redirect URI.
Valid values include integers from 1 to 65535.
When this value is null, the service preserves the original port from the incoming HTTP request URI.
Example: 8081
91 92 93 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 91 def port @port end |
#protocol ⇒ String
The HTTP protocol to use in the redirect URI.
When this value is null, not set, or set to {protocol}
, the service preserves the original protocol from the incoming HTTP request URI. Allowed values are:
-
HTTP
-
HTTPS
{protocol}
is the only valid token for this property. It can appear only once in the value string.
Example: HTTPS
58 59 60 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 58 def protocol @protocol end |
#query ⇒ String
The query string to use in the redirect URI.
When this value is null, not set, or set to {query}
, the service preserves the original query parameters from the incoming HTTP request URI.
All RedirectUri
tokens are valid for this property. You can use any token more than once.
If the query string does not begin with the {query}
token, it must begin with the question mark (?) character.
You can specify multiple query parameters as a single string. Separate each query parameter with an ampersand (&) character. To omit all incoming query parameters from the redirect URI, set this value to an empty string, "".
If the specified query string results in a redirect URI ending with ?
or &
, the last character is truncated. For example, if the incoming URI is http://host.com:8080/documents
and the query property value is ?lang=en&{query}
, the redirect URI is http://host.com:8080/documents?lang=en
. The system truncates the final ampersand (&) because the incoming URI included no value to replace the #query token.
Examples: * lang=en&time_zone=PST appears as lang=en&time_zone=PST
in the redirect URI.
-
#query appears as
lang=en&time_zone=PST
in the redirect URI iflang=en&time_zone=PST
is the query string in the incoming HTTP request. If the incoming HTTP request has no query parameters, the{query}
token renders as an empty string. -
lang=en&#query&time_zone=PST appears as
lang=en&country=us&time_zone=PST
in the redirect URI ifcountry=us
is the query string in the incoming HTTP request. If the incoming HTTP request has no query parameters, this value renders aslang=en&time_zone=PST
. -
protocol=#protocol&hostname=#host appears as
protocol=http&hostname=example.com
in the redirect URI if the protocol isHTTP
and the hostname isexample.com
in the incoming HTTP request. -
port=#port&hostname=#host appears as
port=8080&hostname=example.com
in the redirect URI if the port is8080
and the hostname isexample.com
in the incoming HTTP request URI.
163 164 165 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 163 def query @query end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 166 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'protocol': :'protocol', 'host': :'host', 'port': :'port', 'path': :'path', 'query': :'query' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 179 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'protocol': :'String', 'host': :'String', 'port': :'Integer', 'path': :'String', 'query': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 226 def ==(other) return true if equal?(other) self.class == other.class && protocol == other.protocol && host == other.host && port == other.port && path == other.path && query == other.query end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 260 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
240 241 242 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 240 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
249 250 251 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 249 def hash [protocol, host, port, path, query].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
293 294 295 296 297 298 299 300 301 302 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 293 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
287 288 289 |
# File 'lib/oci/load_balancer/models/redirect_uri.rb', line 287 def to_s to_hash.to_s end |