class OCI::Audit::Models::Request
A container object for request attributes.
Attributes
The HTTP method of the request.
Example: `GET`
@return [String]
The HTTP header fields and values in the request.
Example:
----- { \"opc-principal\": [ \"{\\\"tenantId\\\":\\\"ocid1.tenancy.oc1..<unique_ID>\\\",\\\"subjectId\\\":\\\"ocid1.user.oc1..<unique_ID>\\\",\\\"claims\\\":[{\\\"key\\\":\\\"pstype\\\",\\\"value\\\":\\\"natv\\\",\\\"issuer\\\":\\\"authService.oracle.com\\\"},{\\\"key\\\":\\\"h_host\\\",\\\"value\\\":\\\"iaas.r2.oracleiaas.com\\\",\\\"issuer\\\":\\\"h\\\"},{\\\"key\\\":\\\"h_opc-request-id\\\",\\\"value\\\":\\\"<unique_ID>\\\",\\\"issuer\\\":\\\"h\\\"},{\\\"key\\\":\\\"ptype\\\",\\\"value\\\":\\\"user\\\",\\\"issuer\\\":\\\"authService.oracle.com\\\"},{\\\"key\\\":\\\"h_date\\\",\\\"value\\\":\\\"Wed, 18 Sep 2019 00:10:58 UTC\\\",\\\"issuer\\\":\\\"h\\\"},{\\\"key\\\":\\\"h_accept\\\",\\\"value\\\":\\\"application/json\\\",\\\"issuer\\\":\\\"h\\\"},{\\\"key\\\":\\\"authorization\\\",\\\"value\\\":\\\"Signature headers=\\\\\\\"date (request-target) host accept opc-request-id\\\\\\\",keyId=\\\\\\\"ocid1.tenancy.oc1..<unique_ID>/ocid1.user.oc1..<unique_ID>/8c:b4:5f:18:e7:ec:db:08:b8:fa:d2:2a:7d:11:76:ac\\\\\\\",algorithm=\\\\\\\"rsa-pss-sha256\\\\\\\",signature=\\\\\\\"<unique_ID>\\\\\\\",version=\\\\\\\"1\\\\\\\"\\\",\\\"issuer\\\":\\\"h\\\"},{\\\"key\\\":\\\"h_(request-target)\\\",\\\"value\\\":\\\"get /20160918/instances/ocid1.instance.oc1.phx.<unique_ID>\\\",\\\"issuer\\\":\\\"h\\\"}]}\" ], \"Accept\": [ \"application/json\" ], \"X-Oracle-Auth-Client-CN\": [ \"splat-proxy-se-02302.node.ad2.r2\" ], \"X-Forwarded-Host\": [ \"compute-api.svc.ad1.r2\" ], \"Connection\": [ \"close\" ], \"User-Agent\": [ \"Jersey/2.23 (HttpUrlConnection 1.8.0_212)\" ], \"X-Forwarded-For\": [ \"172.24.80.88\" ], \"X-Real-IP\": [ \"172.24.80.88\" ], \"oci-original-url\": [ \"https://iaas.r2.oracleiaas.com/20160918/instances/ocid1.instance.oc1.phx.<unique_ID>\" ], \"opc-request-id\": [ \"<unique_ID>\" ], \"Date\": [ \"Wed, 18 Sep 2019 00:10:58 UTC\" ] } -----
@return [Hash<String, Array<String>>]
The opc-request-id of the request.
@return [String]
The parameters supplied by the caller during this operation.
@return [Hash<String, Array<String>>]
The full path of the API request.
Example: `/20160918/instances/ocid1.instance.oc1.phx.<unique_ID>`
@return [String]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/oci/audit/models/request.rb, line 81 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'id': :'id', 'path': :'path', 'action': :'action', 'parameters': :'parameters', 'headers': :'headers' # rubocop:enable Style/SymbolLiteral } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :path The value to assign to the {#path} property @option attributes [String] :action The value to assign to the {#action} property @option attributes [Hash<String, Array<String>>] :parameters The value to assign to the {#parameters} property @option attributes [Hash<String, Array<String>>] :headers The value to assign to the {#headers} property
# File lib/oci/audit/models/request.rb, line 117 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.id = attributes[:'id'] if attributes[:'id'] self.path = attributes[:'path'] if attributes[:'path'] self.action = attributes[:'action'] if attributes[:'action'] self.parameters = attributes[:'parameters'] if attributes[:'parameters'] self.headers = attributes[:'headers'] if attributes[:'headers'] end
Attribute type mapping.
# File lib/oci/audit/models/request.rb, line 94 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'id': :'String', 'path': :'String', 'action': :'String', 'parameters': :'Hash<String, Array<String>>', 'headers': :'Hash<String, Array<String>>' # rubocop:enable Style/SymbolLiteral } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] other the other object to be compared
# File lib/oci/audit/models/request.rb, line 141 def ==(other) return true if equal?(other) self.class == other.class && id == other.id && path == other.path && action == other.action && parameters == other.parameters && headers == other.headers end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/oci/audit/models/request.rb, line 175 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
@see the `==` method @param [Object] other the other object to be compared
# File lib/oci/audit/models/request.rb, line 155 def eql?(other) self == other end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/oci/audit/models/request.rb, line 164 def hash [id, path, action, parameters, headers].hash end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/oci/audit/models/request.rb, line 208 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/oci/audit/models/request.rb, line 202 def to_s to_hash.to_s end
Private Instance Methods
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/oci/audit/models/request.rb, line 225 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end