Class: OCI::Waf::Models::ReturnHttpResponseAction
- Defined in:
- lib/oci/waf/models/return_http_response_action.rb
Overview
An object that represents an action which returns a defined HTTP response.
Constant Summary
Constants inherited from Action
Instance Attribute Summary collapse
- #body ⇒ OCI::Waf::Models::HttpResponseBody
-
#code ⇒ Integer
[Required] Response code.
-
#headers ⇒ Array<OCI::Waf::Models::ResponseHeader>
Adds headers defined in this array for HTTP response.
Attributes inherited from Action
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 = {}) ⇒ ReturnHttpResponseAction
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.
Methods inherited from Action
Constructor Details
#initialize(attributes = {}) ⇒ ReturnHttpResponseAction
Initializes the object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 122 def initialize(attributes = {}) return unless attributes.is_a?(Hash) attributes['type'] = 'RETURN_HTTP_RESPONSE' super(attributes) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.code = attributes[:'code'] if attributes[:'code'] self.headers = attributes[:'headers'] if attributes[:'headers'] self.body = attributes[:'body'] if attributes[:'body'] end |
Instance Attribute Details
#body ⇒ OCI::Waf::Models::HttpResponseBody
84 85 86 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 84 def body @body end |
#code ⇒ Integer
[Required] Response code.
The following response codes are valid values for this property:
-
2xx
200 OK 201 Created 202 Accepted 206 Partial Content
-
3xx
300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 307 Temporary Redirect
-
4xx
400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 408 Request Timeout 409 Conflict 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 422 Unprocessable Entity 429 Too Many Requests 494 Request Header Too Large 495 Cert Error 496 No Cert 497 HTTP to HTTPS
-
5xx
500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 507 Insufficient Storage
Example: 200
65 66 67 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 65 def code @code end |
#headers ⇒ Array<OCI::Waf::Models::ResponseHeader>
Adds headers defined in this array for HTTP response.
Hop-by-hop headers are not allowed to be set:
-
Connection
-
Keep-Alive
-
Proxy-Authenticate
-
Proxy-Authorization
-
TE
-
Trailer
-
Transfer-Encoding
-
Upgrade
81 82 83 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 81 def headers @headers end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 87 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'type': :'type', 'name': :'name', 'code': :'code', 'headers': :'headers', 'body': :'body' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 100 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'type': :'String', 'name': :'String', 'code': :'Integer', 'headers': :'Array<OCI::Waf::Models::ResponseHeader>', 'body': :'OCI::Waf::Models::HttpResponseBody' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 146 def ==(other) return true if equal?(other) self.class == other.class && type == other.type && name == other.name && code == other.code && headers == other.headers && body == other.body end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 180 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
160 161 162 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 160 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
169 170 171 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 169 def hash [type, name, code, headers, body].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
213 214 215 216 217 218 219 220 221 222 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 213 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
207 208 209 |
# File 'lib/oci/waf/models/return_http_response_action.rb', line 207 def to_s to_hash.to_s end |