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.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\"
      ]
    }
  }
-----

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



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

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)


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

def action
  @action
end

#headersHash<String, Array<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\"
    ]
  }
-----

Returns:

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


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

def headers
  @headers
end

#idString

The opc-request-id of the request.

Returns:

  • (String)


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

def id
  @id
end

#parametersHash<String, Array<String>>

The parameters supplied by the caller during this operation.

Returns:

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


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

def parameters
  @parameters
end

#pathString

The full path of the API request.

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

Returns:

  • (String)


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

def path
  @path
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end