Class: SmplkitGeneratedClient::Audit::Event
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- SmplkitGeneratedClient::Audit::Event
- Defined in:
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb
Overview
An audit event — a record that something happened, attributed to an actor and a resource. When recording a snapshot of the resource at the time of the event, place it inside ‘data`. smplkit’s own integrations nest it under ‘data.snapshot`, but the slot is yours to use however you like.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#actor_id ⇒ Object
Identifier of the actor that caused the event.
-
#actor_label ⇒ Object
Human-readable label for the actor (e.g. an email address or API key name) at the time the event was recorded.
-
#actor_type ⇒ Object
Kind of actor that caused the event, e.g.
-
#category ⇒ Object
Free-form bucket label, e.g.
-
#created_at ⇒ Object
When the event was received and recorded.
-
#data ⇒ Object
Free-form payload attached to the event.
-
#description ⇒ Object
Free-text description of the event.
-
#do_not_forward ⇒ Object
When ‘true`, the event is recorded but not delivered to any forwarder, and no delivery log entries are created for it.
-
#environment ⇒ Object
The environment the event occurred in.
-
#event_type ⇒ Object
What happened, e.g.
-
#idempotency_key ⇒ Object
The idempotency key used to deduplicate the record.
-
#occurred_at ⇒ Object
When the event actually happened.
-
#resource_id ⇒ Object
Identifier of the specific resource the event is about.
-
#resource_type ⇒ Object
Kind of resource the event is about, e.g.
-
#severity ⇒ Object
One of ‘TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Event
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Event
Initializes the object
156 157 158 159 160 161 162 163 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 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 156 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::Event` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::Event`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] else self.event_type = nil end if attributes.key?(:'resource_type') self.resource_type = attributes[:'resource_type'] else self.resource_type = nil end if attributes.key?(:'resource_id') self.resource_id = attributes[:'resource_id'] else self.resource_id = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'severity') self.severity = attributes[:'severity'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'occurred_at') self.occurred_at = attributes[:'occurred_at'] end if attributes.key?(:'actor_type') self.actor_type = attributes[:'actor_type'] end if attributes.key?(:'actor_id') self.actor_id = attributes[:'actor_id'] end if attributes.key?(:'actor_label') self.actor_label = attributes[:'actor_label'] end if attributes.key?(:'data') if (value = attributes[:'data']).is_a?(Hash) self.data = value end end if attributes.key?(:'do_not_forward') self.do_not_forward = attributes[:'do_not_forward'] else self.do_not_forward = false end if attributes.key?(:'environment') self.environment = attributes[:'environment'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'idempotency_key') self.idempotency_key = attributes[:'idempotency_key'] end end |
Instance Attribute Details
#actor_id ⇒ Object
Identifier of the actor that caused the event. Free-form string — any identifier scheme is accepted.
44 45 46 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 44 def actor_id @actor_id end |
#actor_label ⇒ Object
Human-readable label for the actor (e.g. an email address or API key name) at the time the event was recorded.
47 48 49 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 47 def actor_label @actor_label end |
#actor_type ⇒ Object
Kind of actor that caused the event, e.g. ‘USER`, `API_KEY`, `SYSTEM`, or any other label you choose. Free-form string; the API does not constrain or interpret it.
41 42 43 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 41 def actor_type @actor_type end |
#category ⇒ Object
Free-form bucket label, e.g. ‘auth`, `billing`, `config-change`. Stored exactly as supplied. Drives the `filter` filter and the `GET /api/v1/categories` discovery endpoint.
35 36 37 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 35 def category @category end |
#created_at ⇒ Object
When the event was received and recorded.
59 60 61 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 59 def created_at @created_at end |
#data ⇒ Object
Free-form payload attached to the event. Use it for resource snapshots (by convention under ‘data.snapshot`), request identifiers, or any other context the event needs to carry.
50 51 52 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 50 def data @data end |
#description ⇒ Object
Free-text description of the event. Included alongside ‘resource_id` in the `filter` substring target.
29 30 31 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 29 def description @description end |
#do_not_forward ⇒ Object
When ‘true`, the event is recorded but not delivered to any forwarder, and no delivery log entries are created for it.
53 54 55 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 53 def do_not_forward @do_not_forward end |
#environment ⇒ Object
The environment the event occurred in. Always present on read. Resolved when the event is recorded — from a single-environment credential, or the ‘X-Smplkit-Environment` header for multi-environment credentials — and never set on the request body. The same content recorded in two environments produces two distinct events.
56 57 58 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 56 def environment @environment end |
#event_type ⇒ Object
What happened, e.g. ‘user.created`. Any non-empty string.
20 21 22 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 20 def event_type @event_type end |
#idempotency_key ⇒ Object
The idempotency key used to deduplicate the record. Echoes the ‘Idempotency-Key` header if one was supplied, otherwise a key derived from the event’s content.
62 63 64 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 62 def idempotency_key @idempotency_key end |
#occurred_at ⇒ Object
When the event actually happened. Defaults to the server receipt time (‘created_at`).
38 39 40 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 38 def occurred_at @occurred_at end |
#resource_id ⇒ Object
Identifier of the specific resource the event is about.
26 27 28 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 26 def resource_id @resource_id end |
#resource_type ⇒ Object
Kind of resource the event is about, e.g. ‘user`. Any non-empty string.
23 24 25 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 23 def resource_type @resource_type end |
#severity ⇒ Object
One of ‘TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`. Omit to record the event at `INFO`. Always present on read.
32 33 34 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 32 def severity @severity end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
108 109 110 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 108 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
113 114 115 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 113 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 87 def self.attribute_map { :'event_type' => :'event_type', :'resource_type' => :'resource_type', :'resource_id' => :'resource_id', :'description' => :'description', :'severity' => :'severity', :'category' => :'category', :'occurred_at' => :'occurred_at', :'actor_type' => :'actor_type', :'actor_id' => :'actor_id', :'actor_label' => :'actor_label', :'data' => :'data', :'do_not_forward' => :'do_not_forward', :'environment' => :'environment', :'created_at' => :'created_at', :'idempotency_key' => :'idempotency_key' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 365 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 139 def self.openapi_nullable Set.new([ :'description', :'severity', :'category', :'occurred_at', :'actor_type', :'actor_id', :'actor_label', :'environment', :'created_at', :'idempotency_key' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 118 def self.openapi_types { :'event_type' => :'String', :'resource_type' => :'String', :'resource_id' => :'String', :'description' => :'String', :'severity' => :'Severity', :'category' => :'String', :'occurred_at' => :'Time', :'actor_type' => :'String', :'actor_id' => :'String', :'actor_label' => :'String', :'data' => :'Hash<String, Object>', :'do_not_forward' => :'Boolean', :'environment' => :'String', :'created_at' => :'Time', :'idempotency_key' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 330 def ==(o) return true if self.equal?(o) self.class == o.class && event_type == o.event_type && resource_type == o.resource_type && resource_id == o.resource_id && description == o.description && severity == o.severity && category == o.category && occurred_at == o.occurred_at && actor_type == o.actor_type && actor_id == o.actor_id && actor_label == o.actor_label && data == o.data && do_not_forward == o.do_not_forward && environment == o.environment && created_at == o.created_at && idempotency_key == o.idempotency_key end |
#eql?(o) ⇒ Boolean
352 353 354 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 352 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
358 359 360 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 358 def hash [event_type, resource_type, resource_id, description, severity, category, occurred_at, actor_type, actor_id, actor_label, data, do_not_forward, environment, created_at, idempotency_key].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 243 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @event_type.nil? invalid_properties.push('invalid value for "event_type", event_type cannot be nil.') end if @event_type.to_s.length < 1 invalid_properties.push('invalid value for "event_type", the character length must be greater than or equal to 1.') end if @resource_type.nil? invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.') end if @resource_type.to_s.length < 1 invalid_properties.push('invalid value for "resource_type", the character length must be greater than or equal to 1.') end if @resource_id.nil? invalid_properties.push('invalid value for "resource_id", resource_id cannot be nil.') end if @resource_id.to_s.length < 1 invalid_properties.push('invalid value for "resource_id", the character length must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 387 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
275 276 277 278 279 280 281 282 283 284 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 275 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @event_type.nil? return false if @event_type.to_s.length < 1 return false if @resource_type.nil? return false if @resource_type.to_s.length < 1 return false if @resource_id.nil? return false if @resource_id.to_s.length < 1 true end |