smplkit 3.0.17 → 3.0.19

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: 2266728c6a9809fd424e1ef3bfaf55aecc001b22e4fdf1847d1e550c52b4a50e
4
- data.tar.gz: 928ab9e89ea2dca1548eb82a06aa8d9b525f874026437bb6b862b4cdc254a4c9
3
+ metadata.gz: 8dc0e8067c66c43e659ad29aff4756448763e90c251e300d598762a7aad1130b
4
+ data.tar.gz: 0a658e3773fcb670b7891c6fc5b18ffeea16780a3195c8e0aa866132e2018fe9
5
5
  SHA512:
6
- metadata.gz: 5df7bda61e6e5b0388d56a8171f642113da0491243d4ee443dd3d6ae516b0fbfb02875d6541d66a756710aba38bd4c078729b923329551320adde5cc14fa4c56
7
- data.tar.gz: d028dd314e06e87fc6185f80695ba0c4bdf21b5d77d548c62e32bc2c4138590f7566c327cc83946191c26e233be9b0d923d1ba0d3d6fb59f835f91ca9f6f3bfa
6
+ metadata.gz: 6f1ef7cc9470990ee57fbe8587fff5f4a0ac5f9ab2199186b4f585fbe8dfc8dc9efd74acc8787f3c4a3fab4b9acc4c2860118e6f5b91c4934f8684d0c8d88f7f
7
+ data.tar.gz: 9c8cf307db3e470c047b518aeb079b558d7c19f1687293e1103d1570104fc2c2bfde6f2591f090a94bf46cc3b438123d38e7caa7db2f7b1a923aad91b096e4c5
@@ -14,11 +14,14 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Audit
17
- # A destination that receives audit events recorded for the account. Each event recorded for the account is evaluated against every enabled forwarder. If the filter expression evaluates truthy — or is absent — the event is delivered to the destination using the configured HTTP request. The slug, derived from `name` at create time, is the stable identifier used by the console and other tooling.
17
+ # A destination that receives audit events recorded for the account. Each event recorded for the account is evaluated against every enabled forwarder. If the filter expression evaluates truthy — or is absent — the event is shaped by the configured transform and delivered to the destination defined by ``configuration``.
18
18
  class Forwarder < ApiModelBase
19
19
  # Human-readable name for the forwarder.
20
20
  attr_accessor :name
21
21
 
22
+ # Free-text description for the forwarder.
23
+ attr_accessor :description
24
+
22
25
  # Destination type.
23
26
  attr_accessor :forwarder_type
24
27
 
@@ -28,14 +31,14 @@ module SmplkitGeneratedClient::Audit
28
31
  # JSON Logic expression evaluated against each event. The event is delivered only if the expression returns truthy. Omit to deliver every event.
29
32
  attr_accessor :filter
30
33
 
31
- # JSONata template applied to each event before delivery. Omit to deliver the event unchanged.
32
- attr_accessor :transform
34
+ # Engine used to evaluate ``transform``. Must be set whenever ``transform`` is set. Today only `JSONATA` is supported.
35
+ attr_accessor :transform_type
33
36
 
34
- # HTTP request used to deliver each event to the destination.
35
- attr_accessor :http
37
+ # Template applied to each event before delivery. The shape depends on ``transform_type``: for `JSONATA`, a string containing a JSONata expression. Omit to deliver the event JSON unchanged.
38
+ attr_accessor :transform
36
39
 
37
- # URL-safe identifier derived from `name` at create time. Stable for the lifetime of the forwarder.
38
- attr_accessor :slug
40
+ # Transport-specific delivery configuration. Shape is discriminated by ``forwarder_type``; today all destination types use ``HttpConfiguration``.
41
+ attr_accessor :configuration
39
42
 
40
43
  # When the forwarder was created.
41
44
  attr_accessor :created_at
@@ -75,12 +78,13 @@ module SmplkitGeneratedClient::Audit
75
78
  def self.attribute_map
76
79
  {
77
80
  :'name' => :'name',
81
+ :'description' => :'description',
78
82
  :'forwarder_type' => :'forwarder_type',
79
83
  :'enabled' => :'enabled',
80
84
  :'filter' => :'filter',
85
+ :'transform_type' => :'transform_type',
81
86
  :'transform' => :'transform',
82
- :'http' => :'http',
83
- :'slug' => :'slug',
87
+ :'configuration' => :'configuration',
84
88
  :'created_at' => :'created_at',
85
89
  :'updated_at' => :'updated_at',
86
90
  :'deleted_at' => :'deleted_at',
@@ -102,12 +106,13 @@ module SmplkitGeneratedClient::Audit
102
106
  def self.openapi_types
103
107
  {
104
108
  :'name' => :'String',
109
+ :'description' => :'String',
105
110
  :'forwarder_type' => :'ForwarderType',
106
111
  :'enabled' => :'Boolean',
107
112
  :'filter' => :'Hash<String, Object>',
108
- :'transform' => :'String',
109
- :'http' => :'ForwarderHttp',
110
- :'slug' => :'String',
113
+ :'transform_type' => :'String',
114
+ :'transform' => :'Object',
115
+ :'configuration' => :'HttpConfiguration',
111
116
  :'created_at' => :'Time',
112
117
  :'updated_at' => :'Time',
113
118
  :'deleted_at' => :'Time',
@@ -118,9 +123,10 @@ module SmplkitGeneratedClient::Audit
118
123
  # List of attributes with nullable: true
119
124
  def self.openapi_nullable
120
125
  Set.new([
126
+ :'description',
121
127
  :'filter',
128
+ :'transform_type',
122
129
  :'transform',
123
- :'slug',
124
130
  :'created_at',
125
131
  :'updated_at',
126
132
  :'deleted_at',
@@ -150,6 +156,10 @@ module SmplkitGeneratedClient::Audit
150
156
  self.name = nil
151
157
  end
152
158
 
159
+ if attributes.key?(:'description')
160
+ self.description = attributes[:'description']
161
+ end
162
+
153
163
  if attributes.key?(:'forwarder_type')
154
164
  self.forwarder_type = attributes[:'forwarder_type']
155
165
  else
@@ -168,18 +178,18 @@ module SmplkitGeneratedClient::Audit
168
178
  end
169
179
  end
170
180
 
181
+ if attributes.key?(:'transform_type')
182
+ self.transform_type = attributes[:'transform_type']
183
+ end
184
+
171
185
  if attributes.key?(:'transform')
172
186
  self.transform = attributes[:'transform']
173
187
  end
174
188
 
175
- if attributes.key?(:'http')
176
- self.http = attributes[:'http']
189
+ if attributes.key?(:'configuration')
190
+ self.configuration = attributes[:'configuration']
177
191
  else
178
- self.http = nil
179
- end
180
-
181
- if attributes.key?(:'slug')
182
- self.slug = attributes[:'slug']
192
+ self.configuration = nil
183
193
  end
184
194
 
185
195
  if attributes.key?(:'created_at')
@@ -216,16 +226,16 @@ module SmplkitGeneratedClient::Audit
216
226
  invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
217
227
  end
218
228
 
219
- if @forwarder_type.nil?
220
- invalid_properties.push('invalid value for "forwarder_type", forwarder_type cannot be nil.')
229
+ if !@description.nil? && @description.to_s.length > 2000
230
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
221
231
  end
222
232
 
223
- if !@transform.nil? && @transform.to_s.length > 16384
224
- invalid_properties.push('invalid value for "transform", the character length must be smaller than or equal to 16384.')
233
+ if @forwarder_type.nil?
234
+ invalid_properties.push('invalid value for "forwarder_type", forwarder_type cannot be nil.')
225
235
  end
226
236
 
227
- if @http.nil?
228
- invalid_properties.push('invalid value for "http", http cannot be nil.')
237
+ if @configuration.nil?
238
+ invalid_properties.push('invalid value for "configuration", configuration cannot be nil.')
229
239
  end
230
240
 
231
241
  invalid_properties
@@ -238,9 +248,11 @@ module SmplkitGeneratedClient::Audit
238
248
  return false if @name.nil?
239
249
  return false if @name.to_s.length > 200
240
250
  return false if @name.to_s.length < 1
251
+ return false if !@description.nil? && @description.to_s.length > 2000
241
252
  return false if @forwarder_type.nil?
242
- return false if !@transform.nil? && @transform.to_s.length > 16384
243
- return false if @http.nil?
253
+ transform_type_validator = EnumAttributeValidator.new('String', ["JSONATA"])
254
+ return false unless transform_type_validator.valid?(@transform_type)
255
+ return false if @configuration.nil?
244
256
  true
245
257
  end
246
258
 
@@ -262,6 +274,16 @@ module SmplkitGeneratedClient::Audit
262
274
  @name = name
263
275
  end
264
276
 
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] description Value to be assigned
279
+ def description=(description)
280
+ if !description.nil? && description.to_s.length > 2000
281
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
282
+ end
283
+
284
+ @description = description
285
+ end
286
+
265
287
  # Custom attribute writer method with validation
266
288
  # @param [Object] forwarder_type Value to be assigned
267
289
  def forwarder_type=(forwarder_type)
@@ -272,24 +294,24 @@ module SmplkitGeneratedClient::Audit
272
294
  @forwarder_type = forwarder_type
273
295
  end
274
296
 
275
- # Custom attribute writer method with validation
276
- # @param [Object] transform Value to be assigned
277
- def transform=(transform)
278
- if !transform.nil? && transform.to_s.length > 16384
279
- fail ArgumentError, 'invalid value for "transform", the character length must be smaller than or equal to 16384.'
297
+ # Custom attribute writer method checking allowed values (enum).
298
+ # @param [Object] transform_type Object to be assigned
299
+ def transform_type=(transform_type)
300
+ validator = EnumAttributeValidator.new('String', ["JSONATA"])
301
+ unless validator.valid?(transform_type)
302
+ fail ArgumentError, "invalid value for \"transform_type\", must be one of #{validator.allowable_values}."
280
303
  end
281
-
282
- @transform = transform
304
+ @transform_type = transform_type
283
305
  end
284
306
 
285
307
  # Custom attribute writer method with validation
286
- # @param [Object] http Value to be assigned
287
- def http=(http)
288
- if http.nil?
289
- fail ArgumentError, 'http cannot be nil'
308
+ # @param [Object] configuration Value to be assigned
309
+ def configuration=(configuration)
310
+ if configuration.nil?
311
+ fail ArgumentError, 'configuration cannot be nil'
290
312
  end
291
313
 
292
- @http = http
314
+ @configuration = configuration
293
315
  end
294
316
 
295
317
  # Checks equality by comparing each attribute.
@@ -298,12 +320,13 @@ module SmplkitGeneratedClient::Audit
298
320
  return true if self.equal?(o)
299
321
  self.class == o.class &&
300
322
  name == o.name &&
323
+ description == o.description &&
301
324
  forwarder_type == o.forwarder_type &&
302
325
  enabled == o.enabled &&
303
326
  filter == o.filter &&
327
+ transform_type == o.transform_type &&
304
328
  transform == o.transform &&
305
- http == o.http &&
306
- slug == o.slug &&
329
+ configuration == o.configuration &&
307
330
  created_at == o.created_at &&
308
331
  updated_at == o.updated_at &&
309
332
  deleted_at == o.deleted_at &&
@@ -319,7 +342,7 @@ module SmplkitGeneratedClient::Audit
319
342
  # Calculates hash code according to all attributes.
320
343
  # @return [Integer] Hash code
321
344
  def hash
322
- [name, forwarder_type, enabled, filter, transform, http, slug, created_at, updated_at, deleted_at, version].hash
345
+ [name, description, forwarder_type, enabled, filter, transform_type, transform, configuration, created_at, updated_at, deleted_at, version].hash
323
346
  end
324
347
 
325
348
  # Builds the object from hash
@@ -14,8 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Audit
17
- # HTTP request configuration used to deliver an event to the destination.
18
- class ForwarderHttp < ApiModelBase
17
+ # HTTP request configuration used to deliver an event to the destination. Used when the parent forwarder's ``forwarder_type`` is one of the HTTP-family destinations (``HTTP``, ``DATADOG``, ``SPLUNK_HEC``, ``SUMO_LOGIC``, ``NEW_RELIC``, ``HONEYCOMB``, ``ELASTIC``). When other transports land (``FTP``, ``SQS``, …) their own configuration schemas will join this one as members of a discriminated union under the ``configuration`` field of ``Forwarder``.
18
+ class HttpConfiguration < ApiModelBase
19
19
  # HTTP method used when delivering an event.
20
20
  attr_accessor :method
21
21
 
@@ -25,9 +25,6 @@ module SmplkitGeneratedClient::Audit
25
25
  # HTTP headers attached to each delivery request.
26
26
  attr_accessor :headers
27
27
 
28
- # Request body sent to the destination. If omitted, the event JSON is sent as the body.
29
- attr_accessor :body
30
-
31
28
  # HTTP response status that indicates a successful delivery. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
32
29
  attr_accessor :success_status
33
30
 
@@ -59,7 +56,6 @@ module SmplkitGeneratedClient::Audit
59
56
  :'method' => :'method',
60
57
  :'url' => :'url',
61
58
  :'headers' => :'headers',
62
- :'body' => :'body',
63
59
  :'success_status' => :'success_status'
64
60
  }
65
61
  end
@@ -80,7 +76,6 @@ module SmplkitGeneratedClient::Audit
80
76
  :'method' => :'String',
81
77
  :'url' => :'String',
82
78
  :'headers' => :'Array<HttpHeader>',
83
- :'body' => :'String',
84
79
  :'success_status' => :'String'
85
80
  }
86
81
  end
@@ -88,7 +83,6 @@ module SmplkitGeneratedClient::Audit
88
83
  # List of attributes with nullable: true
89
84
  def self.openapi_nullable
90
85
  Set.new([
91
- :'body',
92
86
  ])
93
87
  end
94
88
 
@@ -96,14 +90,14 @@ module SmplkitGeneratedClient::Audit
96
90
  # @param [Hash] attributes Model attributes in the form of hash
97
91
  def initialize(attributes = {})
98
92
  if (!attributes.is_a?(Hash))
99
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::ForwarderHttp` initialize method"
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::HttpConfiguration` initialize method"
100
94
  end
101
95
 
102
96
  # check to see if the attribute exists and convert string to symbol for hash key
103
97
  acceptable_attribute_map = self.class.acceptable_attribute_map
104
98
  attributes = attributes.each_with_object({}) { |(k, v), h|
105
99
  if (!acceptable_attribute_map.key?(k.to_sym))
106
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::ForwarderHttp`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::HttpConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
107
101
  end
108
102
  h[k.to_sym] = v
109
103
  }
@@ -126,10 +120,6 @@ module SmplkitGeneratedClient::Audit
126
120
  end
127
121
  end
128
122
 
129
- if attributes.key?(:'body')
130
- self.body = attributes[:'body']
131
- end
132
-
133
123
  if attributes.key?(:'success_status')
134
124
  self.success_status = attributes[:'success_status']
135
125
  else
@@ -154,10 +144,6 @@ module SmplkitGeneratedClient::Audit
154
144
  invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.')
155
145
  end
156
146
 
157
- if !@body.nil? && @body.to_s.length > 65536
158
- invalid_properties.push('invalid value for "body", the character length must be smaller than or equal to 65536.')
159
- end
160
-
161
147
  if !@success_status.nil? && @success_status.to_s.length > 3
162
148
  invalid_properties.push('invalid value for "success_status", the character length must be smaller than or equal to 3.')
163
149
  end
@@ -174,7 +160,6 @@ module SmplkitGeneratedClient::Audit
174
160
  return false if @url.nil?
175
161
  return false if @url.to_s.length > 2048
176
162
  return false if @url.to_s.length < 1
177
- return false if !@body.nil? && @body.to_s.length > 65536
178
163
  return false if !@success_status.nil? && @success_status.to_s.length > 3
179
164
  true
180
165
  end
@@ -207,16 +192,6 @@ module SmplkitGeneratedClient::Audit
207
192
  @url = url
208
193
  end
209
194
 
210
- # Custom attribute writer method with validation
211
- # @param [Object] body Value to be assigned
212
- def body=(body)
213
- if !body.nil? && body.to_s.length > 65536
214
- fail ArgumentError, 'invalid value for "body", the character length must be smaller than or equal to 65536.'
215
- end
216
-
217
- @body = body
218
- end
219
-
220
195
  # Custom attribute writer method with validation
221
196
  # @param [Object] success_status Value to be assigned
222
197
  def success_status=(success_status)
@@ -239,7 +214,6 @@ module SmplkitGeneratedClient::Audit
239
214
  method == o.method &&
240
215
  url == o.url &&
241
216
  headers == o.headers &&
242
- body == o.body &&
243
217
  success_status == o.success_status
244
218
  end
245
219
 
@@ -252,7 +226,7 @@ module SmplkitGeneratedClient::Audit
252
226
  # Calculates hash code according to all attributes.
253
227
  # @return [Integer] Hash code
254
228
  def hash
255
- [method, url, headers, body, success_status].hash
229
+ [method, url, headers, success_status].hash
256
230
  end
257
231
 
258
232
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Audit
17
- # A single HTTP header attached to a forwarder delivery request.
17
+ # A single HTTP header attached to a forwarder delivery request. Header values carrying secrets (API keys, bearer tokens, HEC tokens) are encrypted at the application layer before persistence; the wire representation here is always plaintext.
18
18
  class HttpHeader < ApiModelBase
19
19
  # Header name.
20
20
  attr_accessor :name
@@ -25,9 +25,6 @@ module SmplkitGeneratedClient::Audit
25
25
  # HTTP headers attached to the test request.
26
26
  attr_accessor :headers
27
27
 
28
- # Request body. If omitted, an empty body is sent.
29
- attr_accessor :body
30
-
31
28
  # HTTP response status that indicates success. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
32
29
  attr_accessor :success_status
33
30
 
@@ -62,7 +59,6 @@ module SmplkitGeneratedClient::Audit
62
59
  :'method' => :'method',
63
60
  :'url' => :'url',
64
61
  :'headers' => :'headers',
65
- :'body' => :'body',
66
62
  :'success_status' => :'success_status',
67
63
  :'timeout_ms' => :'timeout_ms'
68
64
  }
@@ -84,7 +80,6 @@ module SmplkitGeneratedClient::Audit
84
80
  :'method' => :'String',
85
81
  :'url' => :'String',
86
82
  :'headers' => :'Array<HttpHeader>',
87
- :'body' => :'String',
88
83
  :'success_status' => :'String',
89
84
  :'timeout_ms' => :'Integer'
90
85
  }
@@ -93,7 +88,6 @@ module SmplkitGeneratedClient::Audit
93
88
  # List of attributes with nullable: true
94
89
  def self.openapi_nullable
95
90
  Set.new([
96
- :'body',
97
91
  :'timeout_ms'
98
92
  ])
99
93
  end
@@ -132,10 +126,6 @@ module SmplkitGeneratedClient::Audit
132
126
  end
133
127
  end
134
128
 
135
- if attributes.key?(:'body')
136
- self.body = attributes[:'body']
137
- end
138
-
139
129
  if attributes.key?(:'success_status')
140
130
  self.success_status = attributes[:'success_status']
141
131
  else
@@ -164,10 +154,6 @@ module SmplkitGeneratedClient::Audit
164
154
  invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.')
165
155
  end
166
156
 
167
- if !@body.nil? && @body.to_s.length > 65536
168
- invalid_properties.push('invalid value for "body", the character length must be smaller than or equal to 65536.')
169
- end
170
-
171
157
  if !@success_status.nil? && @success_status.to_s.length > 3
172
158
  invalid_properties.push('invalid value for "success_status", the character length must be smaller than or equal to 3.')
173
159
  end
@@ -192,7 +178,6 @@ module SmplkitGeneratedClient::Audit
192
178
  return false if @url.nil?
193
179
  return false if @url.to_s.length > 2048
194
180
  return false if @url.to_s.length < 1
195
- return false if !@body.nil? && @body.to_s.length > 65536
196
181
  return false if !@success_status.nil? && @success_status.to_s.length > 3
197
182
  return false if !@timeout_ms.nil? && @timeout_ms > 30000
198
183
  return false if !@timeout_ms.nil? && @timeout_ms < 1
@@ -227,16 +212,6 @@ module SmplkitGeneratedClient::Audit
227
212
  @url = url
228
213
  end
229
214
 
230
- # Custom attribute writer method with validation
231
- # @param [Object] body Value to be assigned
232
- def body=(body)
233
- if !body.nil? && body.to_s.length > 65536
234
- fail ArgumentError, 'invalid value for "body", the character length must be smaller than or equal to 65536.'
235
- end
236
-
237
- @body = body
238
- end
239
-
240
215
  # Custom attribute writer method with validation
241
216
  # @param [Object] success_status Value to be assigned
242
217
  def success_status=(success_status)
@@ -273,7 +248,6 @@ module SmplkitGeneratedClient::Audit
273
248
  method == o.method &&
274
249
  url == o.url &&
275
250
  headers == o.headers &&
276
- body == o.body &&
277
251
  success_status == o.success_status &&
278
252
  timeout_ms == o.timeout_ms
279
253
  end
@@ -287,7 +261,7 @@ module SmplkitGeneratedClient::Audit
287
261
  # Calculates hash code according to all attributes.
288
262
  # @return [Integer] Hash code
289
263
  def hash
290
- [method, url, headers, body, success_status, timeout_ms].hash
264
+ [method, url, headers, success_status, timeout_ms].hash
291
265
  end
292
266
 
293
267
  # Builds the object from hash
@@ -35,12 +35,12 @@ require 'smplkit_audit_client/models/forwarder_delivery_list_meta'
35
35
  require 'smplkit_audit_client/models/forwarder_delivery_list_response'
36
36
  require 'smplkit_audit_client/models/forwarder_delivery_resource'
37
37
  require 'smplkit_audit_client/models/forwarder_delivery_response'
38
- require 'smplkit_audit_client/models/forwarder_http'
39
38
  require 'smplkit_audit_client/models/forwarder_list_response'
40
39
  require 'smplkit_audit_client/models/forwarder_request'
41
40
  require 'smplkit_audit_client/models/forwarder_resource'
42
41
  require 'smplkit_audit_client/models/forwarder_response'
43
42
  require 'smplkit_audit_client/models/forwarder_type'
43
+ require 'smplkit_audit_client/models/http_configuration'
44
44
  require 'smplkit_audit_client/models/http_header'
45
45
  require 'smplkit_audit_client/models/list_meta'
46
46
  require 'smplkit_audit_client/models/pagination_meta'
@@ -33,6 +33,12 @@ describe SmplkitGeneratedClient::Audit::Forwarder do
33
33
  end
34
34
  end
35
35
 
36
+ describe 'test attribute "description"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
36
42
  describe 'test attribute "forwarder_type"' do
37
43
  it 'should work' do
38
44
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -51,19 +57,23 @@ describe SmplkitGeneratedClient::Audit::Forwarder do
51
57
  end
52
58
  end
53
59
 
54
- describe 'test attribute "transform"' do
60
+ describe 'test attribute "transform_type"' do
55
61
  it 'should work' do
56
62
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
63
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["JSONATA"])
64
+ # validator.allowable_values.each do |value|
65
+ # expect { instance.transform_type = value }.not_to raise_error
66
+ # end
57
67
  end
58
68
  end
59
69
 
60
- describe 'test attribute "http"' do
70
+ describe 'test attribute "transform"' do
61
71
  it 'should work' do
62
72
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
63
73
  end
64
74
  end
65
75
 
66
- describe 'test attribute "slug"' do
76
+ describe 'test attribute "configuration"' do
67
77
  it 'should work' do
68
78
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
69
79
  end
@@ -14,16 +14,16 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for SmplkitGeneratedClient::Audit::ForwarderHttp
17
+ # Unit tests for SmplkitGeneratedClient::Audit::HttpConfiguration
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe SmplkitGeneratedClient::Audit::ForwarderHttp do
21
- #let(:instance) { SmplkitGeneratedClient::Audit::ForwarderHttp.new }
20
+ describe SmplkitGeneratedClient::Audit::HttpConfiguration do
21
+ #let(:instance) { SmplkitGeneratedClient::Audit::HttpConfiguration.new }
22
22
 
23
- describe 'test an instance of ForwarderHttp' do
24
- it 'should create an instance of ForwarderHttp' do
23
+ describe 'test an instance of HttpConfiguration' do
24
+ it 'should create an instance of HttpConfiguration' do
25
25
  # uncomment below to test the instance creation
26
- #expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::ForwarderHttp)
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::HttpConfiguration)
27
27
  end
28
28
  end
29
29
 
@@ -49,12 +49,6 @@ describe SmplkitGeneratedClient::Audit::ForwarderHttp do
49
49
  end
50
50
  end
51
51
 
52
- describe 'test attribute "body"' do
53
- it 'should work' do
54
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
55
- end
56
- end
57
-
58
52
  describe 'test attribute "success_status"' do
59
53
  it 'should work' do
60
54
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -49,12 +49,6 @@ describe SmplkitGeneratedClient::Audit::TestForwarderRequest do
49
49
  end
50
50
  end
51
51
 
52
- describe 'test attribute "body"' do
53
- it 'should work' do
54
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
55
- end
56
- end
57
-
58
52
  describe 'test attribute "success_status"' do
59
53
  it 'should work' do
60
54
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -142,14 +142,14 @@ module Smplkit
142
142
 
143
143
  # rubocop:disable Lint/StructNewOverride -- ``:method`` matches the
144
144
  # API attribute and shadowing Struct#method is the expected ergonomics.
145
- ForwarderHttp = Struct.new(:method, :url, :headers, :body, :success_status, keyword_init: true) do
146
- def initialize(method: "POST", url: "", headers: nil, body: nil, success_status: "2xx")
147
- super(method: method, url: url, headers: headers || [], body: body, success_status: success_status)
145
+ HttpConfiguration = Struct.new(:method, :url, :headers, :success_status, keyword_init: true) do
146
+ def initialize(method: "POST", url: "", headers: nil, success_status: "2xx")
147
+ super(method: method, url: url, headers: headers || [], success_status: success_status)
148
148
  end
149
149
 
150
150
  def self.to_wire(src)
151
151
  h = src.is_a?(Hash) ? new(**src) : src
152
- SmplkitGeneratedClient::Audit::ForwarderHttp.new(
152
+ SmplkitGeneratedClient::Audit::HttpConfiguration.new(
153
153
  method: h.method,
154
154
  url: h.url,
155
155
  headers: (h.headers || []).map do |hdr|
@@ -161,7 +161,6 @@ module Smplkit
161
161
  end
162
162
  SmplkitGeneratedClient::Audit::HttpHeader.new(name: name, value: value)
163
163
  end,
164
- body: h.body,
165
164
  success_status: h.success_status
166
165
  )
167
166
  end
@@ -173,7 +172,6 @@ module Smplkit
173
172
  method: src.method || "POST",
174
173
  url: src.url || "",
175
174
  headers: (src.headers || []).map { |h| HttpHeader.new(name: h.name, value: h.value) },
176
- body: src.body,
177
175
  success_status: src.success_status || "2xx"
178
176
  )
179
177
  end
@@ -183,8 +181,8 @@ module Smplkit
183
181
  # rubocop:disable Lint/StructNewOverride -- ``:filter`` matches the
184
182
  # API attribute and shadowing Struct#filter is the expected ergonomics.
185
183
  Forwarder = Struct.new(
186
- :id, :name, :slug, :forwarder_type, :enabled,
187
- :filter, :transform, :http,
184
+ :id, :name, :description, :forwarder_type, :enabled,
185
+ :filter, :transform_type, :transform, :configuration,
188
186
  :created_at, :updated_at, :deleted_at, :version,
189
187
  keyword_init: true
190
188
  ) do
@@ -193,12 +191,13 @@ module Smplkit
193
191
  new(
194
192
  id: resource.id,
195
193
  name: a.name,
196
- slug: a.slug,
194
+ description: a.description,
197
195
  forwarder_type: a.forwarder_type,
198
196
  enabled: a.enabled.nil? || a.enabled,
199
197
  filter: a.filter.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.filter),
198
+ transform_type: a.transform_type,
200
199
  transform: a.transform,
201
- http: ForwarderHttp.from_wire(a.http),
200
+ configuration: HttpConfiguration.from_wire(a.configuration),
202
201
  created_at: a.created_at,
203
202
  updated_at: a.updated_at,
204
203
  deleted_at: a.deleted_at,
@@ -14,6 +14,17 @@ module Smplkit
14
14
  # and the SDK walks the chain (env override → base → group chain →
15
15
  # dot-notation ancestry) to compute each managed logger's effective
16
16
  # level. See {Smplkit::Logging::Resolution}.
17
+ #
18
+ # Change-listener contract — every call the SDK makes to
19
+ # +adapter.apply_level(logger_id, new_level)+ is paired with exactly one
20
+ # listener notification for that logger, and every notification
21
+ # corresponds to exactly one adapter apply. A trigger that moves N
22
+ # loggers' effective levels invokes the global listener N times (once
23
+ # per logger), each invocation also fires every matching key-scoped
24
+ # listener for that id. There are no batch / summary events and no
25
+ # deletion-flavored events — logger / group deletions only emit
26
+ # listener invocations for *dependents* whose computed effective level
27
+ # actually moved; the deleted key itself emits nothing.
17
28
  class LoggingClient
18
29
  def initialize(parent, manage:, metrics:, logging_base_url:, app_base_url:)
19
30
  @parent = parent
@@ -30,18 +41,16 @@ module Smplkit
30
41
  # We keep originals so adapter.apply_level receives whatever the
31
42
  # framework's registry indexes by.
32
43
  @name_map = {}
33
- # normalized_id → resolution-cache entry. Populated by
34
- # +_fetch_and_apply+ and mutated by the +logger_changed+ /
35
- # +logger_deleted+ WS handlers.
44
+ # normalized_id → resolution-cache entry.
36
45
  @loggers_cache = {}
37
46
  # group id → resolution-cache entry. Without this, any managed
38
47
  # logger with +level=null+ that inherits from a group silently
39
48
  # keeps whatever level its adapter had at startup.
40
49
  @groups_cache = {}
41
- # normalized_id → resolved level (string). Used to decide whether
42
- # to fire change listeners on a re-resolution — a group-driven
43
- # change isn't visible in the raw +loggers_cache+ but moves the
44
- # resolved value.
50
+ # normalized_id → last-applied resolved level (string). Drives the
51
+ # lockstep between adapter.apply_level and listener notifications:
52
+ # we only push (and fire) when the freshly-resolved level differs
53
+ # from what's recorded here.
45
54
  @resolved_levels = {}
46
55
  end
47
56
 
@@ -62,7 +71,7 @@ module Smplkit
62
71
  end
63
72
 
64
73
  flush_initial_registration
65
- fetch_and_apply(trigger: "install")
74
+ fetch_and_apply(trigger: "install", source: "manual")
66
75
 
67
76
  @ws_manager = @parent._ensure_ws
68
77
  @ws_manager.on("logger_changed") { |data| handle_logger_changed(data) }
@@ -101,9 +110,9 @@ module Smplkit
101
110
  end
102
111
 
103
112
  # Re-fetch all loggers and groups and re-apply resolved levels. Fires
104
- # change listeners for any logger whose resolved level moved.
113
+ # listeners only for loggers whose effective level moved.
105
114
  def refresh
106
- fetch_and_apply(trigger: "refresh")
115
+ fetch_and_apply(trigger: "refresh", source: "manual")
107
116
  end
108
117
 
109
118
  def on_change(name = nil, &block)
@@ -164,27 +173,25 @@ module Smplkit
164
173
  end
165
174
 
166
175
  # Full re-fetch of loggers + groups, then apply resolved levels.
167
- # Fires change listeners for any logger whose resolved level moved.
168
- def fetch_and_apply(trigger:)
176
+ def fetch_and_apply(trigger:, source: "websocket")
169
177
  Smplkit.debug("resolution", "full resolution pass starting (trigger: #{trigger})")
170
178
  loggers = @manage.loggers.list_logger_entries
171
179
  groups = @manage.log_groups.list_group_entries
172
180
  @loggers_cache = loggers
173
181
  @groups_cache = groups
174
- apply_levels(source: "websocket")
182
+ apply_levels(source: source)
175
183
  rescue StandardError => e
176
184
  Smplkit.debug("resolution", "fetch_and_apply failed (trigger: #{trigger}): #{e.class}: #{e.message}")
177
185
  end
178
186
 
179
- # Resolve the effective level for every locally-known managed logger
180
- # and push it to every adapter. Returns the list of normalized ids
181
- # whose resolved level changed.
182
- #
183
- # +source+ is the +LoggerChangeEvent#source+ for any change-listener
184
- # event we fire. The default reflects callers that arrived through a
185
- # server event (WebSocket).
187
+ # Apply newly-resolved levels in lockstep with listener
188
+ # notifications. For every locally-tracked managed logger whose
189
+ # freshly-computed effective level differs from the last applied
190
+ # value: push to adapters, then fire each global + matching
191
+ # key-scoped listener. No adapter push happens without a paired
192
+ # listener notification, and no notification fires without a
193
+ # paired adapter push.
186
194
  def apply_levels(source: "websocket")
187
- changed = []
188
195
  @name_map.each do |raw_name, normalized_id|
189
196
  entry = @loggers_cache[normalized_id]
190
197
  next if entry.nil?
@@ -193,16 +200,14 @@ module Smplkit
193
200
  resolved_string = Resolution.resolve_level(
194
201
  normalized_id, @parent._environment, @loggers_cache, @groups_cache
195
202
  )
203
+ previous = @resolved_levels[normalized_id]
204
+ next if previous == resolved_string
205
+
196
206
  coerced = LogLevel.coerce(resolved_string)
207
+ @resolved_levels[normalized_id] = resolved_string
197
208
  push_to_adapters(raw_name, coerced)
198
- previous = @resolved_levels[normalized_id]
199
- if previous != resolved_string
200
- @resolved_levels[normalized_id] = resolved_string
201
- changed << [normalized_id, coerced]
202
- end
209
+ fire_change_event(normalized_id, coerced, source: source)
203
210
  end
204
- fire_resolved_change_events(changed, source: source)
205
- changed
206
211
  end
207
212
 
208
213
  def push_to_adapters(raw_name, coerced_level)
@@ -213,14 +218,12 @@ module Smplkit
213
218
  end
214
219
  end
215
220
 
216
- def fire_resolved_change_events(changed, source:)
217
- changed.each do |(normalized_id, coerced_level)|
218
- event = LoggerChangeEvent.new(name: normalized_id, level: coerced_level, source: source)
219
- (@global_listeners + @key_listeners[normalized_id]).each do |cb|
220
- cb.call(event)
221
- rescue StandardError => e
222
- Smplkit.debug("logging", "listener raised: #{e.class}: #{e.message}")
223
- end
221
+ def fire_change_event(normalized_id, level, source:)
222
+ event = LoggerChangeEvent.new(name: normalized_id, level: level, source: source)
223
+ (@global_listeners + @key_listeners[normalized_id]).each do |cb|
224
+ cb.call(event)
225
+ rescue StandardError => e
226
+ Smplkit.debug("logging", "listener raised: #{e.class}: #{e.message}")
224
227
  end
225
228
  end
226
229
 
@@ -240,17 +243,16 @@ module Smplkit
240
243
  apply_levels(source: "websocket")
241
244
  end
242
245
 
246
+ # Deletion is a pure cache eviction. The deleted key itself fires
247
+ # nothing; dependents whose effective level moves fire through the
248
+ # normal apply path.
243
249
  def handle_logger_deleted(data)
244
250
  key = data["id"] || data["name"] || ""
245
251
  normalized = Normalize.normalize_logger_name(key)
246
252
  return if normalized.empty?
247
253
 
248
- existed = @loggers_cache.delete(normalized)
249
- @resolved_levels.delete(normalized)
250
- return unless existed
251
-
254
+ @loggers_cache.delete(normalized)
252
255
  apply_levels(source: "websocket")
253
- fire_deletion_event(normalized)
254
256
  end
255
257
 
256
258
  def handle_group_changed(data)
@@ -272,36 +274,19 @@ module Smplkit
272
274
  key = data["id"] || data["key"] || ""
273
275
  return if key.to_s.empty?
274
276
 
275
- existed = @groups_cache.delete(key)
276
- return unless existed
277
-
277
+ @groups_cache.delete(key)
278
278
  apply_levels(source: "websocket")
279
- fire_deletion_event(key)
280
279
  end
281
280
 
282
281
  def handle_loggers_changed(_data)
283
282
  fetch_and_apply(trigger: "loggers_changed WS event")
284
283
  end
285
-
286
- def fire_deletion_event(key)
287
- event = LoggerChangeEvent.new(name: key, level: nil, source: "websocket", deleted: true)
288
- (@global_listeners + @key_listeners[key]).each do |cb|
289
- cb.call(event)
290
- rescue StandardError => e
291
- Smplkit.debug("logging", "listener raised: #{e.class}: #{e.message}")
292
- end
293
- end
294
284
  end
295
285
 
296
- LoggerChangeEvent = Struct.new(:name, :level, :source, :deleted, keyword_init: true) do
297
- def initialize(name:, level:, source:, deleted: false)
298
- super
299
- end
300
-
286
+ LoggerChangeEvent = Struct.new(:name, :level, :source, keyword_init: true) do
301
287
  def ==(other)
302
288
  other.is_a?(LoggerChangeEvent) &&
303
- name == other.name && level == other.level &&
304
- source == other.source && deleted == other.deleted
289
+ name == other.name && level == other.level && source == other.source
305
290
  end
306
291
  end
307
292
  end
@@ -26,25 +26,30 @@ module Smplkit
26
26
 
27
27
  # Create a forwarder.
28
28
  #
29
- # @param name [String] Display name. The slug is derived
30
- # server-side.
29
+ # @param name [String] Display name.
31
30
  # @param forwarder_type [String, Smplkit::Audit::ForwarderType]
32
31
  # One of the published {Smplkit::Audit::ForwarderType} constants
33
32
  # (or the equivalent string).
34
- # @param http [Smplkit::Audit::ForwarderHttp, Hash] Destination
35
- # configuration. Headers carry credentials and are encrypted at
36
- # rest server-side; reads return them redacted.
33
+ # @param configuration [Smplkit::Audit::HttpConfiguration, Hash]
34
+ # Transport-specific delivery configuration. Today every
35
+ # forwarder_type uses {HttpConfiguration}; the URL and header
36
+ # values inside are stored encrypted server-side and round-trip
37
+ # to GET in plaintext.
38
+ # @param description [String, nil] Optional free-text description.
37
39
  # @param enabled [Boolean] Whether the forwarder is active.
38
40
  # @param filter [Hash, nil] Optional JSON Logic filter; events
39
41
  # that don't match are recorded as +filtered_out+ deliveries.
40
- # @param transform [String, nil] Optional JSONata template
41
- # applied to the event payload before POST. Nil/empty sends the
42
- # event as-is.
43
- def create(name:, forwarder_type:, http:, enabled: true,
44
- filter: nil, transform: nil)
42
+ # @param transform_type [String, nil] Engine that evaluates
43
+ # +transform+. Set to +"JSONATA"+ whenever +transform+ is set.
44
+ # @param transform [String, nil] Optional template applied to the
45
+ # event payload before delivery (for +JSONATA+, a JSONata
46
+ # expression). Nil sends the event JSON unchanged.
47
+ def create(name:, forwarder_type:, configuration:, description: nil, enabled: true,
48
+ filter: nil, transform_type: nil, transform: nil)
45
49
  body = build_body(nil, name: name, forwarder_type: forwarder_type,
46
- http: http, enabled: enabled,
47
- filter: filter, transform: transform)
50
+ configuration: configuration, description: description,
51
+ enabled: enabled, filter: filter,
52
+ transform_type: transform_type, transform: transform)
48
53
  resp = Smplkit::Audit.call_api { @api.create_forwarder(body) }
49
54
  Smplkit::Audit::Forwarder.from_resource(resp.data)
50
55
  end
@@ -69,15 +74,15 @@ module Smplkit
69
74
 
70
75
  # Full-replace update. PUT semantics — every field is overwritten.
71
76
  #
72
- # Header values must be re-supplied as plaintext; the GET path
73
- # redacts them, so a PUT body containing +"<redacted>"+ would
74
- # persist that literal. Track real header values client-side and
75
- # round-trip them on update.
76
- def update(forwarder_id, name:, forwarder_type:, http:, enabled: true,
77
- filter: nil, transform: nil)
77
+ # The URL and header values inside +configuration+ are returned in
78
+ # plaintext on GET, so a fetched forwarder can be round-tripped to
79
+ # PUT without re-entering secrets.
80
+ def update(forwarder_id, name:, forwarder_type:, configuration:, description: nil,
81
+ enabled: true, filter: nil, transform_type: nil, transform: nil)
78
82
  body = build_body(forwarder_id, name: name, forwarder_type: forwarder_type,
79
- http: http, enabled: enabled,
80
- filter: filter, transform: transform)
83
+ configuration: configuration, description: description,
84
+ enabled: enabled, filter: filter,
85
+ transform_type: transform_type, transform: transform)
81
86
  resp = Smplkit::Audit.call_api { @api.update_forwarder(forwarder_id, body) }
82
87
  Smplkit::Audit::Forwarder.from_resource(resp.data)
83
88
  end
@@ -89,14 +94,17 @@ module Smplkit
89
94
 
90
95
  private
91
96
 
92
- def build_body(id, name:, forwarder_type:, http:, enabled:, filter:, transform:)
97
+ def build_body(id, name:, forwarder_type:, configuration:, description:, enabled:,
98
+ filter:, transform_type:, transform:)
93
99
  attrs = SmplkitGeneratedClient::Audit::Forwarder.new(
94
100
  name: name,
101
+ description: description,
95
102
  forwarder_type: Smplkit::Audit::ForwarderType.coerce(forwarder_type),
96
103
  enabled: enabled,
97
- http: Smplkit::Audit::ForwarderHttp.to_wire(http),
98
104
  filter: filter,
99
- transform: transform
105
+ transform_type: transform_type,
106
+ transform: transform,
107
+ configuration: Smplkit::Audit::HttpConfiguration.to_wire(configuration)
100
108
  )
101
109
  resource = SmplkitGeneratedClient::Audit::ForwarderResource.new(
102
110
  id: id ? id.to_s : "",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.17
4
+ version: 3.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -445,12 +445,12 @@ files:
445
445
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_list_response.rb
446
446
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_resource.rb
447
447
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_response.rb
448
- - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_http.rb
449
448
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_list_response.rb
450
449
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_request.rb
451
450
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_resource.rb
452
451
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_response.rb
453
452
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_type.rb
453
+ - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/http_configuration.rb
454
454
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/http_header.rb
455
455
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/list_meta.rb
456
456
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/pagination_meta.rb
@@ -485,13 +485,13 @@ files:
485
485
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_resource_spec.rb
486
486
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_response_spec.rb
487
487
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_spec.rb
488
- - lib/smplkit/_generated/audit/spec/models/forwarder_http_spec.rb
489
488
  - lib/smplkit/_generated/audit/spec/models/forwarder_list_response_spec.rb
490
489
  - lib/smplkit/_generated/audit/spec/models/forwarder_request_spec.rb
491
490
  - lib/smplkit/_generated/audit/spec/models/forwarder_resource_spec.rb
492
491
  - lib/smplkit/_generated/audit/spec/models/forwarder_response_spec.rb
493
492
  - lib/smplkit/_generated/audit/spec/models/forwarder_spec.rb
494
493
  - lib/smplkit/_generated/audit/spec/models/forwarder_type_spec.rb
494
+ - lib/smplkit/_generated/audit/spec/models/http_configuration_spec.rb
495
495
  - lib/smplkit/_generated/audit/spec/models/http_header_spec.rb
496
496
  - lib/smplkit/_generated/audit/spec/models/list_meta_spec.rb
497
497
  - lib/smplkit/_generated/audit/spec/models/pagination_meta_spec.rb