Class: OCI::Audit::Models::Response
- Inherits:
-
Object
- Object
- OCI::Audit::Models::Response
- Defined in:
- lib/oci/audit/models/response.rb
Overview
A container object for response attributes.
Instance Attribute Summary collapse
-
#headers ⇒ Hash<String, Array<String>>
The headers of the response.
-
#message ⇒ String
A friendly description of what happened during the operation.
-
#payload ⇒ Hash<String, Object>
This value is included for backward compatibility with the Audit version 1 schema, where it contained metadata of interest from the response payload.
-
#response_time ⇒ DateTime
The time of the response to the audited request, expressed in RFC 3339 timestamp format.
-
#status ⇒ String
The status code of the response.
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 = {}) ⇒ Response
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 = {}) ⇒ Response
Initializes the object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/oci/audit/models/response.rb', line 114 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.status = attributes[:'status'] if attributes[:'status'] self.response_time = attributes[:'responseTime'] if attributes[:'responseTime'] raise 'You cannot provide both :responseTime and :response_time' if attributes.key?(:'responseTime') && attributes.key?(:'response_time') self.response_time = attributes[:'response_time'] if attributes[:'response_time'] self.headers = attributes[:'headers'] if attributes[:'headers'] self.payload = attributes[:'payload'] if attributes[:'payload'] self. = attributes[:'message'] if attributes[:'message'] end |
Instance Attribute Details
#headers ⇒ Hash<String, Array<String>>
The headers of the response.
Example:
—– { "ETag": [ "<unique_ID>" ], "Connection": [ "close" ], "Content-Length": [ "1828" ], "opc-request-id": [ "<unique_ID>" ], "Date": [ "Wed, 18 Sep 2019 00:10:59 GMT" ], "Content-Type": [ "application/json" ] } —–
55 56 57 |
# File 'lib/oci/audit/models/response.rb', line 55 def headers @headers end |
#message ⇒ String
A friendly description of what happened during the operation. Use this for troubleshooting.
75 76 77 |
# File 'lib/oci/audit/models/response.rb', line 75 def @message end |
#payload ⇒ Hash<String, Object>
This value is included for backward compatibility with the Audit version 1 schema, where it contained metadata of interest from the response payload.
Example:
—– { "resourceName": "my_instance", "id": "ocid1.instance.oc1.phx.<unique_ID>" } —–
70 71 72 |
# File 'lib/oci/audit/models/response.rb', line 70 def payload @payload end |
#response_time ⇒ DateTime
The time of the response to the audited request, expressed in RFC 3339 timestamp format.
Example: 2019-09-18T00:10:59.278Z
25 26 27 |
# File 'lib/oci/audit/models/response.rb', line 25 def response_time @response_time end |
#status ⇒ String
The status code of the response.
Example: 200
17 18 19 |
# File 'lib/oci/audit/models/response.rb', line 17 def status @status end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/oci/audit/models/response.rb', line 78 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'status': :'status', 'response_time': :'responseTime', 'headers': :'headers', 'payload': :'payload', 'message': :'message' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/oci/audit/models/response.rb', line 91 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'status': :'String', 'response_time': :'DateTime', 'headers': :'Hash<String, Array<String>>', 'payload': :'Hash<String, Object>', 'message': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/oci/audit/models/response.rb', line 142 def ==(other) return true if equal?(other) self.class == other.class && status == other.status && response_time == other.response_time && headers == other.headers && payload == other.payload && == other. end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/oci/audit/models/response.rb', line 176 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
156 157 158 |
# File 'lib/oci/audit/models/response.rb', line 156 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
165 166 167 |
# File 'lib/oci/audit/models/response.rb', line 165 def hash [status, response_time, headers, payload, ].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
209 210 211 212 213 214 215 216 217 218 |
# File 'lib/oci/audit/models/response.rb', line 209 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
203 204 205 |
# File 'lib/oci/audit/models/response.rb', line 203 def to_s to_hash.to_s end |