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

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

Overview

All the attributes of an audit event. For more information, see Viewing Audit Log Events.

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):

  • :event_type (String)

    The value to assign to the #event_type property

  • :cloud_events_version (String)

    The value to assign to the #cloud_events_version property

  • :event_type_version (String)

    The value to assign to the #event_type_version property

  • :source (String)

    The value to assign to the #source property

  • :event_id (String)

    The value to assign to the #event_id property

  • :event_time (DateTime)

    The value to assign to the #event_time property

  • :content_type (String)

    The value to assign to the #content_type property

  • :data (OCI::Audit::Models::Data)

    The value to assign to the #data property



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
160
161
162
# File 'lib/oci/audit/models/audit_event.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.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.cloud_events_version = attributes[:'cloudEventsVersion'] if attributes[:'cloudEventsVersion']

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

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

  self.event_type_version = attributes[:'eventTypeVersion'] if attributes[:'eventTypeVersion']

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

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

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

  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_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.content_type = attributes[:'contentType'] if attributes[:'contentType']

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

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

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

Instance Attribute Details

#cloud_events_versionString

[Required] The version of the CloudEvents specification. The structure of the envelope follows the CloudEvents industry standard format hosted by the Cloud Native Computing Foundation ( CNCF).

Audit uses version 0.1 specification of the CloudEvents event envelope.

Example: 0.1

Returns:

  • (String)


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

def cloud_events_version
  @cloud_events_version
end

#content_typeString

[Required] The content type of the data contained in data.

Example: application/json

Returns:

  • (String)


65
66
67
# File 'lib/oci/audit/models/audit_event.rb', line 65

def content_type
  @content_type
end

#dataOCI::Audit::Models::Data

This attribute is required.



69
70
71
# File 'lib/oci/audit/models/audit_event.rb', line 69

def data
  @data
end

#event_idString

[Required] The GUID of the event.

Returns:

  • (String)


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

def event_id
  @event_id
end

#event_timeDateTime

[Required] The time the event occurred, expressed in RFC 3339 timestamp format.

Example: 2019-09-18T00:10:59.252Z

Returns:

  • (DateTime)


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

def event_time
  @event_time
end

#event_typeString

[Required] The type of event that happened.

The service that produces the event can also add, remove, or change the meaning of a field. A service implementing these type changes would publish a new version of an eventType and revise the eventTypeVersion field.

Example: com.oraclecloud.ComputeApi.GetInstance

Returns:

  • (String)


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

def event_type
  @event_type
end

#event_type_versionString

[Required] The version of the event type. This version applies to the payload of the event, not the envelope. Use cloudEventsVersion to determine the version of the envelope.

Example: 2.0

Returns:

  • (String)


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

def event_type_version
  @event_type_version
end

#sourceString

[Required] The source of the event.

Example: ComputeApi

Returns:

  • (String)


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

def source
  @source
end

Class Method Details

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/oci/audit/models/audit_event.rb', line 72

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'event_type': :'eventType',
    'cloud_events_version': :'cloudEventsVersion',
    'event_type_version': :'eventTypeVersion',
    'source': :'source',
    'event_id': :'eventId',
    'event_time': :'eventTime',
    'content_type': :'contentType',
    'data': :'data'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/oci/audit/models/audit_event.rb', line 88

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'event_type': :'String',
    'cloud_events_version': :'String',
    'event_type_version': :'String',
    'source': :'String',
    'event_id': :'String',
    'event_time': :'DateTime',
    'content_type': :'String',
    'data': :'OCI::Audit::Models::Data'
    # 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



171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/oci/audit/models/audit_event.rb', line 171

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

  self.class == other.class &&
    event_type == other.event_type &&
    cloud_events_version == other.cloud_events_version &&
    event_type_version == other.event_type_version &&
    source == other.source &&
    event_id == other.event_id &&
    event_time == other.event_time &&
    content_type == other.content_type &&
    data == other.data
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



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/oci/audit/models/audit_event.rb', line 208

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


188
189
190
# File 'lib/oci/audit/models/audit_event.rb', line 188

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



197
198
199
# File 'lib/oci/audit/models/audit_event.rb', line 197

def hash
  [event_type, cloud_events_version, event_type_version, source, event_id, event_time, content_type, data].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



241
242
243
244
245
246
247
248
249
250
# File 'lib/oci/audit/models/audit_event.rb', line 241

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



235
236
237
# File 'lib/oci/audit/models/audit_event.rb', line 235

def to_s
  to_hash.to_s
end