smplkit 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85fc65604b1b3374714d8834023aa65f658f08d275b484f05ab7bb4a3105f6ba
|
|
4
|
+
data.tar.gz: 72fad8395cc96a5e21b0501d888fd735060da7f7a8c0ca71f6a047b1d371cea5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69264993f3f28149eeda7d424ce52559360e5e17a9e32f1db661f6e140fa1afec14b860bd914e8cc42d2d16bc63dd0a9eba65a22a1748afaa33d5b20cef9b807
|
|
7
|
+
data.tar.gz: 64ecdaa7dbab15ebe416b5af127b4a694a412eae6d8a25d0f55a741bd0caef45d375a769557f323e62eb911dac4940e6c7a29eda29d8d82b178de4662c3af1a9
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module SmplkitGeneratedClient::Audit
|
|
17
|
-
# Public-facing event resource. Attribute set on POST /api/v1/events: - action (required) - resource_type (required) - resource_id (required) - occurred_at (optional; defaults to ``created_at``) -
|
|
17
|
+
# Public-facing event resource. Attribute set on POST /api/v1/events: - action (required) - resource_type (required) - resource_id (required) - occurred_at (optional; defaults to ``created_at``) - data (optional; defaults to ``{}``) There is no top-level ``snapshot`` attribute. Customers wishing to record a resource snapshot place it inside ``data`` -- smplkit's internal convention nests it at ``data.snapshot``, but customers may follow their own convention. Attribute set on GET responses includes everything above plus the server-populated fields: ``created_at``, ``actor_type``, ``actor_id``, ``actor_label``, ``idempotency_key``.
|
|
18
18
|
class Event < ApiModelBase
|
|
19
19
|
attr_accessor :action
|
|
20
20
|
|
|
@@ -24,8 +24,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
24
24
|
|
|
25
25
|
attr_accessor :occurred_at
|
|
26
26
|
|
|
27
|
-
attr_accessor :snapshot
|
|
28
|
-
|
|
29
27
|
attr_accessor :data
|
|
30
28
|
|
|
31
29
|
# When true, this event is recorded normally but is not forwarded to any configured SIEM forwarder. A forwarder_delivery row with status=skipped_do_not_forward is recorded for each enabled forwarder so the skip is visible in the delivery log.
|
|
@@ -48,7 +46,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
48
46
|
:'resource_type' => :'resource_type',
|
|
49
47
|
:'resource_id' => :'resource_id',
|
|
50
48
|
:'occurred_at' => :'occurred_at',
|
|
51
|
-
:'snapshot' => :'snapshot',
|
|
52
49
|
:'data' => :'data',
|
|
53
50
|
:'do_not_forward' => :'do_not_forward',
|
|
54
51
|
:'created_at' => :'created_at',
|
|
@@ -76,7 +73,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
76
73
|
:'resource_type' => :'String',
|
|
77
74
|
:'resource_id' => :'String',
|
|
78
75
|
:'occurred_at' => :'Time',
|
|
79
|
-
:'snapshot' => :'Hash<String, Object>',
|
|
80
76
|
:'data' => :'Hash<String, Object>',
|
|
81
77
|
:'do_not_forward' => :'Boolean',
|
|
82
78
|
:'created_at' => :'Time',
|
|
@@ -91,7 +87,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
91
87
|
def self.openapi_nullable
|
|
92
88
|
Set.new([
|
|
93
89
|
:'occurred_at',
|
|
94
|
-
:'snapshot',
|
|
95
90
|
:'created_at',
|
|
96
91
|
:'actor_type',
|
|
97
92
|
:'actor_id',
|
|
@@ -138,12 +133,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
138
133
|
self.occurred_at = attributes[:'occurred_at']
|
|
139
134
|
end
|
|
140
135
|
|
|
141
|
-
if attributes.key?(:'snapshot')
|
|
142
|
-
if (value = attributes[:'snapshot']).is_a?(Hash)
|
|
143
|
-
self.snapshot = value
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
136
|
if attributes.key?(:'data')
|
|
148
137
|
if (value = attributes[:'data']).is_a?(Hash)
|
|
149
138
|
self.data = value
|
|
@@ -273,7 +262,6 @@ module SmplkitGeneratedClient::Audit
|
|
|
273
262
|
resource_type == o.resource_type &&
|
|
274
263
|
resource_id == o.resource_id &&
|
|
275
264
|
occurred_at == o.occurred_at &&
|
|
276
|
-
snapshot == o.snapshot &&
|
|
277
265
|
data == o.data &&
|
|
278
266
|
do_not_forward == o.do_not_forward &&
|
|
279
267
|
created_at == o.created_at &&
|
|
@@ -292,7 +280,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
292
280
|
# Calculates hash code according to all attributes.
|
|
293
281
|
# @return [Integer] Hash code
|
|
294
282
|
def hash
|
|
295
|
-
[action, resource_type, resource_id, occurred_at,
|
|
283
|
+
[action, resource_type, resource_id, occurred_at, data, do_not_forward, created_at, actor_type, actor_id, actor_label, idempotency_key].hash
|
|
296
284
|
end
|
|
297
285
|
|
|
298
286
|
# Builds the object from hash
|
|
@@ -51,12 +51,6 @@ describe SmplkitGeneratedClient::Audit::Event do
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
describe 'test attribute "snapshot"' do
|
|
55
|
-
it 'should work' do
|
|
56
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
54
|
describe 'test attribute "data"' do
|
|
61
55
|
it 'should work' do
|
|
62
56
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
data/lib/smplkit/audit/events.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Smplkit
|
|
|
19
19
|
# with +smpl.+ are rejected by the server with a 403 (the buffer
|
|
20
20
|
# logs and drops permanent failures).
|
|
21
21
|
def record(action:, resource_type:, resource_id:,
|
|
22
|
-
occurred_at: nil,
|
|
22
|
+
occurred_at: nil, data: nil, idempotency_key: nil,
|
|
23
23
|
do_not_forward: false)
|
|
24
24
|
raise ArgumentError, "action is required" if action.nil? || action.to_s.empty?
|
|
25
25
|
raise ArgumentError, "resource_type is required" if resource_type.nil? || resource_type.to_s.empty?
|
|
@@ -45,7 +45,6 @@ module Smplkit
|
|
|
45
45
|
resource_type: resource_type,
|
|
46
46
|
resource_id: resource_id,
|
|
47
47
|
occurred_at: normalized_occurred_at,
|
|
48
|
-
snapshot: snapshot,
|
|
49
48
|
data: data || {},
|
|
50
49
|
do_not_forward: do_not_forward
|
|
51
50
|
)
|
|
@@ -119,7 +118,7 @@ module Smplkit
|
|
|
119
118
|
:id, :action, :resource_type, :resource_id,
|
|
120
119
|
:occurred_at, :created_at,
|
|
121
120
|
:actor_type, :actor_id, :actor_label,
|
|
122
|
-
:
|
|
121
|
+
:data, :idempotency_key, :do_not_forward,
|
|
123
122
|
keyword_init: true
|
|
124
123
|
) do
|
|
125
124
|
def self.from_resource(resource)
|
|
@@ -134,7 +133,6 @@ module Smplkit
|
|
|
134
133
|
actor_type: attrs.actor_type,
|
|
135
134
|
actor_id: attrs.actor_id,
|
|
136
135
|
actor_label: attrs.actor_label,
|
|
137
|
-
snapshot: attrs.snapshot,
|
|
138
136
|
data: attrs.data || {},
|
|
139
137
|
idempotency_key: attrs.idempotency_key,
|
|
140
138
|
do_not_forward: attrs.do_not_forward || false
|