smplkit 3.0.88 → 3.0.89

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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/categories_api.rb +2 -2
  3. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/event_types_api.rb +2 -2
  4. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/events_api.rb +6 -6
  5. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/forwarders_api.rb +14 -17
  6. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/resource_types_api.rb +2 -2
  7. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb +12 -1
  8. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb +16 -4
  9. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery.rb +28 -1
  10. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_environment.rb +162 -0
  11. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client.rb +1 -0
  12. data/lib/smplkit/_generated/audit/spec/api/categories_api_spec.rb +1 -1
  13. data/lib/smplkit/_generated/audit/spec/api/event_types_api_spec.rb +1 -1
  14. data/lib/smplkit/_generated/audit/spec/api/events_api_spec.rb +3 -3
  15. data/lib/smplkit/_generated/audit/spec/api/forwarders_api_spec.rb +7 -8
  16. data/lib/smplkit/_generated/audit/spec/api/resource_types_api_spec.rb +1 -1
  17. data/lib/smplkit/_generated/audit/spec/models/event_spec.rb +6 -0
  18. data/lib/smplkit/_generated/audit/spec/models/forwarder_delivery_spec.rb +6 -0
  19. data/lib/smplkit/_generated/audit/spec/models/forwarder_environment_spec.rb +42 -0
  20. data/lib/smplkit/_generated/audit/spec/models/forwarder_spec.rb +6 -0
  21. data/lib/smplkit/audit/client.rb +9 -1
  22. data/lib/smplkit/audit/models.rb +70 -6
  23. data/lib/smplkit/client.rb +1 -1
  24. data/lib/smplkit/management/audit.rb +49 -6
  25. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b4904b7847b08b27d2961a2d2627969f2e50b3e1905fe0fc4867def1d09332e
4
- data.tar.gz: 5facbd70792ef873500e8ab13282c9384d4f29beb2f1aff156464f0f4fdc0309
3
+ metadata.gz: e74796a149f8cbc251ba882ad41437fc2abfb444ec41c1ddc1a016b747b44239
4
+ data.tar.gz: 40b5cf412aeee85051340f68aac8c6a125e387ee6d7e116c7e8733e3901fdbff
5
5
  SHA512:
6
- metadata.gz: 8ade3b3e53ad9b226de37b24d31bc392f1d37d8bc1626e3fa9ff74a5eca98b1e67714d0c9197c6430b3c577d3bc38071c5af9eec9d6e3363a2a2a6e7da554753
7
- data.tar.gz: a681e7271d381e91949ed83a918db7c7178b8c3d260fef73fe74f243f949dc49f751a9f1fa8f5558cef005d661e2bcf6a7fff31946e13a98d22a4d7a05c1959f
6
+ metadata.gz: 62168449fd8f785be652fb7ca29d0ba277677600c48005ddae7e1e388e668abaeb319bfbd3749a5ed0fc09650d5422c42dfa1e16c0e1cbdcddd562103f00ba12
7
+ data.tar.gz: b9d53e62c4b73514a7e5ce03baa56d22e81049979bd7b445f9b572753dc60e667e4291a92960c4fec7723ace99d6b64672dfaf0d536c01f93c1003260e977bae
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
20
20
  @api_client = api_client
21
21
  end
22
22
  # List Categories
23
- # List the distinct `category` values recorded for this account. The resource `id` is the category value itself. Default sort is `key` ascending; pass `sort=-key` for descending. Useful for populating filter dropdowns in a UI.
23
+ # List the distinct `category` values recorded for this account. The resource `id` is the category value itself. Default sort is `key` ascending; pass `sort=-key` for descending. Scoped to the resolved environment. Useful for populating filter dropdowns in a UI.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `key`. Allowed values: `key`, `-key`. (default to 'key')
26
26
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
@@ -33,7 +33,7 @@ module SmplkitGeneratedClient::Audit
33
33
  end
34
34
 
35
35
  # List Categories
36
- # List the distinct `category` values recorded for this account. The resource `id` is the category value itself. Default sort is `key` ascending; pass `sort=-key` for descending. Useful for populating filter dropdowns in a UI.
36
+ # List the distinct `category` values recorded for this account. The resource `id` is the category value itself. Default sort is `key` ascending; pass `sort=-key` for descending. Scoped to the resolved environment. Useful for populating filter dropdowns in a UI.
37
37
  # @param [Hash] opts the optional parameters
38
38
  # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `key`. Allowed values: `key`, `-key`. (default to 'key')
39
39
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
20
20
  @api_client = api_client
21
21
  end
22
22
  # List Event Types
23
- # List the distinct `event_type` slugs recorded for this account. Default sort is `key` ascending; pass `sort=-key` for descending. Without `filter[resource_type]`, returns one row per distinct event_type. With `filter[resource_type]`, returns the event_types recorded for that specific resource type.
23
+ # List the distinct `event_type` slugs recorded for this account. Default sort is `key` ascending; pass `sort=-key` for descending. Scoped to the resolved environment. Without `filter[resource_type]`, returns one row per distinct event_type. With `filter[resource_type]`, returns the event_types recorded for that specific resource type.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :filter_resource_type
26
26
  # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `key`. Allowed values: `key`, `-key`. (default to 'key')
@@ -34,7 +34,7 @@ module SmplkitGeneratedClient::Audit
34
34
  end
35
35
 
36
36
  # List Event Types
37
- # List the distinct `event_type` slugs recorded for this account. Default sort is `key` ascending; pass `sort=-key` for descending. Without `filter[resource_type]`, returns one row per distinct event_type. With `filter[resource_type]`, returns the event_types recorded for that specific resource type.
37
+ # List the distinct `event_type` slugs recorded for this account. Default sort is `key` ascending; pass `sort=-key` for descending. Scoped to the resolved environment. Without `filter[resource_type]`, returns one row per distinct event_type. With `filter[resource_type]`, returns the event_types recorded for that specific resource type.
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @option opts [String] :filter_resource_type
40
40
  # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `key`. Allowed values: `key`, `-key`. (default to 'key')
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
20
20
  @api_client = api_client
21
21
  end
22
22
  # Get Event
23
- # Retrieve a single audit event by id.
23
+ # Retrieve a single audit event by id. Authorized against the caller's permitted environment set: the event is returned only if its environment is one the caller may access, otherwise `404` (the same response as a non-existent id, so existence never leaks across environments). The `X-Smplkit-Environment` header is ignored here — a single-object lookup names the object by id, it does not resolve an ambient environment.
24
24
  # @param event_id [String]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [EventResponse]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Audit
30
30
  end
31
31
 
32
32
  # Get Event
33
- # Retrieve a single audit event by id.
33
+ # Retrieve a single audit event by id. Authorized against the caller's permitted environment set: the event is returned only if its environment is one the caller may access, otherwise `404` (the same response as a non-existent id, so existence never leaks across environments). The `X-Smplkit-Environment` header is ignored here — a single-object lookup names the object by id, it does not resolve an ambient environment.
34
34
  # @param event_id [String]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(EventResponse, Integer, Hash)>] EventResponse data, response status code and response headers
@@ -194,7 +194,7 @@ module SmplkitGeneratedClient::Audit
194
194
  end
195
195
 
196
196
  # Record Event
197
- # Record an audit event for this account. Returns `201 Created` on first write, `200 OK` if the request was a duplicate (matched by `Idempotency-Key` or a key derived from the event's content). `resource_type` values beginning with `smpl.` are reserved for events that smplkit emits about its own resources and cannot be used here.
197
+ # Record an audit event for this account. The event is stamped with the environment it occurred in: a single-environment credential implies it; a multi-environment or unrestricted credential must send the `X-Smplkit-Environment` header. The resolved environment must exist and be managed for the account. Returns `201 Created` on first write, `200 OK` if the request was a duplicate (matched by `Idempotency-Key` or a key derived from the event's content). The same content recorded in two environments produces two distinct events. `resource_type` values beginning with `smpl.` are reserved for events that smplkit emits about its own resources and cannot be used here.
198
198
  # @param event_request [EventRequest]
199
199
  # @param [Hash] opts the optional parameters
200
200
  # @option opts [String] :idempotency_key
@@ -205,7 +205,7 @@ module SmplkitGeneratedClient::Audit
205
205
  end
206
206
 
207
207
  # Record Event
208
- # Record an audit event for this account. Returns &#x60;201 Created&#x60; on first write, &#x60;200 OK&#x60; if the request was a duplicate (matched by &#x60;Idempotency-Key&#x60; or a key derived from the event&#39;s content). &#x60;resource_type&#x60; values beginning with &#x60;smpl.&#x60; are reserved for events that smplkit emits about its own resources and cannot be used here.
208
+ # Record an audit event for this account. The event is stamped with the environment it occurred in: a single-environment credential implies it; a multi-environment or unrestricted credential must send the &#x60;X-Smplkit-Environment&#x60; header. The resolved environment must exist and be managed for the account. Returns &#x60;201 Created&#x60; on first write, &#x60;200 OK&#x60; if the request was a duplicate (matched by &#x60;Idempotency-Key&#x60; or a key derived from the event&#39;s content). The same content recorded in two environments produces two distinct events. &#x60;resource_type&#x60; values beginning with &#x60;smpl.&#x60; are reserved for events that smplkit emits about its own resources and cannot be used here.
209
209
  # @param event_request [EventRequest]
210
210
  # @param [Hash] opts the optional parameters
211
211
  # @option opts [String] :idempotency_key
@@ -265,7 +265,7 @@ module SmplkitGeneratedClient::Audit
265
265
  end
266
266
 
267
267
  # Search Events
268
- # Search audit events with column filters and an optional JSON Logic expression. Without a JSON Logic `filter`: behaves like `GET /api/v1/events` with the same column filters. With a JSON Logic `filter`: the search is silently capped to the last 30 days by `occurred_at` (intersected with any explicit `filter[occurred_at]` the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same `json-logic-qubit` evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response's `meta.scan` block reports the scan stats so a selective filter doesn't look like \"0 matches\" when the truth is \"ceiling reached.\"
268
+ # Search audit events with column filters and an optional JSON Logic expression. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the `X-Smplkit-Environment` header). Without a JSON Logic `filter`: behaves like `GET /api/v1/events` with the same column filters. With a JSON Logic `filter`: the search is silently capped to the last 30 days by `occurred_at` (intersected with any explicit `filter[occurred_at]` the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same `json-logic-qubit` evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response's `meta.scan` block reports the scan stats so a selective filter doesn't look like \"0 matches\" when the truth is \"ceiling reached.\"
269
269
  # @param event_search_request [EventSearchRequest]
270
270
  # @param [Hash] opts the optional parameters
271
271
  # @return [EventSearchResponse]
@@ -275,7 +275,7 @@ module SmplkitGeneratedClient::Audit
275
275
  end
276
276
 
277
277
  # Search Events
278
- # Search audit events with column filters and an optional JSON Logic expression. Without a JSON Logic &#x60;filter&#x60;: behaves like &#x60;GET /api/v1/events&#x60; with the same column filters. With a JSON Logic &#x60;filter&#x60;: the search is silently capped to the last 30 days by &#x60;occurred_at&#x60; (intersected with any explicit &#x60;filter[occurred_at]&#x60; the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same &#x60;json-logic-qubit&#x60; evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response&#39;s &#x60;meta.scan&#x60; block reports the scan stats so a selective filter doesn&#39;t look like \&quot;0 matches\&quot; when the truth is \&quot;ceiling reached.\&quot;
278
+ # Search audit events with column filters and an optional JSON Logic expression. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the &#x60;X-Smplkit-Environment&#x60; header). Without a JSON Logic &#x60;filter&#x60;: behaves like &#x60;GET /api/v1/events&#x60; with the same column filters. With a JSON Logic &#x60;filter&#x60;: the search is silently capped to the last 30 days by &#x60;occurred_at&#x60; (intersected with any explicit &#x60;filter[occurred_at]&#x60; the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same &#x60;json-logic-qubit&#x60; evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response&#39;s &#x60;meta.scan&#x60; block reports the scan stats so a selective filter doesn&#39;t look like \&quot;0 matches\&quot; when the truth is \&quot;ceiling reached.\&quot;
279
279
  # @param event_search_request [EventSearchRequest]
280
280
  # @param [Hash] opts the optional parameters
281
281
  # @return [Array<(EventSearchResponse, Integer, Hash)>] EventSearchResponse data, response status code and response headers
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
20
20
  @api_client = api_client
21
21
  end
22
22
  # Create Forwarder
23
- # Create a forwarder for this account. The caller supplies the forwarder's key as `data.id`. Keys are unique within an account and immutable for the lifetime of the forwarder.
23
+ # Create a forwarder for this account. The caller supplies the forwarder's key as `data.id`. Keys are unique within an account and immutable for the lifetime of the forwarder. Enablement is per-environment: a forwarder is enabled in an environment only via `environments[<env>].enabled`; the base `enabled` is always false. Every environment referenced in `environments` must exist and be managed for the account.
24
24
  # @param forwarder_create_request [ForwarderCreateRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [ForwarderResponse]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Audit
30
30
  end
31
31
 
32
32
  # Create Forwarder
33
- # Create a forwarder for this account. The caller supplies the forwarder&#39;s key as &#x60;data.id&#x60;. Keys are unique within an account and immutable for the lifetime of the forwarder.
33
+ # Create a forwarder for this account. The caller supplies the forwarder&#39;s key as &#x60;data.id&#x60;. Keys are unique within an account and immutable for the lifetime of the forwarder. Enablement is per-environment: a forwarder is enabled in an environment only via &#x60;environments[&lt;env&gt;].enabled&#x60;; the base &#x60;enabled&#x60; is always false. Every environment referenced in &#x60;environments&#x60; must exist and be managed for the account.
34
34
  # @param forwarder_create_request [ForwarderCreateRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(ForwarderResponse, Integer, Hash)>] ForwarderResponse data, response status code and response headers
@@ -217,7 +217,7 @@ module SmplkitGeneratedClient::Audit
217
217
  end
218
218
 
219
219
  # Get Forwarder
220
- # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with `GET`, mutate, `PUT` without re-entering secrets.
220
+ # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with `GET`, mutate, `PUT` without re-entering secrets. The `environments` override map is scoped to the caller's environment groups.
221
221
  # @param forwarder_id [String]
222
222
  # @param [Hash] opts the optional parameters
223
223
  # @return [ForwarderResponse]
@@ -227,7 +227,7 @@ module SmplkitGeneratedClient::Audit
227
227
  end
228
228
 
229
229
  # Get Forwarder
230
- # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with &#x60;GET&#x60;, mutate, &#x60;PUT&#x60; without re-entering secrets.
230
+ # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with &#x60;GET&#x60;, mutate, &#x60;PUT&#x60; without re-entering secrets. The &#x60;environments&#x60; override map is scoped to the caller&#39;s environment groups.
231
231
  # @param forwarder_id [String]
232
232
  # @param [Hash] opts the optional parameters
233
233
  # @return [Array<(ForwarderResponse, Integer, Hash)>] ForwarderResponse data, response status code and response headers
@@ -280,7 +280,7 @@ module SmplkitGeneratedClient::Audit
280
280
  end
281
281
 
282
282
  # List Forwarder Deliveries
283
- # List delivery log entries for a forwarder. Default sort is `-created_at` (newest first). Filter by `status` (`SUCCEEDED` or `FAILED`, case-insensitive), by `event`, or by a `created_at` range using interval notation (e.g. `[2026-01-01T00:00:00Z,*)`).
283
+ # List delivery log entries for a forwarder. Scoped to the resolved environment — only that environment's deliveries for the forwarder are shown. Default sort is `-created_at` (newest first). Filter by `status` (`SUCCEEDED` or `FAILED`, case-insensitive), by `event`, or by a `created_at` range using interval notation (e.g. `[2026-01-01T00:00:00Z,*)`).
284
284
  # @param forwarder_id [String]
285
285
  # @param [Hash] opts the optional parameters
286
286
  # @option opts [String] :filter_status
@@ -296,7 +296,7 @@ module SmplkitGeneratedClient::Audit
296
296
  end
297
297
 
298
298
  # List Forwarder Deliveries
299
- # List delivery log entries for a forwarder. Default sort is &#x60;-created_at&#x60; (newest first). Filter by &#x60;status&#x60; (&#x60;SUCCEEDED&#x60; or &#x60;FAILED&#x60;, case-insensitive), by &#x60;event&#x60;, or by a &#x60;created_at&#x60; range using interval notation (e.g. &#x60;[2026-01-01T00:00:00Z,*)&#x60;).
299
+ # List delivery log entries for a forwarder. Scoped to the resolved environment — only that environment&#39;s deliveries for the forwarder are shown. Default sort is &#x60;-created_at&#x60; (newest first). Filter by &#x60;status&#x60; (&#x60;SUCCEEDED&#x60; or &#x60;FAILED&#x60;, case-insensitive), by &#x60;event&#x60;, or by a &#x60;created_at&#x60; range using interval notation (e.g. &#x60;[2026-01-01T00:00:00Z,*)&#x60;).
300
300
  # @param forwarder_id [String]
301
301
  # @param [Hash] opts the optional parameters
302
302
  # @option opts [String] :filter_status
@@ -369,10 +369,9 @@ module SmplkitGeneratedClient::Audit
369
369
  end
370
370
 
371
371
  # List Forwarders
372
- # List forwarders for this account. Default sort is `-created_at` (newest first).
372
+ # List forwarders for this account. Default sort is `-created_at` (newest first). Each forwarder's `environments` override map is scoped to the caller's environment groups.
373
373
  # @param [Hash] opts the optional parameters
374
374
  # @option opts [String] :filter_forwarder_type
375
- # @option opts [Boolean] :filter_enabled
376
375
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;-created_at&#x60;. Allowed values: &#x60;created_at&#x60;, &#x60;-created_at&#x60;, &#x60;updated_at&#x60;, &#x60;-updated_at&#x60;. (default to '-created_at')
377
376
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error. (default to 1)
378
377
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to &#x60;1000&#x60; when omitted. Must be between &#x60;1&#x60; and &#x60;1000&#x60; inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
@@ -384,10 +383,9 @@ module SmplkitGeneratedClient::Audit
384
383
  end
385
384
 
386
385
  # List Forwarders
387
- # List forwarders for this account. Default sort is &#x60;-created_at&#x60; (newest first).
386
+ # List forwarders for this account. Default sort is &#x60;-created_at&#x60; (newest first). Each forwarder&#39;s &#x60;environments&#x60; override map is scoped to the caller&#39;s environment groups.
388
387
  # @param [Hash] opts the optional parameters
389
388
  # @option opts [String] :filter_forwarder_type
390
- # @option opts [Boolean] :filter_enabled
391
389
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;-created_at&#x60;. Allowed values: &#x60;created_at&#x60;, &#x60;-created_at&#x60;, &#x60;updated_at&#x60;, &#x60;-updated_at&#x60;. (default to '-created_at')
392
390
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error. (default to 1)
393
391
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to &#x60;1000&#x60; when omitted. Must be between &#x60;1&#x60; and &#x60;1000&#x60; inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
@@ -407,7 +405,6 @@ module SmplkitGeneratedClient::Audit
407
405
  # query parameters
408
406
  query_params = opts[:query_params] || {}
409
407
  query_params[:'filter[forwarder_type]'] = opts[:'filter_forwarder_type'] if !opts[:'filter_forwarder_type'].nil?
410
- query_params[:'filter[enabled]'] = opts[:'filter_enabled'] if !opts[:'filter_enabled'].nil?
411
408
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
412
409
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
413
410
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
@@ -448,7 +445,7 @@ module SmplkitGeneratedClient::Audit
448
445
  end
449
446
 
450
447
  # Retry Failed Forwarder Deliveries
451
- # Retry every failed delivery for this forwarder. Each failed delivery is re-attempted using the forwarder's current configuration and the original event. Returns the counts.
448
+ # Retry every failed delivery for this forwarder in the resolved environment. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the `X-Smplkit-Environment` header): only that environment's failed deliveries are re-attempted, each using the forwarder's effective configuration for that environment and the original event. Returns the counts.
452
449
  # @param forwarder_id [String]
453
450
  # @param [Hash] opts the optional parameters
454
451
  # @return [RetryFailedDeliveriesSummary]
@@ -458,7 +455,7 @@ module SmplkitGeneratedClient::Audit
458
455
  end
459
456
 
460
457
  # Retry Failed Forwarder Deliveries
461
- # Retry every failed delivery for this forwarder. Each failed delivery is re-attempted using the forwarder&#39;s current configuration and the original event. Returns the counts.
458
+ # Retry every failed delivery for this forwarder in the resolved environment. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the &#x60;X-Smplkit-Environment&#x60; header): only that environment&#39;s failed deliveries are re-attempted, each using the forwarder&#39;s effective configuration for that environment and the original event. Returns the counts.
462
459
  # @param forwarder_id [String]
463
460
  # @param [Hash] opts the optional parameters
464
461
  # @return [Array<(RetryFailedDeliveriesSummary, Integer, Hash)>] RetryFailedDeliveriesSummary data, response status code and response headers
@@ -511,7 +508,7 @@ module SmplkitGeneratedClient::Audit
511
508
  end
512
509
 
513
510
  # Retry Forwarder Delivery
514
- # Retry a single failed delivery. Returns the new delivery log entry. The prior entry is left in place.
511
+ # Retry a single failed delivery. The delivery is named by id, so it is authorized against the caller's permitted environment set: a delivery in an environment the caller can't access returns `404` (existence never leaks). Returns the new delivery log entry. The prior entry is left in place.
515
512
  # @param forwarder_id [String]
516
513
  # @param delivery_id [String]
517
514
  # @param [Hash] opts the optional parameters
@@ -522,7 +519,7 @@ module SmplkitGeneratedClient::Audit
522
519
  end
523
520
 
524
521
  # Retry Forwarder Delivery
525
- # Retry a single failed delivery. Returns the new delivery log entry. The prior entry is left in place.
522
+ # Retry a single failed delivery. The delivery is named by id, so it is authorized against the caller&#39;s permitted environment set: a delivery in an environment the caller can&#39;t access returns &#x60;404&#x60; (existence never leaks). Returns the new delivery log entry. The prior entry is left in place.
526
523
  # @param forwarder_id [String]
527
524
  # @param delivery_id [String]
528
525
  # @param [Hash] opts the optional parameters
@@ -580,7 +577,7 @@ module SmplkitGeneratedClient::Audit
580
577
  end
581
578
 
582
579
  # Update Forwarder
583
- # Replace an existing forwarder. Every writable field is overwritten.
580
+ # Replace an existing forwarder. Every writable field is overwritten. The `environments` override map is a full replace for the environments you can manage; overrides for environments outside your access (which were hidden from your read) are preserved. Every environment referenced in `environments` must exist and be managed.
584
581
  # @param forwarder_id [String]
585
582
  # @param forwarder_request [ForwarderRequest]
586
583
  # @param [Hash] opts the optional parameters
@@ -591,7 +588,7 @@ module SmplkitGeneratedClient::Audit
591
588
  end
592
589
 
593
590
  # Update Forwarder
594
- # Replace an existing forwarder. Every writable field is overwritten.
591
+ # Replace an existing forwarder. Every writable field is overwritten. The &#x60;environments&#x60; override map is a full replace for the environments you can manage; overrides for environments outside your access (which were hidden from your read) are preserved. Every environment referenced in &#x60;environments&#x60; must exist and be managed.
595
592
  # @param forwarder_id [String]
596
593
  # @param forwarder_request [ForwarderRequest]
597
594
  # @param [Hash] opts the optional parameters
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
20
20
  @api_client = api_client
21
21
  end
22
22
  # List Resource Types
23
- # List the distinct `resource_type` slugs recorded for this account. The resource `id` is the slug itself. Default sort is `key` ascending; pass `sort=-key` for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resource types visible under the account's current plan.
23
+ # List the distinct `resource_type` slugs recorded for this account. The resource `id` is the slug itself. Default sort is `key` ascending; pass `sort=-key` for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resolved environment and to the resource types visible under the account's current plan.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;key&#x60;. Allowed values: &#x60;key&#x60;, &#x60;-key&#x60;. (default to 'key')
26
26
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error. (default to 1)
@@ -33,7 +33,7 @@ module SmplkitGeneratedClient::Audit
33
33
  end
34
34
 
35
35
  # List Resource Types
36
- # List the distinct &#x60;resource_type&#x60; slugs recorded for this account. The resource &#x60;id&#x60; is the slug itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resource types visible under the account&#39;s current plan.
36
+ # List the distinct &#x60;resource_type&#x60; slugs recorded for this account. The resource &#x60;id&#x60; is the slug itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resolved environment and to the resource types visible under the account&#39;s current plan.
37
37
  # @param [Hash] opts the optional parameters
38
38
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;key&#x60;. Allowed values: &#x60;key&#x60;, &#x60;-key&#x60;. (default to 'key')
39
39
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error. (default to 1)
@@ -52,6 +52,9 @@ module SmplkitGeneratedClient::Audit
52
52
  # When `true`, the event is recorded but not delivered to any forwarder, and no delivery log entries are created for it.
53
53
  attr_accessor :do_not_forward
54
54
 
55
+ # 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
+ attr_accessor :environment
57
+
55
58
  # When the event was received and recorded.
56
59
  attr_accessor :created_at
57
60
 
@@ -95,6 +98,7 @@ module SmplkitGeneratedClient::Audit
95
98
  :'actor_label' => :'actor_label',
96
99
  :'data' => :'data',
97
100
  :'do_not_forward' => :'do_not_forward',
101
+ :'environment' => :'environment',
98
102
  :'created_at' => :'created_at',
99
103
  :'idempotency_key' => :'idempotency_key'
100
104
  }
@@ -125,6 +129,7 @@ module SmplkitGeneratedClient::Audit
125
129
  :'actor_label' => :'String',
126
130
  :'data' => :'Hash<String, Object>',
127
131
  :'do_not_forward' => :'Boolean',
132
+ :'environment' => :'String',
128
133
  :'created_at' => :'Time',
129
134
  :'idempotency_key' => :'String'
130
135
  }
@@ -140,6 +145,7 @@ module SmplkitGeneratedClient::Audit
140
145
  :'actor_type',
141
146
  :'actor_id',
142
147
  :'actor_label',
148
+ :'environment',
143
149
  :'created_at',
144
150
  :'idempotency_key'
145
151
  ])
@@ -219,6 +225,10 @@ module SmplkitGeneratedClient::Audit
219
225
  self.do_not_forward = false
220
226
  end
221
227
 
228
+ if attributes.key?(:'environment')
229
+ self.environment = attributes[:'environment']
230
+ end
231
+
222
232
  if attributes.key?(:'created_at')
223
233
  self.created_at = attributes[:'created_at']
224
234
  end
@@ -332,6 +342,7 @@ module SmplkitGeneratedClient::Audit
332
342
  actor_label == o.actor_label &&
333
343
  data == o.data &&
334
344
  do_not_forward == o.do_not_forward &&
345
+ environment == o.environment &&
335
346
  created_at == o.created_at &&
336
347
  idempotency_key == o.idempotency_key
337
348
  end
@@ -345,7 +356,7 @@ module SmplkitGeneratedClient::Audit
345
356
  # Calculates hash code according to all attributes.
346
357
  # @return [Integer] Hash code
347
358
  def hash
348
- [event_type, resource_type, resource_id, description, severity, category, occurred_at, actor_type, actor_id, actor_label, data, do_not_forward, created_at, idempotency_key].hash
359
+ [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
349
360
  end
350
361
 
351
362
  # Builds the object from hash
@@ -25,7 +25,7 @@ module SmplkitGeneratedClient::Audit
25
25
  # Destination type.
26
26
  attr_accessor :forwarder_type
27
27
 
28
- # Whether the forwarder is currently delivering events. Set to `false` to pause deliveries without deleting the forwarder.
28
+ # Always false. Enablement is per-environment: a forwarder delivers in an environment only when `environments[<env>].enabled` is true. The base value is pinned false and cannot be set.
29
29
  attr_accessor :enabled
30
30
 
31
31
  # JSON Logic expression evaluated against each event. The event is delivered only if the expression returns truthy. Omit to deliver every event.
@@ -37,9 +37,12 @@ module SmplkitGeneratedClient::Audit
37
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
38
  attr_accessor :transform
39
39
 
40
- # Transport-specific delivery configuration. Shape is discriminated by ``forwarder_type``; today all destination types use ``HttpConfiguration``. Branded vendor types (everything except `http`) constrain the configuration against a per-vendor template — see `GET /api/v1/forwarder_types` for the URL pattern, fixed headers, and customer-supplied placeholders for each type.
40
+ # Base delivery configuration template. Shape is discriminated by ``forwarder_type``; today all destination types use ``HttpConfiguration``. Branded vendor types (everything except `http`) constrain the configuration against a per-vendor template — see `GET /api/v1/forwarder_types` for the URL pattern, fixed headers, and customer-supplied placeholders for each type. A per-environment override in `environments` replaces this template for that environment.
41
41
  attr_accessor :configuration
42
42
 
43
+ # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry sets `enabled` (whether the forwarder delivers in that environment) and an optional `configuration` override (omit to inherit the base `configuration`). A forwarder with no entry for an environment is disabled there. Every referenced environment must exist and be managed for the account.
44
+ attr_accessor :environments
45
+
43
46
  # When the forwarder was created.
44
47
  attr_accessor :created_at
45
48
 
@@ -85,6 +88,7 @@ module SmplkitGeneratedClient::Audit
85
88
  :'transform_type' => :'transform_type',
86
89
  :'transform' => :'transform',
87
90
  :'configuration' => :'configuration',
91
+ :'environments' => :'environments',
88
92
  :'created_at' => :'created_at',
89
93
  :'updated_at' => :'updated_at',
90
94
  :'deleted_at' => :'deleted_at',
@@ -113,6 +117,7 @@ module SmplkitGeneratedClient::Audit
113
117
  :'transform_type' => :'String',
114
118
  :'transform' => :'Object',
115
119
  :'configuration' => :'HttpConfiguration',
120
+ :'environments' => :'Hash<String, ForwarderEnvironment>',
116
121
  :'created_at' => :'Time',
117
122
  :'updated_at' => :'Time',
118
123
  :'deleted_at' => :'Time',
@@ -169,7 +174,7 @@ module SmplkitGeneratedClient::Audit
169
174
  if attributes.key?(:'enabled')
170
175
  self.enabled = attributes[:'enabled']
171
176
  else
172
- self.enabled = true
177
+ self.enabled = false
173
178
  end
174
179
 
175
180
  if attributes.key?(:'filter')
@@ -192,6 +197,12 @@ module SmplkitGeneratedClient::Audit
192
197
  self.configuration = nil
193
198
  end
194
199
 
200
+ if attributes.key?(:'environments')
201
+ if (value = attributes[:'environments']).is_a?(Hash)
202
+ self.environments = value
203
+ end
204
+ end
205
+
195
206
  if attributes.key?(:'created_at')
196
207
  self.created_at = attributes[:'created_at']
197
208
  end
@@ -327,6 +338,7 @@ module SmplkitGeneratedClient::Audit
327
338
  transform_type == o.transform_type &&
328
339
  transform == o.transform &&
329
340
  configuration == o.configuration &&
341
+ environments == o.environments &&
330
342
  created_at == o.created_at &&
331
343
  updated_at == o.updated_at &&
332
344
  deleted_at == o.deleted_at &&
@@ -342,7 +354,7 @@ module SmplkitGeneratedClient::Audit
342
354
  # Calculates hash code according to all attributes.
343
355
  # @return [Integer] Hash code
344
356
  def hash
345
- [name, description, forwarder_type, enabled, filter, transform_type, transform, configuration, created_at, updated_at, deleted_at, version].hash
357
+ [name, description, forwarder_type, enabled, filter, transform_type, transform, configuration, environments, created_at, updated_at, deleted_at, version].hash
346
358
  end
347
359
 
348
360
  # Builds the object from hash
@@ -16,6 +16,9 @@ require 'time'
16
16
  module SmplkitGeneratedClient::Audit
17
17
  # A log entry for one attempt to deliver an event to a forwarder.
18
18
  class ForwarderDelivery < ApiModelBase
19
+ # Environment the delivered event occurred in. Deliveries are scoped to one environment.
20
+ attr_accessor :environment
21
+
19
22
  # Forwarder the delivery belongs to.
20
23
  attr_accessor :forwarder
21
24
 
@@ -71,6 +74,7 @@ module SmplkitGeneratedClient::Audit
71
74
  # Attribute mapping from ruby-style variable name to JSON key.
72
75
  def self.attribute_map
73
76
  {
77
+ :'environment' => :'environment',
74
78
  :'forwarder' => :'forwarder',
75
79
  :'event' => :'event',
76
80
  :'attempt_number' => :'attempt_number',
@@ -97,6 +101,7 @@ module SmplkitGeneratedClient::Audit
97
101
  # Attribute type mapping.
98
102
  def self.openapi_types
99
103
  {
104
+ :'environment' => :'String',
100
105
  :'forwarder' => :'String',
101
106
  :'event' => :'String',
102
107
  :'attempt_number' => :'Integer',
@@ -138,6 +143,12 @@ module SmplkitGeneratedClient::Audit
138
143
  h[k.to_sym] = v
139
144
  }
140
145
 
146
+ if attributes.key?(:'environment')
147
+ self.environment = attributes[:'environment']
148
+ else
149
+ self.environment = nil
150
+ end
151
+
141
152
  if attributes.key?(:'forwarder')
142
153
  self.forwarder = attributes[:'forwarder']
143
154
  else
@@ -194,6 +205,10 @@ module SmplkitGeneratedClient::Audit
194
205
  def list_invalid_properties
195
206
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
196
207
  invalid_properties = Array.new
208
+ if @environment.nil?
209
+ invalid_properties.push('invalid value for "environment", environment cannot be nil.')
210
+ end
211
+
197
212
  if @forwarder.nil?
198
213
  invalid_properties.push('invalid value for "forwarder", forwarder cannot be nil.')
199
214
  end
@@ -217,6 +232,7 @@ module SmplkitGeneratedClient::Audit
217
232
  # @return true if the model is valid
218
233
  def valid?
219
234
  warn '[DEPRECATED] the `valid?` method is obsolete'
235
+ return false if @environment.nil?
220
236
  return false if @forwarder.nil?
221
237
  return false if @event.nil?
222
238
  return false if @attempt_number.nil?
@@ -226,6 +242,16 @@ module SmplkitGeneratedClient::Audit
226
242
  true
227
243
  end
228
244
 
245
+ # Custom attribute writer method with validation
246
+ # @param [Object] environment Value to be assigned
247
+ def environment=(environment)
248
+ if environment.nil?
249
+ fail ArgumentError, 'environment cannot be nil'
250
+ end
251
+
252
+ @environment = environment
253
+ end
254
+
229
255
  # Custom attribute writer method with validation
230
256
  # @param [Object] forwarder Value to be assigned
231
257
  def forwarder=(forwarder)
@@ -271,6 +297,7 @@ module SmplkitGeneratedClient::Audit
271
297
  def ==(o)
272
298
  return true if self.equal?(o)
273
299
  self.class == o.class &&
300
+ environment == o.environment &&
274
301
  forwarder == o.forwarder &&
275
302
  event == o.event &&
276
303
  attempt_number == o.attempt_number &&
@@ -292,7 +319,7 @@ module SmplkitGeneratedClient::Audit
292
319
  # Calculates hash code according to all attributes.
293
320
  # @return [Integer] Hash code
294
321
  def hash
295
- [forwarder, event, attempt_number, status, request, response_status, response_body, latency_ms, error, created_at].hash
322
+ [environment, forwarder, event, attempt_number, status, request, response_status, response_body, latency_ms, error, created_at].hash
296
323
  end
297
324
 
298
325
  # Builds the object from hash
@@ -0,0 +1,162 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ # Per-environment override for a forwarder's enablement and configuration.
18
+ class ForwarderEnvironment < ApiModelBase
19
+ # Whether the forwarder delivers events in this environment. A forwarder is enabled in an environment only via this field — the base `enabled` is always false.
20
+ attr_accessor :enabled
21
+
22
+ # Per-environment delivery configuration override. Omit to inherit the forwarder's base `configuration`. When present, it fully replaces the base configuration for this environment and is validated against the same per-vendor template.
23
+ attr_accessor :configuration
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'enabled' => :'enabled',
29
+ :'configuration' => :'configuration'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'enabled' => :'Boolean',
47
+ :'configuration' => :'HttpConfiguration'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'configuration'
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::ForwarderEnvironment` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::ForwarderEnvironment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'enabled')
75
+ self.enabled = attributes[:'enabled']
76
+ else
77
+ self.enabled = false
78
+ end
79
+
80
+ if attributes.key?(:'configuration')
81
+ self.configuration = attributes[:'configuration']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ enabled == o.enabled &&
106
+ configuration == o.configuration
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [enabled, configuration].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ attributes = attributes.transform_keys(&:to_sym)
127
+ transformed_hash = {}
128
+ openapi_types.each_pair do |key, type|
129
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
130
+ transformed_hash["#{key}"] = nil
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[attribute_map[key]].is_a?(Array)
135
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
+ end
137
+ elsif !attributes[attribute_map[key]].nil?
138
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
+ end
140
+ end
141
+ new(transformed_hash)
142
+ end
143
+
144
+ # Returns the object in the form of hash
145
+ # @return [Hash] Returns the object in the form of hash
146
+ def to_hash
147
+ hash = {}
148
+ self.class.attribute_map.each_pair do |attr, param|
149
+ value = self.send(attr)
150
+ if value.nil?
151
+ is_nullable = self.class.openapi_nullable.include?(attr)
152
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
153
+ end
154
+
155
+ hash[param] = _to_hash(value)
156
+ end
157
+ hash
158
+ end
159
+
160
+ end
161
+
162
+ end
@@ -49,6 +49,7 @@ require 'smplkit_audit_client/models/forwarder_delivery_list_meta'
49
49
  require 'smplkit_audit_client/models/forwarder_delivery_list_response'
50
50
  require 'smplkit_audit_client/models/forwarder_delivery_resource'
51
51
  require 'smplkit_audit_client/models/forwarder_delivery_response'
52
+ require 'smplkit_audit_client/models/forwarder_environment'
52
53
  require 'smplkit_audit_client/models/forwarder_list_response'
53
54
  require 'smplkit_audit_client/models/forwarder_request'
54
55
  require 'smplkit_audit_client/models/forwarder_resource'
@@ -34,7 +34,7 @@ describe 'CategoriesApi' do
34
34
 
35
35
  # unit tests for list_categories
36
36
  # List Categories
37
- # List the distinct &#x60;category&#x60; values recorded for this account. The resource &#x60;id&#x60; is the category value itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Useful for populating filter dropdowns in a UI.
37
+ # List the distinct &#x60;category&#x60; values recorded for this account. The resource &#x60;id&#x60; is the category value itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Scoped to the resolved environment. Useful for populating filter dropdowns in a UI.
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;key&#x60;. Allowed values: &#x60;key&#x60;, &#x60;-key&#x60;.
40
40
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error.
@@ -34,7 +34,7 @@ describe 'EventTypesApi' do
34
34
 
35
35
  # unit tests for list_event_types
36
36
  # List Event Types
37
- # List the distinct &#x60;event_type&#x60; slugs recorded for this account. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Without &#x60;filter[resource_type]&#x60;, returns one row per distinct event_type. With &#x60;filter[resource_type]&#x60;, returns the event_types recorded for that specific resource type.
37
+ # List the distinct &#x60;event_type&#x60; slugs recorded for this account. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Scoped to the resolved environment. Without &#x60;filter[resource_type]&#x60;, returns one row per distinct event_type. With &#x60;filter[resource_type]&#x60;, returns the event_types recorded for that specific resource type.
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @option opts [String] :filter_resource_type
40
40
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;key&#x60;. Allowed values: &#x60;key&#x60;, &#x60;-key&#x60;.
@@ -34,7 +34,7 @@ describe 'EventsApi' do
34
34
 
35
35
  # unit tests for get_event
36
36
  # Get Event
37
- # Retrieve a single audit event by id.
37
+ # Retrieve a single audit event by id. Authorized against the caller&#39;s permitted environment set: the event is returned only if its environment is one the caller may access, otherwise &#x60;404&#x60; (the same response as a non-existent id, so existence never leaks across environments). The &#x60;X-Smplkit-Environment&#x60; header is ignored here — a single-object lookup names the object by id, it does not resolve an ambient environment.
38
38
  # @param event_id
39
39
  # @param [Hash] opts the optional parameters
40
40
  # @return [EventResponse]
@@ -71,7 +71,7 @@ describe 'EventsApi' do
71
71
 
72
72
  # unit tests for record_event
73
73
  # Record Event
74
- # Record an audit event for this account. Returns &#x60;201 Created&#x60; on first write, &#x60;200 OK&#x60; if the request was a duplicate (matched by &#x60;Idempotency-Key&#x60; or a key derived from the event&#39;s content). &#x60;resource_type&#x60; values beginning with &#x60;smpl.&#x60; are reserved for events that smplkit emits about its own resources and cannot be used here.
74
+ # Record an audit event for this account. The event is stamped with the environment it occurred in: a single-environment credential implies it; a multi-environment or unrestricted credential must send the &#x60;X-Smplkit-Environment&#x60; header. The resolved environment must exist and be managed for the account. Returns &#x60;201 Created&#x60; on first write, &#x60;200 OK&#x60; if the request was a duplicate (matched by &#x60;Idempotency-Key&#x60; or a key derived from the event&#39;s content). The same content recorded in two environments produces two distinct events. &#x60;resource_type&#x60; values beginning with &#x60;smpl.&#x60; are reserved for events that smplkit emits about its own resources and cannot be used here.
75
75
  # @param event_request
76
76
  # @param [Hash] opts the optional parameters
77
77
  # @option opts [String] :idempotency_key
@@ -84,7 +84,7 @@ describe 'EventsApi' do
84
84
 
85
85
  # unit tests for search_events
86
86
  # Search Events
87
- # Search audit events with column filters and an optional JSON Logic expression. Without a JSON Logic &#x60;filter&#x60;: behaves like &#x60;GET /api/v1/events&#x60; with the same column filters. With a JSON Logic &#x60;filter&#x60;: the search is silently capped to the last 30 days by &#x60;occurred_at&#x60; (intersected with any explicit &#x60;filter[occurred_at]&#x60; the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same &#x60;json-logic-qubit&#x60; evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response&#39;s &#x60;meta.scan&#x60; block reports the scan stats so a selective filter doesn&#39;t look like \&quot;0 matches\&quot; when the truth is \&quot;ceiling reached.\&quot;
87
+ # Search audit events with column filters and an optional JSON Logic expression. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the &#x60;X-Smplkit-Environment&#x60; header). Without a JSON Logic &#x60;filter&#x60;: behaves like &#x60;GET /api/v1/events&#x60; with the same column filters. With a JSON Logic &#x60;filter&#x60;: the search is silently capped to the last 30 days by &#x60;occurred_at&#x60; (intersected with any explicit &#x60;filter[occurred_at]&#x60; the caller supplied), the column filters narrow the candidate set in SQL, and the JSON Logic expression runs in memory against each candidate row using the same &#x60;json-logic-qubit&#x60; evaluator the forwarder pipeline uses. Up to 50,000 rows are scanned per request; the response&#39;s &#x60;meta.scan&#x60; block reports the scan stats so a selective filter doesn&#39;t look like \&quot;0 matches\&quot; when the truth is \&quot;ceiling reached.\&quot;
88
88
  # @param event_search_request
89
89
  # @param [Hash] opts the optional parameters
90
90
  # @return [EventSearchResponse]
@@ -34,7 +34,7 @@ describe 'ForwardersApi' do
34
34
 
35
35
  # unit tests for create_forwarder
36
36
  # Create Forwarder
37
- # Create a forwarder for this account. The caller supplies the forwarder&#39;s key as &#x60;data.id&#x60;. Keys are unique within an account and immutable for the lifetime of the forwarder.
37
+ # Create a forwarder for this account. The caller supplies the forwarder&#39;s key as &#x60;data.id&#x60;. Keys are unique within an account and immutable for the lifetime of the forwarder. Enablement is per-environment: a forwarder is enabled in an environment only via &#x60;environments[&lt;env&gt;].enabled&#x60;; the base &#x60;enabled&#x60; is always false. Every environment referenced in &#x60;environments&#x60; must exist and be managed for the account.
38
38
  # @param forwarder_create_request
39
39
  # @param [Hash] opts the optional parameters
40
40
  # @return [ForwarderResponse]
@@ -70,7 +70,7 @@ describe 'ForwardersApi' do
70
70
 
71
71
  # unit tests for get_forwarder
72
72
  # Get Forwarder
73
- # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with &#x60;GET&#x60;, mutate, &#x60;PUT&#x60; without re-entering secrets.
73
+ # Retrieve a single forwarder by id. Header values are returned in plaintext so the resource can be round-tripped with &#x60;GET&#x60;, mutate, &#x60;PUT&#x60; without re-entering secrets. The &#x60;environments&#x60; override map is scoped to the caller&#39;s environment groups.
74
74
  # @param forwarder_id
75
75
  # @param [Hash] opts the optional parameters
76
76
  # @return [ForwarderResponse]
@@ -82,7 +82,7 @@ describe 'ForwardersApi' do
82
82
 
83
83
  # unit tests for list_forwarder_deliveries
84
84
  # List Forwarder Deliveries
85
- # List delivery log entries for a forwarder. Default sort is &#x60;-created_at&#x60; (newest first). Filter by &#x60;status&#x60; (&#x60;SUCCEEDED&#x60; or &#x60;FAILED&#x60;, case-insensitive), by &#x60;event&#x60;, or by a &#x60;created_at&#x60; range using interval notation (e.g. &#x60;[2026-01-01T00:00:00Z,*)&#x60;).
85
+ # List delivery log entries for a forwarder. Scoped to the resolved environment — only that environment&#39;s deliveries for the forwarder are shown. Default sort is &#x60;-created_at&#x60; (newest first). Filter by &#x60;status&#x60; (&#x60;SUCCEEDED&#x60; or &#x60;FAILED&#x60;, case-insensitive), by &#x60;event&#x60;, or by a &#x60;created_at&#x60; range using interval notation (e.g. &#x60;[2026-01-01T00:00:00Z,*)&#x60;).
86
86
  # @param forwarder_id
87
87
  # @param [Hash] opts the optional parameters
88
88
  # @option opts [String] :filter_status
@@ -100,10 +100,9 @@ describe 'ForwardersApi' do
100
100
 
101
101
  # unit tests for list_forwarders
102
102
  # List Forwarders
103
- # List forwarders for this account. Default sort is &#x60;-created_at&#x60; (newest first).
103
+ # List forwarders for this account. Default sort is &#x60;-created_at&#x60; (newest first). Each forwarder&#39;s &#x60;environments&#x60; override map is scoped to the caller&#39;s environment groups.
104
104
  # @param [Hash] opts the optional parameters
105
105
  # @option opts [String] :filter_forwarder_type
106
- # @option opts [Boolean] :filter_enabled
107
106
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;-created_at&#x60;. Allowed values: &#x60;created_at&#x60;, &#x60;-created_at&#x60;, &#x60;updated_at&#x60;, &#x60;-updated_at&#x60;.
108
107
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error.
109
108
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to &#x60;1000&#x60; when omitted. Must be between &#x60;1&#x60; and &#x60;1000&#x60; inclusive — requests outside that range are rejected with a 400 error.
@@ -117,7 +116,7 @@ describe 'ForwardersApi' do
117
116
 
118
117
  # unit tests for retry_failed_forwarder_deliveries
119
118
  # Retry Failed Forwarder Deliveries
120
- # Retry every failed delivery for this forwarder. Each failed delivery is re-attempted using the forwarder&#39;s current configuration and the original event. Returns the counts.
119
+ # Retry every failed delivery for this forwarder in the resolved environment. Scoped to the resolved environment (a single-environment credential implies it; otherwise send the &#x60;X-Smplkit-Environment&#x60; header): only that environment&#39;s failed deliveries are re-attempted, each using the forwarder&#39;s effective configuration for that environment and the original event. Returns the counts.
121
120
  # @param forwarder_id
122
121
  # @param [Hash] opts the optional parameters
123
122
  # @return [RetryFailedDeliveriesSummary]
@@ -129,7 +128,7 @@ describe 'ForwardersApi' do
129
128
 
130
129
  # unit tests for retry_forwarder_delivery
131
130
  # Retry Forwarder Delivery
132
- # Retry a single failed delivery. Returns the new delivery log entry. The prior entry is left in place.
131
+ # Retry a single failed delivery. The delivery is named by id, so it is authorized against the caller&#39;s permitted environment set: a delivery in an environment the caller can&#39;t access returns &#x60;404&#x60; (existence never leaks). Returns the new delivery log entry. The prior entry is left in place.
133
132
  # @param forwarder_id
134
133
  # @param delivery_id
135
134
  # @param [Hash] opts the optional parameters
@@ -142,7 +141,7 @@ describe 'ForwardersApi' do
142
141
 
143
142
  # unit tests for update_forwarder
144
143
  # Update Forwarder
145
- # Replace an existing forwarder. Every writable field is overwritten.
144
+ # Replace an existing forwarder. Every writable field is overwritten. The &#x60;environments&#x60; override map is a full replace for the environments you can manage; overrides for environments outside your access (which were hidden from your read) are preserved. Every environment referenced in &#x60;environments&#x60; must exist and be managed.
146
145
  # @param forwarder_id
147
146
  # @param forwarder_request
148
147
  # @param [Hash] opts the optional parameters
@@ -34,7 +34,7 @@ describe 'ResourceTypesApi' do
34
34
 
35
35
  # unit tests for list_resource_types
36
36
  # List Resource Types
37
- # List the distinct &#x60;resource_type&#x60; slugs recorded for this account. The resource &#x60;id&#x60; is the slug itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resource types visible under the account&#39;s current plan.
37
+ # List the distinct &#x60;resource_type&#x60; slugs recorded for this account. The resource &#x60;id&#x60; is the slug itself. Default sort is &#x60;key&#x60; ascending; pass &#x60;sort&#x3D;-key&#x60; for descending. Useful for populating filter dropdowns in a UI. Results are scoped to the resolved environment and to the resource types visible under the account&#39;s current plan.
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;key&#x60;. Allowed values: &#x60;key&#x60;, &#x60;-key&#x60;.
40
40
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error.
@@ -99,6 +99,12 @@ describe SmplkitGeneratedClient::Audit::Event do
99
99
  end
100
100
  end
101
101
 
102
+ describe 'test attribute "environment"' do
103
+ it 'should work' do
104
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
105
+ end
106
+ end
107
+
102
108
  describe 'test attribute "created_at"' do
103
109
  it 'should work' do
104
110
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -27,6 +27,12 @@ describe SmplkitGeneratedClient::Audit::ForwarderDelivery do
27
27
  end
28
28
  end
29
29
 
30
+ describe 'test attribute "environment"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
30
36
  describe 'test attribute "forwarder"' do
31
37
  it 'should work' do
32
38
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::Audit::ForwarderEnvironment
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::Audit::ForwarderEnvironment do
21
+ #let(:instance) { SmplkitGeneratedClient::Audit::ForwarderEnvironment.new }
22
+
23
+ describe 'test an instance of ForwarderEnvironment' do
24
+ it 'should create an instance of ForwarderEnvironment' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::ForwarderEnvironment)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "enabled"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "configuration"' 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
+
42
+ end
@@ -79,6 +79,12 @@ describe SmplkitGeneratedClient::Audit::Forwarder do
79
79
  end
80
80
  end
81
81
 
82
+ describe 'test attribute "environments"' do
83
+ it 'should work' do
84
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
85
+ end
86
+ end
87
+
82
88
  describe 'test attribute "created_at"' do
83
89
  it 'should work' do
84
90
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -16,7 +16,7 @@ module Smplkit
16
16
 
17
17
  SDK_OWNED_HEADERS = %w[authorization content-type user-agent].freeze
18
18
 
19
- def initialize(api_key:, base_url:, timeout: 10.0, extra_headers: nil)
19
+ def initialize(api_key:, base_url:, environment: nil, timeout: 10.0, extra_headers: nil)
20
20
  cfg = SmplkitGeneratedClient::Audit::Configuration.new
21
21
  cfg.host = URI.parse(base_url).host
22
22
  cfg.scheme = URI.parse(base_url).scheme
@@ -24,6 +24,14 @@ module Smplkit
24
24
  cfg.timeout = timeout
25
25
  api_client = SmplkitGeneratedClient::Audit::ApiClient.new(cfg)
26
26
  api_client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
27
+ # Runtime audit ops are environment-scoped: record / list / get /
28
+ # discovery all resolve their environment from the
29
+ # +X-Smplkit-Environment+ request header (ADR-055). We stamp it once
30
+ # at the client level from the SDK's configured runtime environment so
31
+ # every generated call carries it. It is stamped before +extra_headers+
32
+ # is applied so a caller-supplied entry of the same name wins (explicit
33
+ # override).
34
+ api_client.default_headers["X-Smplkit-Environment"] = environment unless environment.nil?
27
35
  extra_headers&.each do |k, v|
28
36
  api_client.default_headers[k] = v unless SDK_OWNED_HEADERS.include?(k.downcase)
29
37
  end
@@ -165,11 +165,17 @@ module Smplkit
165
165
  # @return [String, nil] Customer-supplied dedupe key, +nil+ if not provided.
166
166
  # @!attribute [rw] do_not_forward
167
167
  # @return [Boolean] When +true+, skip SIEM forwarder delivery regardless of any matching filter.
168
+ # @!attribute [rw] environment
169
+ # @return [String, nil] The environment the event was recorded in.
170
+ # Read-only and always present on reads — the audit service resolves it
171
+ # when the event is recorded (from a single-environment credential, or
172
+ # from the runtime SDK's configured environment, which the SDK sends on
173
+ # every recording call). Never set on the recording request body.
168
174
  AuditEvent = Struct.new(
169
175
  :id, :event_type, :resource_type, :resource_id,
170
176
  :occurred_at, :created_at,
171
177
  :actor_type, :actor_id, :actor_label,
172
- :data, :idempotency_key, :do_not_forward,
178
+ :data, :idempotency_key, :do_not_forward, :environment,
173
179
  keyword_init: true
174
180
  ) do
175
181
  def self.from_resource(resource)
@@ -186,7 +192,8 @@ module Smplkit
186
192
  actor_label: attrs.actor_label,
187
193
  data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}),
188
194
  idempotency_key: attrs.idempotency_key,
189
- do_not_forward: attrs.do_not_forward || false
195
+ do_not_forward: attrs.do_not_forward || false,
196
+ environment: attrs.environment
190
197
  )
191
198
  end
192
199
  end
@@ -332,6 +339,40 @@ module Smplkit
332
339
  end
333
340
  # rubocop:enable Lint/StructNewOverride
334
341
 
342
+ # Per-environment enablement and optional configuration override for a
343
+ # forwarder.
344
+ #
345
+ # A forwarder delivers events in a given environment only when that
346
+ # environment has an entry in {Forwarder#environments} with
347
+ # +enabled: true+. An environment with no entry (or +enabled: false+)
348
+ # receives no deliveries.
349
+ #
350
+ # @!attribute [rw] enabled
351
+ # @return [Boolean] Whether the forwarder delivers events in this
352
+ # environment. Defaults to +false+.
353
+ # @!attribute [rw] configuration
354
+ # @return [HttpConfiguration, nil] Optional per-environment destination
355
+ # configuration that fully replaces the forwarder's base
356
+ # {Forwarder#configuration} for this environment. +nil+ (the default)
357
+ # inherits the base configuration. As with the base configuration,
358
+ # header values are plaintext on writes and returned redacted on reads —
359
+ # re-supply real values before {Forwarder#save}.
360
+ ForwarderEnvironment = Struct.new(:enabled, :configuration, keyword_init: true) do
361
+ def initialize(enabled: false, configuration: nil)
362
+ super
363
+ end
364
+
365
+ def self.from_wire(src)
366
+ return new if src.nil?
367
+
368
+ cfg = src.configuration
369
+ new(
370
+ enabled: src.enabled.nil? ? false : src.enabled,
371
+ configuration: cfg.nil? ? nil : HttpConfiguration.from_wire(cfg)
372
+ )
373
+ end
374
+ end
375
+
335
376
  # A SIEM streaming forwarder configured on the customer's account.
336
377
  #
337
378
  # Active-record style: instantiate via
@@ -354,10 +395,21 @@ module Smplkit
354
395
  # @return [String] One of {ForwarderType::VALUES}.
355
396
  attr_accessor :forwarder_type
356
397
 
357
- # @return [Boolean] When +false+, the audit service skips delivery for
358
- # this forwarder but still records +filtered_out+ deliveries.
398
+ # @return [Boolean] Read-only. Always +false+ the base enablement is
399
+ # pinned off. Whether a forwarder actually delivers is decided per
400
+ # environment via {#environments}; mutating this field has no effect on
401
+ # the server.
359
402
  attr_accessor :enabled
360
403
 
404
+ # @return [Hash{String => ForwarderEnvironment}] Per-environment overrides
405
+ # keyed by environment key (e.g. +"production"+, +"staging"+). A
406
+ # forwarder delivers in an environment only when
407
+ # +environments[env].enabled+ is +true+. Each entry may carry an optional
408
+ # {HttpConfiguration} override; omit it to inherit the base
409
+ # {#configuration}. Every referenced environment must exist and be
410
+ # managed for the account.
411
+ attr_accessor :environments
412
+
361
413
  # @return [HttpConfiguration] Destination request configuration.
362
414
  attr_accessor :configuration
363
415
 
@@ -393,7 +445,7 @@ module Smplkit
393
445
  attr_accessor :version
394
446
 
395
447
  def initialize(client = nil, name:, forwarder_type:, configuration:,
396
- id: nil, enabled: true, description: nil,
448
+ id: nil, enabled: false, environments: nil, description: nil,
397
449
  filter: nil, transform: nil, transform_type: nil,
398
450
  created_at: nil, updated_at: nil, deleted_at: nil, version: nil)
399
451
  @client = client
@@ -401,7 +453,11 @@ module Smplkit
401
453
  @name = name
402
454
  @forwarder_type = ForwarderType.coerce(forwarder_type)
403
455
  @configuration = configuration
456
+ # ``enabled`` is server-pinned false; we keep the attribute so reads
457
+ # round-trip the server value, but enablement is driven by
458
+ # ``environments`` (see the class docstring).
404
459
  @enabled = enabled
460
+ @environments = environments || {}
405
461
  @description = description
406
462
  @filter = filter
407
463
  @transform = transform
@@ -451,6 +507,7 @@ module Smplkit
451
507
  @forwarder_type = other.forwarder_type
452
508
  @configuration = other.configuration
453
509
  @enabled = other.enabled
510
+ @environments = other.environments
454
511
  @description = other.description
455
512
  @filter = other.filter
456
513
  @transform = other.transform
@@ -483,13 +540,20 @@ module Smplkit
483
540
 
484
541
  def self.from_resource(resource, client: nil)
485
542
  a = resource.attributes
543
+ environments = (a.environments || {}).each_with_object({}) do |(env_key, env_raw), out|
544
+ out[env_key.to_s] = ForwarderEnvironment.from_wire(env_raw)
545
+ end
486
546
  new(
487
547
  client,
488
548
  id: resource.id,
489
549
  name: a.name,
490
550
  description: a.description,
491
551
  forwarder_type: a.forwarder_type,
492
- enabled: a.enabled.nil? || a.enabled,
552
+ # The base ``enabled`` is server-pinned false; round-trip whatever
553
+ # the server returned (always false) without assuming a default of
554
+ # true.
555
+ enabled: a.enabled.nil? ? false : a.enabled,
556
+ environments: environments,
493
557
  filter: a.filter.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.filter),
494
558
  transform_type: a.transform_type,
495
559
  transform: a.transform,
@@ -90,7 +90,7 @@ module Smplkit
90
90
  @logging = Logging::LoggingClient.new(self, manage: @manage, metrics: @metrics,
91
91
  logging_base_url: logging_url, app_base_url: app_url)
92
92
  @audit = Audit::AuditClient.new(api_key: cfg.api_key, base_url: audit_url,
93
- extra_headers: extra_headers)
93
+ environment: cfg.environment, extra_headers: extra_headers)
94
94
 
95
95
  @closed = false
96
96
  schedule_periodic_flush
@@ -39,7 +39,14 @@ module Smplkit
39
39
  # @param configuration [Smplkit::Audit::HttpConfiguration] Destination
40
40
  # request configuration. Headers carry credentials and are encrypted at
41
41
  # rest server-side; reads return them redacted.
42
- # @param enabled [Boolean] Whether the forwarder is active. Defaults +true+.
42
+ # @param environments [Hash{String => Smplkit::Audit::ForwarderEnvironment, Hash}, nil]
43
+ # Per-environment overrides keyed by environment key (e.g.
44
+ # +"production"+). A forwarder delivers in an environment only when that
45
+ # environment's entry has +enabled: true+. Values may be
46
+ # {Smplkit::Audit::ForwarderEnvironment} instances or plain hashes
47
+ # (+{ enabled: true }+, optionally with a +:configuration+
48
+ # {Smplkit::Audit::HttpConfiguration} override). Omit to create a
49
+ # forwarder that delivers nowhere until enabled per environment.
43
50
  # @param description [String, nil] Optional free-text description.
44
51
  # @param filter [Hash, nil] Optional JSON Logic filter; events that don't
45
52
  # match are recorded as +filtered_out+ deliveries.
@@ -57,7 +64,7 @@ module Smplkit
57
64
  # is not a +String+.
58
65
  # @return [Smplkit::Audit::Forwarder]
59
66
  def new_forwarder(id, forwarder_type:, configuration:, name: nil,
60
- enabled: true, description: nil,
67
+ environments: nil, description: nil,
61
68
  filter: nil, transform: nil, transform_type: nil)
62
69
  Smplkit::Audit::Forwarder.send(:validate_transform_pair!, transform, transform_type)
63
70
  Smplkit::Audit::Forwarder.new(
@@ -66,7 +73,7 @@ module Smplkit
66
73
  name: name || id,
67
74
  forwarder_type: forwarder_type,
68
75
  configuration: configuration,
69
- enabled: enabled,
76
+ environments: normalize_environments(environments),
70
77
  description: description,
71
78
  filter: filter,
72
79
  transform: transform,
@@ -82,10 +89,9 @@ module Smplkit
82
89
  # block (costs an extra COUNT query server-side).
83
90
  #
84
91
  # @return [ForwarderListPage]
85
- def list(forwarder_type: nil, enabled: nil, page_number: nil, page_size: nil, meta_total: nil)
92
+ def list(forwarder_type: nil, page_number: nil, page_size: nil, meta_total: nil)
86
93
  opts = {}
87
94
  opts[:filter_forwarder_type] = Smplkit::Audit::ForwarderType.coerce(forwarder_type) if forwarder_type
88
- opts[:filter_enabled] = enabled unless enabled.nil?
89
95
  opts[:page_number] = page_number if page_number
90
96
  opts[:page_size] = page_size if page_size
91
97
  opts[:meta_total] = meta_total unless meta_total.nil?
@@ -143,12 +149,49 @@ module Smplkit
143
149
 
144
150
  private
145
151
 
152
+ # Coerce a caller's +environments+ map to wrapper instances.
153
+ #
154
+ # Accepts either {Smplkit::Audit::ForwarderEnvironment} values or plain
155
+ # hashes (+{ enabled: true, configuration: HttpConfiguration.new(...) }+)
156
+ # so callers can use the lightweight hash form without importing the
157
+ # model.
158
+ def normalize_environments(environments)
159
+ return {} if environments.nil? || environments.empty?
160
+
161
+ environments.each_with_object({}) do |(env_key, value), out|
162
+ out[env_key.to_s] = if value.is_a?(Smplkit::Audit::ForwarderEnvironment)
163
+ value
164
+ else
165
+ Smplkit::Audit::ForwarderEnvironment.new(
166
+ enabled: value[:enabled] || value["enabled"] || false,
167
+ configuration: value[:configuration] || value["configuration"]
168
+ )
169
+ end
170
+ end
171
+ end
172
+
173
+ # Convert the wrapper +environments+ map to the generated model hash.
174
+ #
175
+ # Per-environment +configuration+ overrides are sent as full
176
+ # {Smplkit::Audit::HttpConfiguration} payloads (plaintext headers in),
177
+ # mirroring the base configuration's round-trip semantics.
178
+ def environments_to_wire(environments)
179
+ (environments || {}).each_with_object({}) do |(env_key, env), out|
180
+ out[env_key.to_s] = SmplkitGeneratedClient::Audit::ForwarderEnvironment.new(
181
+ enabled: env.enabled,
182
+ configuration: env.configuration.nil? ? nil : Smplkit::Audit::HttpConfiguration.to_wire(env.configuration)
183
+ )
184
+ end
185
+ end
186
+
146
187
  def build_attrs(forwarder)
188
+ # The base ``enabled`` is server-pinned false (ADR-055); we don't send
189
+ # it. Enablement travels entirely through ``environments``.
147
190
  SmplkitGeneratedClient::Audit::Forwarder.new(
148
191
  name: forwarder.name,
149
192
  description: forwarder.description,
150
193
  forwarder_type: Smplkit::Audit::ForwarderType.coerce(forwarder.forwarder_type),
151
- enabled: forwarder.enabled,
194
+ environments: environments_to_wire(forwarder.environments),
152
195
  filter: forwarder.filter,
153
196
  transform_type: Smplkit::Audit::TransformType.coerce(forwarder.transform_type),
154
197
  transform: forwarder.transform,
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.88
4
+ version: 3.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -526,6 +526,7 @@ files:
526
526
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_list_response.rb
527
527
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_resource.rb
528
528
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_delivery_response.rb
529
+ - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_environment.rb
529
530
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_list_response.rb
530
531
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_request.rb
531
532
  - lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_resource.rb
@@ -592,6 +593,7 @@ files:
592
593
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_resource_spec.rb
593
594
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_response_spec.rb
594
595
  - lib/smplkit/_generated/audit/spec/models/forwarder_delivery_spec.rb
596
+ - lib/smplkit/_generated/audit/spec/models/forwarder_environment_spec.rb
595
597
  - lib/smplkit/_generated/audit/spec/models/forwarder_list_response_spec.rb
596
598
  - lib/smplkit/_generated/audit/spec/models/forwarder_request_spec.rb
597
599
  - lib/smplkit/_generated/audit/spec/models/forwarder_resource_spec.rb