Class: Smplkit::Audit::AuditEvent
- Inherits:
-
Struct
- Object
- Struct
- Smplkit::Audit::AuditEvent
- Defined in:
- lib/smplkit/audit/models.rb
Overview
A single audit event as returned by the audit service (ADR-047 §2.3.1).
Instance Attribute Summary collapse
-
#actor_id ⇒ String?
Customer-supplied free-form actor identifier —
nilwhen not provided. -
#actor_label ⇒ String?
Customer-supplied display label for the actor — typically a name or email.
-
#actor_type ⇒ String?
Customer-supplied free-form actor type string —
nilwhen not provided. -
#created_at ⇒ String
ISO-8601 timestamp of when the audit service first ingested this event.
-
#data ⇒ Hash{String => Object}
Free-form per-event payload defined by the customer.
-
#do_not_forward ⇒ Boolean
When
true, skip SIEM forwarder delivery regardless of any matching filter. -
#event_type ⇒ String
Event type slug — e.g.
-
#id ⇒ String
Server-assigned UUID for this event.
-
#idempotency_key ⇒ String?
Customer-supplied dedupe key,
nilif not provided. -
#occurred_at ⇒ String
ISO-8601 timestamp of when the event happened, as reported by the source.
-
#resource_id ⇒ String
Customer-facing id of the resource the event operated on.
-
#resource_type ⇒ String
Type of resource the event operated on — e.g.
Class Method Summary collapse
Instance Attribute Details
#actor_id ⇒ String?
Returns Customer-supplied free-form actor identifier — nil when not provided.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#actor_label ⇒ String?
Returns Customer-supplied display label for the actor — typically a name or email.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#actor_type ⇒ String?
Returns Customer-supplied free-form actor type string — nil when not provided.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#created_at ⇒ String
Returns ISO-8601 timestamp of when the audit service first ingested this event.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#data ⇒ Hash{String => Object}
Returns Free-form per-event payload defined by the customer.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#do_not_forward ⇒ Boolean
Returns When true, skip SIEM forwarder delivery regardless of any matching filter.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#event_type ⇒ String
Returns Event type slug — e.g. “user.created”, “invoice.paid”.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#id ⇒ String
Returns Server-assigned UUID for this event.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#idempotency_key ⇒ String?
Returns Customer-supplied dedupe key, nil if not provided.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#occurred_at ⇒ String
Returns ISO-8601 timestamp of when the event happened, as reported by the source.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#resource_id ⇒ String
Returns Customer-facing id of the resource the event operated on.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
#resource_type ⇒ String
Returns Type of resource the event operated on — e.g. “invoice”.
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 |
# File 'lib/smplkit/audit/models.rb', line 168 AuditEvent = Struct.new( :id, :event_type, :resource_type, :resource_id, :occurred_at, :created_at, :actor_type, :actor_id, :actor_label, :data, :idempotency_key, :do_not_forward, keyword_init: true ) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end end |
Class Method Details
.from_resource(resource) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/smplkit/audit/models.rb', line 175 def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, event_type: attrs.event_type, resource_type: attrs.resource_type, resource_id: attrs.resource_id, occurred_at: attrs.occurred_at, created_at: attrs.created_at, actor_type: attrs.actor_type, actor_id: attrs.actor_id, actor_label: attrs.actor_label, data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}), idempotency_key: attrs.idempotency_key, do_not_forward: attrs.do_not_forward || false ) end |