Class: OCI::Audit::Models::Data

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

Overview

The payload of the event. Information within data comes from the resource emitting the event.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Data

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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
# File 'lib/oci/audit/models/data.rb', line 164

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_grouping_id = attributes[:'eventGroupingId'] if attributes[:'eventGroupingId']

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

  self.event_grouping_id = attributes[:'event_grouping_id'] if attributes[:'event_grouping_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.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.resource_name = attributes[:'resourceName'] if attributes[:'resourceName']

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

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

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

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

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

  self.availability_domain = attributes[:'availabilityDomain'] if attributes[:'availabilityDomain']

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

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

  self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']

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

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

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

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

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

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

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

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

  self.state_change = attributes[:'stateChange'] if attributes[:'stateChange']

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

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

  self.additional_details = attributes[:'additionalDetails'] if attributes[:'additionalDetails']

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

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

Instance Attribute Details

#additional_detailsHash<String, Object>

A container object for attribues unique to the resource emitting the event.

Example:

—– { "imageId": "ocid1.image.oc1.phx.<unique_ID>", "shape": "VM.Standard1.1", "type": "CustomerVmi" } —–

Returns:

  • (Hash<String, Object>)


98
99
100
# File 'lib/oci/audit/models/data.rb', line 98

def additional_details
  @additional_details
end

#availability_domainString

The availability domain where the resource resides.

Returns:

  • (String)


54
55
56
# File 'lib/oci/audit/models/data.rb', line 54

def availability_domain
  @availability_domain
end

#compartment_idString

The OCID of the compartment of the resource emitting the event.

Returns:

  • (String)


29
30
31
# File 'lib/oci/audit/models/data.rb', line 29

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.

Example: CompartmentA

Returns:

  • (String)


38
39
40
# File 'lib/oci/audit/models/data.rb', line 38

def compartment_name
  @compartment_name
end

#defined_tagsHash<String, Hash<String, Object>>

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.

Example: {\"Operations\": {\"CostCenter\": \"42\"}}

Returns:

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


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

def defined_tags
  @defined_tags
end

#event_grouping_idString

This value links multiple audit events that are part of the same API operation. For example, a long running API operations that emit an event at the start and the end of an operation would use the same value in this field for both events.

Returns:

  • (String)


16
17
18
# File 'lib/oci/audit/models/data.rb', line 16

def event_grouping_id
  @event_grouping_id
end

#event_nameString

Name of the API operation that generated this event.

Example: GetInstance

Returns:

  • (String)


23
24
25
# File 'lib/oci/audit/models/data.rb', line 23

def event_name
  @event_name
end

#freeform_tagsHash<String, String>

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Exists for cross-compatibility only. For more information, see Resource Tags.

Example: {\"Department\": \"Finance\"}

Returns:

  • (Hash<String, String>)


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

def freeform_tags
  @freeform_tags
end

#identityOCI::Audit::Models::Identity



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

def identity
  @identity
end

#requestOCI::Audit::Models::Request



77
78
79
# File 'lib/oci/audit/models/data.rb', line 77

def request
  @request
end

#resource_idString

An OCID or some other ID for the resource emitting the event.

Returns:

  • (String)


49
50
51
# File 'lib/oci/audit/models/data.rb', line 49

def resource_id
  @resource_id
end

#resource_nameString

The name of the resource emitting the event.

Returns:

  • (String)


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

def resource_name
  @resource_name
end

#responseOCI::Audit::Models::Response



80
81
82
# File 'lib/oci/audit/models/data.rb', line 80

def response
  @response
end

#state_changeOCI::Audit::Models::StateChange



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

def state_change
  @state_change
end

Class Method Details

.attribute_mapObject

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/oci/audit/models/data.rb', line 101

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'event_grouping_id': :'eventGroupingId',
    'event_name': :'eventName',
    'compartment_id': :'compartmentId',
    'compartment_name': :'compartmentName',
    'resource_name': :'resourceName',
    'resource_id': :'resourceId',
    'availability_domain': :'availabilityDomain',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'identity': :'identity',
    'request': :'request',
    'response': :'response',
    'state_change': :'stateChange',
    'additional_details': :'additionalDetails'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/oci/audit/models/data.rb', line 123

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'event_grouping_id': :'String',
    'event_name': :'String',
    'compartment_id': :'String',
    'compartment_name': :'String',
    'resource_name': :'String',
    'resource_id': :'String',
    'availability_domain': :'String',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'identity': :'OCI::Audit::Models::Identity',
    'request': :'OCI::Audit::Models::Request',
    'response': :'OCI::Audit::Models::Response',
    'state_change': :'OCI::Audit::Models::StateChange',
    'additional_details': :'Hash<String, Object>'
    # 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



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/oci/audit/models/data.rb', line 250

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

  self.class == other.class &&
    event_grouping_id == other.event_grouping_id &&
    event_name == other.event_name &&
    compartment_id == other.compartment_id &&
    compartment_name == other.compartment_name &&
    resource_name == other.resource_name &&
    resource_id == other.resource_id &&
    availability_domain == other.availability_domain &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    identity == other.identity &&
    request == other.request &&
    response == other.response &&
    state_change == other.state_change &&
    additional_details == other.additional_details
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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/oci/audit/models/data.rb', line 293

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


273
274
275
# File 'lib/oci/audit/models/data.rb', line 273

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



282
283
284
# File 'lib/oci/audit/models/data.rb', line 282

def hash
  [event_grouping_id, event_name, compartment_id, compartment_name, resource_name, resource_id, availability_domain, freeform_tags, defined_tags, identity, request, response, state_change, additional_details].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



326
327
328
329
330
331
332
333
334
335
# File 'lib/oci/audit/models/data.rb', line 326

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



320
321
322
# File 'lib/oci/audit/models/data.rb', line 320

def to_s
  to_hash.to_s
end