Class: OCI::LoadBalancer::Models::ControlAccessUsingHttpMethodsRule
- Inherits:
-
LoadBalancer::Models::Rule
- Object
- LoadBalancer::Models::Rule
- OCI::LoadBalancer::Models::ControlAccessUsingHttpMethodsRule
- Defined in:
- lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb
Overview
An object that represents the action of returning a specified response code when the requested HTTP method is not in the list of allowed methods for the listener. The load balancer does not forward a disallowed request to the back end servers. The default response code is ‘405 Method Not Allowed`.
If you set the response code to ‘405` or leave it blank, the system adds an "allow" response header that contains a list of the allowed methods for the listener. If you set the response code to anything other than `405` (or blank), the system does not add the "allow" response header with a list of allowed methods.
This rule applies only to HTTP listeners. No more than one ‘ControlAccessUsingHttpMethodsRule` object can be present in a given listener.
Instance Attribute Summary collapse
-
#allowed_methods ⇒ Array<String>
[Required] The list of HTTP methods allowed for this listener.
-
#status_code ⇒ Integer
The HTTP status code to return when the requested HTTP method is not in the list of allowed methods.
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 = {}) ⇒ ControlAccessUsingHttpMethodsRule
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 = {}) ⇒ ControlAccessUsingHttpMethodsRule
Initializes the object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 77 def initialize(attributes = {}) return unless attributes.is_a?(Hash) attributes['action'] = 'CONTROL_ACCESS_USING_HTTP_METHODS' super(attributes) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.allowed_methods = attributes[:'allowedMethods'] if attributes[:'allowedMethods'] raise 'You cannot provide both :allowedMethods and :allowed_methods' if attributes.key?(:'allowedMethods') && attributes.key?(:'allowed_methods') self.allowed_methods = attributes[:'allowed_methods'] if attributes[:'allowed_methods'] self.status_code = attributes[:'statusCode'] if attributes[:'statusCode'] self.status_code = 405 if status_code.nil? && !attributes.key?(:'statusCode') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :statusCode and :status_code' if attributes.key?(:'statusCode') && attributes.key?(:'status_code') self.status_code = attributes[:'status_code'] if attributes[:'status_code'] self.status_code = 405 if status_code.nil? && !attributes.key?(:'statusCode') && !attributes.key?(:'status_code') # rubocop:disable Style/StringLiterals end |
Instance Attribute Details
#allowed_methods ⇒ Array<String>
[Required] The list of HTTP methods allowed for this listener.
By default, you can specify only the standard HTTP methods defined in the [HTTP Method Registry](www.iana.org/assignments/http-methods/http-methods.xhtml). You can also see a list of supported standard HTTP methods in the Load Balancing service documentation at [Managing Rule Sets](docs.cloud.oracle.com/Content/Balance/Tasks/managingrulesets.htm).
Your backend application must be able to handle the methods specified in this list.
The list of HTTP methods is extensible. If you need to configure custom HTTP methods, contact [My Oracle Support](support.oracle.com/) to remove the restriction for your tenancy.
Example: ["GET", "PUT", "POST", "PROPFIND"]
36 37 38 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 36 def allowed_methods @allowed_methods end |
#status_code ⇒ Integer
The HTTP status code to return when the requested HTTP method is not in the list of allowed methods. The associated status line returned with the code is mapped from the standard HTTP specification. The default value is ‘405 (Method Not Allowed)`.
Example: 403
45 46 47 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 45 def status_code @status_code end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
48 49 50 51 52 53 54 55 56 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 48 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'action': :'action', 'allowed_methods': :'allowedMethods', 'status_code': :'statusCode' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
59 60 61 62 63 64 65 66 67 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 59 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'action': :'String', 'allowed_methods': :'Array<String>', 'status_code': :'Integer' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
109 110 111 112 113 114 115 116 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 109 def ==(other) return true if equal?(other) self.class == other.class && action == other.action && allowed_methods == other.allowed_methods && status_code == other.status_code end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 141 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
121 122 123 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 121 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
130 131 132 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 130 def hash [action, allowed_methods, status_code].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 174 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
168 169 170 |
# File 'lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb', line 168 def to_s to_hash.to_s end |