Class: OCI::Audit::Models::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/audit/models/request.rb

Overview

A container object for request attributes.

Example:

—– { "id": "<unique_ID>", "path": "/20160918/instances/ocid1.instance.oc1.phx.<unique_ID>", "action": "GET", "parameters": {}, "headers": { "opc-principal": [ "\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService.oracle\“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\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle.com\”,18 Sep 2019 00:10:58 UTC\”,\“issuer\”:\“h\”,\“key\”:\“h_accept\”,\“value\”:\“application/json\”,\“issuer\”:\“h\”,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\”,/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": [ "iaas.r2.oracleiaas.com/20160918/instances/ocid1.instance.oc1.phx.>" ], "opc-request-id": [ "<unique_ID>" ], "Date": [ "Wed, 18 Sep 2019 00:10:58 UTC" ] } } —–

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Request

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :path (String)

    The value to assign to the #path property

  • :action (String)

    The value to assign to the #action property

  • :parameters (Hash<String, Array<String>>)

    The value to assign to the #parameters property

  • :headers (Hash<String, Array<String>>)

    The value to assign to the #headers property



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/oci/audit/models/request.rb', line 163

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

Instance Attribute Details

#actionString

The HTTP method of the request.

Example: GET

Returns:

  • (String)


74
75
76
# File 'lib/oci/audit/models/request.rb', line 74

def action
  @action
end

#headersHash<String, Array<String>>

The HTTP header fields and values in the request.

Example:

—– { "opc-principal": [ "OCI::Audit::Models::Request.\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService\“tenantId\”:\“ocid1.tenancy.oc1..<unique_ID>\”,\“subjectId\”:\“ocid1.user.oc1..<unique_ID>\”,\“claims\”:[{\“key\”:\“pstype\”,\“value\”:\“natv\”,\“issuer\”:\“authService.oracle\“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\”,OCI::Audit::Models::Request.\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle\“key\”:\“ptype\”,\“value\”:\“user\”,\“issuer\”:\“authService.oracle.com\”,18 Sep 2019 00:10:58 UTC\”,\“issuer\”:\“h\”,\“key\”:\“h_accept\”,\“value\”:\“application/json\”,\“issuer\”:\“h\”,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\”,/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": [ "iaas.r2.oracleiaas.com/20160918/instances/ocid1.instance.oc1.phx.>" ], "opc-request-id": [ "<unique_ID>" ], "Date": [ "Wed, 18 Sep 2019 00:10:58 UTC" ] } —–

Returns:

  • (Hash<String, Array<String>>)


124
125
126
# File 'lib/oci/audit/models/request.rb', line 124

def headers
  @headers
end

#idString

The opc-request-id of the request.

Returns:

  • (String)


60
61
62
# File 'lib/oci/audit/models/request.rb', line 60

def id
  @id
end

#parametersHash<String, Array<String>>

The parameters supplied by the caller during this operation.

Returns:

  • (Hash<String, Array<String>>)


79
80
81
# File 'lib/oci/audit/models/request.rb', line 79

def parameters
  @parameters
end

#pathString

The full path of the API request.

Example: /20160918/instances/ocid1.instance.oc1.phx.<unique_ID>

Returns:

  • (String)


67
68
69
# File 'lib/oci/audit/models/request.rb', line 67

def path
  @path
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/oci/audit/models/request.rb', line 127

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'path': :'path',
    'action': :'action',
    'parameters': :'parameters',
    'headers': :'headers'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



140
141
142
143
144
145
146
147
148
149
150
# File 'lib/oci/audit/models/request.rb', line 140

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

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



187
188
189
190
191
192
193
194
195
196
# File 'lib/oci/audit/models/request.rb', line 187

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

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/audit/models/request.rb', line 221

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


201
202
203
# File 'lib/oci/audit/models/request.rb', line 201

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



210
211
212
# File 'lib/oci/audit/models/request.rb', line 210

def hash
  [id, path, action, parameters, headers].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/audit/models/request.rb', line 254

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



248
249
250
# File 'lib/oci/audit/models/request.rb', line 248

def to_s
  to_hash.to_s
end