Class: OCI::Audit::Models::AuditEvent

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

Overview

AuditEvent model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AuditEvent

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :tenant_id (String)

    The value to assign to the #tenant_id property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :compartment_name (String)

    The value to assign to the #compartment_name property

  • :event_id (String)

    The value to assign to the #event_id property

  • :event_name (String)

    The value to assign to the #event_name property

  • :event_source (String)

    The value to assign to the #event_source property

  • :event_type (String)

    The value to assign to the #event_type property

  • :event_time (DateTime)

    The value to assign to the #event_time property

  • :principal_id (String)

    The value to assign to the #principal_id property

  • :credential_id (String)

    The value to assign to the #credential_id property

  • :request_action (String)

    The value to assign to the #request_action property

  • :request_id (String)

    The value to assign to the #request_id property

  • :request_agent (String)

    The value to assign to the #request_agent property

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

    The value to assign to the #request_headers property

  • :request_origin (String)

    The value to assign to the #request_origin property

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

    The value to assign to the #request_parameters property

  • :request_resource (String)

    The value to assign to the #request_resource property

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

    The value to assign to the #response_headers property

  • :response_status (String)

    The value to assign to the #response_status property

  • :response_time (DateTime)

    The value to assign to the #response_time property

  • :response_payload (Hash<String, Object>)

    The value to assign to the #response_payload property

  • :user_name (String)

    The value to assign to the #user_name property



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/oci/audit/models/audit_event.rb', line 189

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.tenant_id = attributes[:'tenantId'] if attributes[:'tenantId']

  raise 'You cannot provide both :tenantId and :tenant_id' if attributes.key?(:'tenantId') && attributes.key?(:'tenant_id')

  self.tenant_id = attributes[:'tenant_id'] if attributes[:'tenant_id']

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

  raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')

  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']

  self.compartment_name = attributes[:'compartmentName'] if attributes[:'compartmentName']

  raise 'You cannot provide both :compartmentName and :compartment_name' if attributes.key?(:'compartmentName') && attributes.key?(:'compartment_name')

  self.compartment_name = attributes[:'compartment_name'] if attributes[:'compartment_name']

  self.event_id = attributes[:'eventId'] if attributes[:'eventId']

  raise 'You cannot provide both :eventId and :event_id' if attributes.key?(:'eventId') && attributes.key?(:'event_id')

  self.event_id = attributes[:'event_id'] if attributes[:'event_id']

  self.event_name = attributes[:'eventName'] if attributes[:'eventName']

  raise 'You cannot provide both :eventName and :event_name' if attributes.key?(:'eventName') && attributes.key?(:'event_name')

  self.event_name = attributes[:'event_name'] if attributes[:'event_name']

  self.event_source = attributes[:'eventSource'] if attributes[:'eventSource']

  raise 'You cannot provide both :eventSource and :event_source' if attributes.key?(:'eventSource') && attributes.key?(:'event_source')

  self.event_source = attributes[:'event_source'] if attributes[:'event_source']

  self.event_type = attributes[:'eventType'] if attributes[:'eventType']

  raise 'You cannot provide both :eventType and :event_type' if attributes.key?(:'eventType') && attributes.key?(:'event_type')

  self.event_type = attributes[:'event_type'] if attributes[:'event_type']

  self.event_time = attributes[:'eventTime'] if attributes[:'eventTime']

  raise 'You cannot provide both :eventTime and :event_time' if attributes.key?(:'eventTime') && attributes.key?(:'event_time')

  self.event_time = attributes[:'event_time'] if attributes[:'event_time']

  self.principal_id = attributes[:'principalId'] if attributes[:'principalId']

  raise 'You cannot provide both :principalId and :principal_id' if attributes.key?(:'principalId') && attributes.key?(:'principal_id')

  self.principal_id = attributes[:'principal_id'] if attributes[:'principal_id']

  self.credential_id = attributes[:'credentialId'] if attributes[:'credentialId']

  raise 'You cannot provide both :credentialId and :credential_id' if attributes.key?(:'credentialId') && attributes.key?(:'credential_id')

  self.credential_id = attributes[:'credential_id'] if attributes[:'credential_id']

  self.request_action = attributes[:'requestAction'] if attributes[:'requestAction']

  raise 'You cannot provide both :requestAction and :request_action' if attributes.key?(:'requestAction') && attributes.key?(:'request_action')

  self.request_action = attributes[:'request_action'] if attributes[:'request_action']

  self.request_id = attributes[:'requestId'] if attributes[:'requestId']

  raise 'You cannot provide both :requestId and :request_id' if attributes.key?(:'requestId') && attributes.key?(:'request_id')

  self.request_id = attributes[:'request_id'] if attributes[:'request_id']

  self.request_agent = attributes[:'requestAgent'] if attributes[:'requestAgent']

  raise 'You cannot provide both :requestAgent and :request_agent' if attributes.key?(:'requestAgent') && attributes.key?(:'request_agent')

  self.request_agent = attributes[:'request_agent'] if attributes[:'request_agent']

  self.request_headers = attributes[:'requestHeaders'] if attributes[:'requestHeaders']

  raise 'You cannot provide both :requestHeaders and :request_headers' if attributes.key?(:'requestHeaders') && attributes.key?(:'request_headers')

  self.request_headers = attributes[:'request_headers'] if attributes[:'request_headers']

  self.request_origin = attributes[:'requestOrigin'] if attributes[:'requestOrigin']

  raise 'You cannot provide both :requestOrigin and :request_origin' if attributes.key?(:'requestOrigin') && attributes.key?(:'request_origin')

  self.request_origin = attributes[:'request_origin'] if attributes[:'request_origin']

  self.request_parameters = attributes[:'requestParameters'] if attributes[:'requestParameters']

  raise 'You cannot provide both :requestParameters and :request_parameters' if attributes.key?(:'requestParameters') && attributes.key?(:'request_parameters')

  self.request_parameters = attributes[:'request_parameters'] if attributes[:'request_parameters']

  self.request_resource = attributes[:'requestResource'] if attributes[:'requestResource']

  raise 'You cannot provide both :requestResource and :request_resource' if attributes.key?(:'requestResource') && attributes.key?(:'request_resource')

  self.request_resource = attributes[:'request_resource'] if attributes[:'request_resource']

  self.response_headers = attributes[:'responseHeaders'] if attributes[:'responseHeaders']

  raise 'You cannot provide both :responseHeaders and :response_headers' if attributes.key?(:'responseHeaders') && attributes.key?(:'response_headers')

  self.response_headers = attributes[:'response_headers'] if attributes[:'response_headers']

  self.response_status = attributes[:'responseStatus'] if attributes[:'responseStatus']

  raise 'You cannot provide both :responseStatus and :response_status' if attributes.key?(:'responseStatus') && attributes.key?(:'response_status')

  self.response_status = attributes[:'response_status'] if attributes[:'response_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.response_payload = attributes[:'responsePayload'] if attributes[:'responsePayload']

  raise 'You cannot provide both :responsePayload and :response_payload' if attributes.key?(:'responsePayload') && attributes.key?(:'response_payload')

  self.response_payload = attributes[:'response_payload'] if attributes[:'response_payload']

  self.user_name = attributes[:'userName'] if attributes[:'userName']

  raise 'You cannot provide both :userName and :user_name' if attributes.key?(:'userName') && attributes.key?(:'user_name')

  self.user_name = attributes[:'user_name'] if attributes[:'user_name']
end

Instance Attribute Details

#compartment_idString

The OCID of the compartment.

Returns:

  • (String)


15
16
17
# File 'lib/oci/audit/models/audit_event.rb', line 15

def compartment_id
  @compartment_id
end

#compartment_nameString

The name of the compartment. This value is the friendly name associated with compartmentId. This value can change, but the service logs the value that appeared at the time of the audit event.

Returns:

  • (String)


21
22
23
# File 'lib/oci/audit/models/audit_event.rb', line 21

def compartment_name
  @compartment_name
end

#credential_idString

The credential ID of the user. This value is extracted from the HTTP ‘Authorization’ request header. It consists of the tenantId, userId, and user fingerprint, all delimited by a slash (/).

Returns:

  • (String)


51
52
53
# File 'lib/oci/audit/models/audit_event.rb', line 51

def credential_id
  @credential_id
end

#event_idString

The GUID of the event.

Returns:

  • (String)


25
26
27
# File 'lib/oci/audit/models/audit_event.rb', line 25

def event_id
  @event_id
end

#event_nameString

The name of the event. Example: ‘LaunchInstance`

Returns:

  • (String)


31
32
33
# File 'lib/oci/audit/models/audit_event.rb', line 31

def event_name
  @event_name
end

#event_sourceString

The source of the event.

Returns:

  • (String)


35
36
37
# File 'lib/oci/audit/models/audit_event.rb', line 35

def event_source
  @event_source
end

#event_timeDateTime

The time the event occurred, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format.

Returns:

  • (DateTime)


43
44
45
# File 'lib/oci/audit/models/audit_event.rb', line 43

def event_time
  @event_time
end

#event_typeString

The type of the event.

Returns:

  • (String)


39
40
41
# File 'lib/oci/audit/models/audit_event.rb', line 39

def event_type
  @event_type
end

#principal_idString

The OCID of the user whose action triggered the event.

Returns:

  • (String)


47
48
49
# File 'lib/oci/audit/models/audit_event.rb', line 47

def principal_id
  @principal_id
end

#request_actionString

The HTTP method of the request.

Returns:

  • (String)


55
56
57
# File 'lib/oci/audit/models/audit_event.rb', line 55

def request_action
  @request_action
end

#request_agentString

The user agent of the client that made the request.

Returns:

  • (String)


63
64
65
# File 'lib/oci/audit/models/audit_event.rb', line 63

def request_agent
  @request_agent
end

#request_headersHash<String, Array<String>>

The HTTP header fields and values in the request.

Returns:

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


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

def request_headers
  @request_headers
end

#request_idString

The opc-request-id of the request.

Returns:

  • (String)


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

def request_id
  @request_id
end

#request_originString

The IP address of the source of the request.

Returns:

  • (String)


71
72
73
# File 'lib/oci/audit/models/audit_event.rb', line 71

def request_origin
  @request_origin
end

#request_parametersHash<String, Array<String>>

The query parameter fields and values for the request.

Returns:

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


75
76
77
# File 'lib/oci/audit/models/audit_event.rb', line 75

def request_parameters
  @request_parameters
end

#request_resourceString

The resource targeted by the request.

Returns:

  • (String)


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

def request_resource
  @request_resource
end

#response_headersHash<String, Array<String>>

The headers of the response.

Returns:

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


83
84
85
# File 'lib/oci/audit/models/audit_event.rb', line 83

def response_headers
  @response_headers
end

#response_payloadHash<String, Object>

Metadata of interest from the response payload. For example, the OCID of a resource.

Returns:

  • (Hash<String, Object>)


95
96
97
# File 'lib/oci/audit/models/audit_event.rb', line 95

def response_payload
  @response_payload
end

#response_statusString

The status code of the response.

Returns:

  • (String)


87
88
89
# File 'lib/oci/audit/models/audit_event.rb', line 87

def response_status
  @response_status
end

#response_timeDateTime

The time of the response to the audited request, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format.

Returns:

  • (DateTime)


91
92
93
# File 'lib/oci/audit/models/audit_event.rb', line 91

def response_time
  @response_time
end

#tenant_idString

The OCID of the tenant.

Returns:

  • (String)


11
12
13
# File 'lib/oci/audit/models/audit_event.rb', line 11

def tenant_id
  @tenant_id
end

#user_nameString

The name of the user or service. This value is the friendly name associated with principalId.

Returns:

  • (String)


99
100
101
# File 'lib/oci/audit/models/audit_event.rb', line 99

def user_name
  @user_name
end

Class Method Details

.attribute_mapObject

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



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/oci/audit/models/audit_event.rb', line 102

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'tenant_id': :'tenantId',
    'compartment_id': :'compartmentId',
    'compartment_name': :'compartmentName',
    'event_id': :'eventId',
    'event_name': :'eventName',
    'event_source': :'eventSource',
    'event_type': :'eventType',
    'event_time': :'eventTime',
    'principal_id': :'principalId',
    'credential_id': :'credentialId',
    'request_action': :'requestAction',
    'request_id': :'requestId',
    'request_agent': :'requestAgent',
    'request_headers': :'requestHeaders',
    'request_origin': :'requestOrigin',
    'request_parameters': :'requestParameters',
    'request_resource': :'requestResource',
    'response_headers': :'responseHeaders',
    'response_status': :'responseStatus',
    'response_time': :'responseTime',
    'response_payload': :'responsePayload',
    'user_name': :'userName'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/audit/models/audit_event.rb', line 132

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'tenant_id': :'String',
    'compartment_id': :'String',
    'compartment_name': :'String',
    'event_id': :'String',
    'event_name': :'String',
    'event_source': :'String',
    'event_type': :'String',
    'event_time': :'DateTime',
    'principal_id': :'String',
    'credential_id': :'String',
    'request_action': :'String',
    'request_id': :'String',
    'request_agent': :'String',
    'request_headers': :'Hash<String, Array<String>>',
    'request_origin': :'String',
    'request_parameters': :'Hash<String, Array<String>>',
    'request_resource': :'String',
    'response_headers': :'Hash<String, Array<String>>',
    'response_status': :'String',
    'response_time': :'DateTime',
    'response_payload': :'Hash<String, Object>',
    'user_name': :'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



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/oci/audit/models/audit_event.rb', line 335

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    tenant_id == other.tenant_id &&
    compartment_id == other.compartment_id &&
    compartment_name == other.compartment_name &&
    event_id == other.event_id &&
    event_name == other.event_name &&
    event_source == other.event_source &&
    event_type == other.event_type &&
    event_time == other.event_time &&
    principal_id == other.principal_id &&
    credential_id == other.credential_id &&
    request_action == other.request_action &&
    request_id == other.request_id &&
    request_agent == other.request_agent &&
    request_headers == other.request_headers &&
    request_origin == other.request_origin &&
    request_parameters == other.request_parameters &&
    request_resource == other.request_resource &&
    response_headers == other.response_headers &&
    response_status == other.response_status &&
    response_time == other.response_time &&
    response_payload == other.response_payload &&
    user_name == other.user_name
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



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/oci/audit/models/audit_event.rb', line 386

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


366
367
368
# File 'lib/oci/audit/models/audit_event.rb', line 366

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



375
376
377
# File 'lib/oci/audit/models/audit_event.rb', line 375

def hash
  [tenant_id, compartment_id, compartment_name, event_id, event_name, event_source, event_type, event_time, principal_id, credential_id, request_action, request_id, request_agent, request_headers, request_origin, request_parameters, request_resource, response_headers, response_status, response_time, response_payload, user_name].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



419
420
421
422
423
424
425
426
427
428
# File 'lib/oci/audit/models/audit_event.rb', line 419

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



413
414
415
# File 'lib/oci/audit/models/audit_event.rb', line 413

def to_s
  to_hash.to_s
end