smplkit 3.0.100 → 3.0.102
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 +4 -4
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/events_api.rb +4 -4
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/exports_api.rb +2 -2
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/forwarders_api.rb +16 -6
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb +1 -1
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/export.rb +12 -1
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/retry_failed_deliveries_request.rb +150 -0
- data/lib/smplkit/_generated/audit/lib/smplkit_audit_client.rb +1 -0
- data/lib/smplkit/_generated/audit/spec/api/events_api_spec.rb +2 -2
- data/lib/smplkit/_generated/audit/spec/api/exports_api_spec.rb +1 -1
- data/lib/smplkit/_generated/audit/spec/api/forwarders_api_spec.rb +4 -2
- data/lib/smplkit/_generated/audit/spec/models/export_spec.rb +6 -0
- data/lib/smplkit/_generated/audit/spec/models/retry_failed_deliveries_request_spec.rb +36 -0
- data/lib/smplkit/audit/categories.rb +10 -6
- data/lib/smplkit/audit/client.rb +24 -15
- data/lib/smplkit/audit/event_types.rb +10 -6
- data/lib/smplkit/audit/events.rb +20 -4
- data/lib/smplkit/audit/models.rb +23 -1
- data/lib/smplkit/audit/resource_types.rb +10 -6
- data/lib/smplkit/client.rb +5 -3
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 047e3fc0922ee25b1441a22a33addbba76e885b486414ac3ca99b31d07b17277
|
|
4
|
+
data.tar.gz: 5ce032781cecf99066afb73359af216000039d158318dc427dfc456f159d35b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c5a05ff1932b11b194a3405bb6f361763810c935e3e7bc924afb6431dfd201b6447020b117f14161dc209525a072e4a4afb9d6b467eb086bfd177c5f3f6400c
|
|
7
|
+
data.tar.gz: cebda2b16e66a59fac937a6f135fdaeff3cdd727ff009637a77627efefc0eb2738a411dead73ccaf60d3f30edbd1416a6f55602bcfe4da2d00c891c14effefcc
|
|
@@ -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. 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).
|
|
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). A single-object lookup names the object by id; it does not resolve a target 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. 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).
|
|
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). A single-object lookup names the object by id; it does not resolve a target 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
|
|
@@ -197,7 +197,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
# Record Event
|
|
200
|
-
# Record an audit event for this account. The event is stamped with the environment it occurred in
|
|
200
|
+
# Record an audit event for this account. The event is stamped with the environment it occurred in. Name the target environment in the request body's `environment` field; omit it and a single-environment credential implies it, while a multi-environment or unrestricted credential must name it. The named environment must be one the caller may access and 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.
|
|
201
201
|
# @param event_request [EventRequest]
|
|
202
202
|
# @param [Hash] opts the optional parameters
|
|
203
203
|
# @option opts [String] :idempotency_key
|
|
@@ -208,7 +208,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
# Record Event
|
|
211
|
-
# Record an audit event for this account. The event is stamped with the environment it occurred in
|
|
211
|
+
# Record an audit event for this account. The event is stamped with the environment it occurred in. Name the target environment in the request body's `environment` field; omit it and a single-environment credential implies it, while a multi-environment or unrestricted credential must name it. The named environment must be one the caller may access and 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.
|
|
212
212
|
# @param event_request [EventRequest]
|
|
213
213
|
# @param [Hash] opts the optional parameters
|
|
214
214
|
# @option opts [String] :idempotency_key
|
|
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# Create Export
|
|
23
|
-
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
23
|
+
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. An export is scoped to a single environment: name it in the body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
24
24
|
# @param export_request [ExportRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @return [ExportResponse]
|
|
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Create Export
|
|
33
|
-
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
33
|
+
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. An export is scoped to a single environment: name it in the body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
34
34
|
# @param export_request [ExportRequest]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
36
|
# @return [Array<(ExportResponse, Integer, Hash)>] ExportResponse data, response status code and response headers
|
|
@@ -280,9 +280,10 @@ module SmplkitGeneratedClient::Audit
|
|
|
280
280
|
end
|
|
281
281
|
|
|
282
282
|
# List Forwarder Deliveries
|
|
283
|
-
# List delivery log entries for a forwarder. Scoped
|
|
283
|
+
# List delivery log entries for a forwarder. Scoped by environment. Pass `filter[environment]` as a comma-separated list of environment keys to restrict results to that subset of the environments you can access; omit it to cover every environment you can access. 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
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope deliveries to (e.g. `production,staging`). When omitted, results cover every environment you can access. The reserved value `smplkit` selects deliveries of platform change events smplkit records about your own resources; it is included by default when your plan grants change history, and requesting it explicitly without that entitlement returns 402.
|
|
286
287
|
# @option opts [String] :filter_status
|
|
287
288
|
# @option opts [String] :filter_created_at
|
|
288
289
|
# @option opts [String] :filter_event
|
|
@@ -296,9 +297,10 @@ module SmplkitGeneratedClient::Audit
|
|
|
296
297
|
end
|
|
297
298
|
|
|
298
299
|
# List Forwarder Deliveries
|
|
299
|
-
# List delivery log entries for a forwarder. Scoped
|
|
300
|
+
# List delivery log entries for a forwarder. Scoped by environment. Pass `filter[environment]` as a comma-separated list of environment keys to restrict results to that subset of the environments you can access; omit it to cover every environment you can access. 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,*)`).
|
|
300
301
|
# @param forwarder_id [String]
|
|
301
302
|
# @param [Hash] opts the optional parameters
|
|
303
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope deliveries to (e.g. `production,staging`). When omitted, results cover every environment you can access. The reserved value `smplkit` selects deliveries of platform change events smplkit records about your own resources; it is included by default when your plan grants change history, and requesting it explicitly without that entitlement returns 402.
|
|
302
304
|
# @option opts [String] :filter_status
|
|
303
305
|
# @option opts [String] :filter_created_at
|
|
304
306
|
# @option opts [String] :filter_event
|
|
@@ -327,6 +329,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
327
329
|
|
|
328
330
|
# query parameters
|
|
329
331
|
query_params = opts[:query_params] || {}
|
|
332
|
+
query_params[:'filter[environment]'] = opts[:'filter_environment'] if !opts[:'filter_environment'].nil?
|
|
330
333
|
query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil?
|
|
331
334
|
query_params[:'filter[created_at]'] = opts[:'filter_created_at'] if !opts[:'filter_created_at'].nil?
|
|
332
335
|
query_params[:'filter[event]'] = opts[:'filter_event'] if !opts[:'filter_event'].nil?
|
|
@@ -445,9 +448,10 @@ module SmplkitGeneratedClient::Audit
|
|
|
445
448
|
end
|
|
446
449
|
|
|
447
450
|
# Retry Failed Forwarder Deliveries
|
|
448
|
-
# Retry every failed delivery for this forwarder in the
|
|
451
|
+
# Retry every failed delivery for this forwarder in the target environment. Targets a single environment: name it in the request body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). 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.
|
|
449
452
|
# @param forwarder_id [String]
|
|
450
453
|
# @param [Hash] opts the optional parameters
|
|
454
|
+
# @option opts [RetryFailedDeliveriesRequest] :retry_failed_deliveries_request
|
|
451
455
|
# @return [RetryFailedDeliveriesSummary]
|
|
452
456
|
def retry_failed_forwarder_deliveries(forwarder_id, opts = {})
|
|
453
457
|
data, _status_code, _headers = retry_failed_forwarder_deliveries_with_http_info(forwarder_id, opts)
|
|
@@ -455,9 +459,10 @@ module SmplkitGeneratedClient::Audit
|
|
|
455
459
|
end
|
|
456
460
|
|
|
457
461
|
# Retry Failed Forwarder Deliveries
|
|
458
|
-
# Retry every failed delivery for this forwarder in the
|
|
462
|
+
# Retry every failed delivery for this forwarder in the target environment. Targets a single environment: name it in the request body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). 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.
|
|
459
463
|
# @param forwarder_id [String]
|
|
460
464
|
# @param [Hash] opts the optional parameters
|
|
465
|
+
# @option opts [RetryFailedDeliveriesRequest] :retry_failed_deliveries_request
|
|
461
466
|
# @return [Array<(RetryFailedDeliveriesSummary, Integer, Hash)>] RetryFailedDeliveriesSummary data, response status code and response headers
|
|
462
467
|
def retry_failed_forwarder_deliveries_with_http_info(forwarder_id, opts = {})
|
|
463
468
|
if @api_client.config.debugging
|
|
@@ -476,13 +481,18 @@ module SmplkitGeneratedClient::Audit
|
|
|
476
481
|
# header parameters
|
|
477
482
|
header_params = opts[:header_params] || {}
|
|
478
483
|
# HTTP header 'Accept' (if needed)
|
|
479
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/
|
|
484
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
485
|
+
# HTTP header 'Content-Type'
|
|
486
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
487
|
+
if !content_type.nil?
|
|
488
|
+
header_params['Content-Type'] = content_type
|
|
489
|
+
end
|
|
480
490
|
|
|
481
491
|
# form parameters
|
|
482
492
|
form_params = opts[:form_params] || {}
|
|
483
493
|
|
|
484
494
|
# http body (model)
|
|
485
|
-
post_body = opts[:debug_body]
|
|
495
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'retry_failed_deliveries_request'])
|
|
486
496
|
|
|
487
497
|
# return_type
|
|
488
498
|
return_type = opts[:debug_return_type] || 'RetryFailedDeliveriesSummary'
|
|
@@ -52,7 +52,7 @@ 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.
|
|
55
|
+
# The environment the event occurred in. On write, optionally names the target environment: omit it and a single-environment credential implies it (a multi-environment credential must name it), and a named environment must be one the caller may access. Always present on read as the resolved environment. The same content recorded in two environments produces two distinct events.
|
|
56
56
|
attr_accessor :environment
|
|
57
57
|
|
|
58
58
|
# When the event was received and recorded.
|
|
@@ -19,6 +19,9 @@ module SmplkitGeneratedClient::Audit
|
|
|
19
19
|
# Output format for the download. `CSV` writes one row per event with the event payload (`data`) serialized as a JSON-encoded cell. `JSONL` writes one JSON object per line with `data` preserved as a nested object.
|
|
20
20
|
attr_accessor :format
|
|
21
21
|
|
|
22
|
+
# The single environment the export is scoped to. Omit it and a single-environment credential implies it (a multi-environment credential must name it), and a named environment must be one the caller may access. An export always covers exactly one environment.
|
|
23
|
+
attr_accessor :environment
|
|
24
|
+
|
|
22
25
|
# Date range using interval notation, e.g. `[2026-04-01T00:00:00Z,2026-04-15T00:00:00Z)`.
|
|
23
26
|
attr_accessor :filter_occurred_at
|
|
24
27
|
|
|
@@ -75,6 +78,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
75
78
|
def self.attribute_map
|
|
76
79
|
{
|
|
77
80
|
:'format' => :'format',
|
|
81
|
+
:'environment' => :'environment',
|
|
78
82
|
:'filter_occurred_at' => :'filter[occurred_at]',
|
|
79
83
|
:'filter_actor_type' => :'filter[actor_type]',
|
|
80
84
|
:'filter_actor_id' => :'filter[actor_id]',
|
|
@@ -102,6 +106,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
102
106
|
def self.openapi_types
|
|
103
107
|
{
|
|
104
108
|
:'format' => :'String',
|
|
109
|
+
:'environment' => :'String',
|
|
105
110
|
:'filter_occurred_at' => :'String',
|
|
106
111
|
:'filter_actor_type' => :'String',
|
|
107
112
|
:'filter_actor_id' => :'String',
|
|
@@ -118,6 +123,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
118
123
|
# List of attributes with nullable: true
|
|
119
124
|
def self.openapi_nullable
|
|
120
125
|
Set.new([
|
|
126
|
+
:'environment',
|
|
121
127
|
:'filter_occurred_at',
|
|
122
128
|
:'filter_actor_type',
|
|
123
129
|
:'filter_actor_id',
|
|
@@ -153,6 +159,10 @@ module SmplkitGeneratedClient::Audit
|
|
|
153
159
|
self.format = nil
|
|
154
160
|
end
|
|
155
161
|
|
|
162
|
+
if attributes.key?(:'environment')
|
|
163
|
+
self.environment = attributes[:'environment']
|
|
164
|
+
end
|
|
165
|
+
|
|
156
166
|
if attributes.key?(:'filter_occurred_at')
|
|
157
167
|
self.filter_occurred_at = attributes[:'filter_occurred_at']
|
|
158
168
|
end
|
|
@@ -232,6 +242,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
232
242
|
return true if self.equal?(o)
|
|
233
243
|
self.class == o.class &&
|
|
234
244
|
format == o.format &&
|
|
245
|
+
environment == o.environment &&
|
|
235
246
|
filter_occurred_at == o.filter_occurred_at &&
|
|
236
247
|
filter_actor_type == o.filter_actor_type &&
|
|
237
248
|
filter_actor_id == o.filter_actor_id &&
|
|
@@ -253,7 +264,7 @@ module SmplkitGeneratedClient::Audit
|
|
|
253
264
|
# Calculates hash code according to all attributes.
|
|
254
265
|
# @return [Integer] Hash code
|
|
255
266
|
def hash
|
|
256
|
-
[format, filter_occurred_at, filter_actor_type, filter_actor_id, filter_event_type, filter_resource_type, filter_resource_id, filter_search, filter_do_not_forward, url, expires_at].hash
|
|
267
|
+
[format, environment, filter_occurred_at, filter_actor_type, filter_actor_id, filter_event_type, filter_resource_type, filter_resource_id, filter_search, filter_do_not_forward, url, expires_at].hash
|
|
257
268
|
end
|
|
258
269
|
|
|
259
270
|
# Builds the object from hash
|
data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/retry_failed_deliveries_request.rb
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
# Inputs to the retry-failed-deliveries action.
|
|
18
|
+
class RetryFailedDeliveriesRequest < ApiModelBase
|
|
19
|
+
# The single environment whose failed deliveries are re-attempted. Omit it and a single-environment credential implies it (a multi-environment credential must name it), and a named environment must be one the caller may access. The action always targets exactly one environment.
|
|
20
|
+
attr_accessor :environment
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'environment' => :'environment'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns attribute mapping this model knows about
|
|
30
|
+
def self.acceptable_attribute_map
|
|
31
|
+
attribute_map
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Returns all the JSON keys this model knows about
|
|
35
|
+
def self.acceptable_attributes
|
|
36
|
+
acceptable_attribute_map.values
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Attribute type mapping.
|
|
40
|
+
def self.openapi_types
|
|
41
|
+
{
|
|
42
|
+
:'environment' => :'String'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# List of attributes with nullable: true
|
|
47
|
+
def self.openapi_nullable
|
|
48
|
+
Set.new([
|
|
49
|
+
:'environment'
|
|
50
|
+
])
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Initializes the object
|
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
55
|
+
def initialize(attributes = {})
|
|
56
|
+
if (!attributes.is_a?(Hash))
|
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::RetryFailedDeliveriesRequest` initialize method"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
61
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
63
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::RetryFailedDeliveriesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
65
|
+
end
|
|
66
|
+
h[k.to_sym] = v
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if attributes.key?(:'environment')
|
|
70
|
+
self.environment = attributes[:'environment']
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
75
|
+
# @return Array for valid properties with the reasons
|
|
76
|
+
def list_invalid_properties
|
|
77
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
78
|
+
invalid_properties = Array.new
|
|
79
|
+
invalid_properties
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Check to see if the all the properties in the model are valid
|
|
83
|
+
# @return true if the model is valid
|
|
84
|
+
def valid?
|
|
85
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
86
|
+
true
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Checks equality by comparing each attribute.
|
|
90
|
+
# @param [Object] Object to be compared
|
|
91
|
+
def ==(o)
|
|
92
|
+
return true if self.equal?(o)
|
|
93
|
+
self.class == o.class &&
|
|
94
|
+
environment == o.environment
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# @see the `==` method
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def eql?(o)
|
|
100
|
+
self == o
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Calculates hash code according to all attributes.
|
|
104
|
+
# @return [Integer] Hash code
|
|
105
|
+
def hash
|
|
106
|
+
[environment].hash
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Builds the object from hash
|
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
111
|
+
# @return [Object] Returns the model itself
|
|
112
|
+
def self.build_from_hash(attributes)
|
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
|
114
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
115
|
+
transformed_hash = {}
|
|
116
|
+
openapi_types.each_pair do |key, type|
|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
118
|
+
transformed_hash["#{key}"] = nil
|
|
119
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
120
|
+
# check to ensure the input is an array given that the attribute
|
|
121
|
+
# is documented as an array but the input is not
|
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
124
|
+
end
|
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
new(transformed_hash)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Returns the object in the form of hash
|
|
133
|
+
# @return [Hash] Returns the object in the form of hash
|
|
134
|
+
def to_hash
|
|
135
|
+
hash = {}
|
|
136
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
137
|
+
value = self.send(attr)
|
|
138
|
+
if value.nil?
|
|
139
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
140
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
hash[param] = _to_hash(value)
|
|
144
|
+
end
|
|
145
|
+
hash
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
end
|
|
@@ -70,6 +70,7 @@ require 'smplkit_audit_client/models/pagination_meta'
|
|
|
70
70
|
require 'smplkit_audit_client/models/resource_type_attributes'
|
|
71
71
|
require 'smplkit_audit_client/models/resource_type_list_response'
|
|
72
72
|
require 'smplkit_audit_client/models/resource_type_resource'
|
|
73
|
+
require 'smplkit_audit_client/models/retry_failed_deliveries_request'
|
|
73
74
|
require 'smplkit_audit_client/models/retry_failed_deliveries_summary'
|
|
74
75
|
require 'smplkit_audit_client/models/severity'
|
|
75
76
|
require 'smplkit_audit_client/models/test_forwarder_request'
|
|
@@ -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. 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).
|
|
37
|
+
# 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). A single-object lookup names the object by id; it does not resolve a target environment.
|
|
38
38
|
# @param event_id
|
|
39
39
|
# @param [Hash] opts the optional parameters
|
|
40
40
|
# @return [EventResponse]
|
|
@@ -72,7 +72,7 @@ describe 'EventsApi' do
|
|
|
72
72
|
|
|
73
73
|
# unit tests for record_event
|
|
74
74
|
# Record Event
|
|
75
|
-
# Record an audit event for this account. The event is stamped with the environment it occurred in
|
|
75
|
+
# Record an audit event for this account. The event is stamped with the environment it occurred in. Name the target environment in the request body's `environment` field; omit it and a single-environment credential implies it, while a multi-environment or unrestricted credential must name it. The named environment must be one the caller may access and 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.
|
|
76
76
|
# @param event_request
|
|
77
77
|
# @param [Hash] opts the optional parameters
|
|
78
78
|
# @option opts [String] :idempotency_key
|
|
@@ -34,7 +34,7 @@ describe 'ExportsApi' do
|
|
|
34
34
|
|
|
35
35
|
# unit tests for create_export
|
|
36
36
|
# Create Export
|
|
37
|
-
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
37
|
+
# Mint a short-lived signed URL to stream an events download. The request body specifies `format` (`CSV` or `JSONL`) and any subset of the event filters accepted by `GET /api/v1/events`. An export is scoped to a single environment: name it in the body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). The response returns the signed URL plus its expiry (30 seconds from mint). Open the URL in a browser to stream the file to disk; no `Authorization` header is required at download time. Filter rules match `GET /api/v1/events`: `filter[resource_id]` requires `filter[resource_type]`; `filter[search]` requires either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`. Violations are rejected here at mint time. Reads are allowed on lapsed subscriptions per the smplcore convention — same gate as the events list.
|
|
38
38
|
# @param export_request
|
|
39
39
|
# @param [Hash] opts the optional parameters
|
|
40
40
|
# @return [ExportResponse]
|
|
@@ -82,9 +82,10 @@ 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. Scoped
|
|
85
|
+
# List delivery log entries for a forwarder. Scoped by environment. Pass `filter[environment]` as a comma-separated list of environment keys to restrict results to that subset of the environments you can access; omit it to cover every environment you can access. 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,*)`).
|
|
86
86
|
# @param forwarder_id
|
|
87
87
|
# @param [Hash] opts the optional parameters
|
|
88
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope deliveries to (e.g. `production,staging`). When omitted, results cover every environment you can access. The reserved value `smplkit` selects deliveries of platform change events smplkit records about your own resources; it is included by default when your plan grants change history, and requesting it explicitly without that entitlement returns 402.
|
|
88
89
|
# @option opts [String] :filter_status
|
|
89
90
|
# @option opts [String] :filter_created_at
|
|
90
91
|
# @option opts [String] :filter_event
|
|
@@ -116,9 +117,10 @@ describe 'ForwardersApi' do
|
|
|
116
117
|
|
|
117
118
|
# unit tests for retry_failed_forwarder_deliveries
|
|
118
119
|
# Retry Failed Forwarder Deliveries
|
|
119
|
-
# Retry every failed delivery for this forwarder in the
|
|
120
|
+
# Retry every failed delivery for this forwarder in the target environment. Targets a single environment: name it in the request body's `environment` field, or omit it and a single-environment credential implies it (a multi-environment credential must name it). 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.
|
|
120
121
|
# @param forwarder_id
|
|
121
122
|
# @param [Hash] opts the optional parameters
|
|
123
|
+
# @option opts [RetryFailedDeliveriesRequest] :retry_failed_deliveries_request
|
|
122
124
|
# @return [RetryFailedDeliveriesSummary]
|
|
123
125
|
describe 'retry_failed_forwarder_deliveries test' do
|
|
124
126
|
it 'should work' do
|
|
@@ -37,6 +37,12 @@ describe SmplkitGeneratedClient::Audit::Export do
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
describe 'test attribute "environment"' do
|
|
41
|
+
it 'should work' do
|
|
42
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
40
46
|
describe 'test attribute "filter_occurred_at"' do
|
|
41
47
|
it 'should work' do
|
|
42
48
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
@@ -0,0 +1,36 @@
|
|
|
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::RetryFailedDeliveriesRequest
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe SmplkitGeneratedClient::Audit::RetryFailedDeliveriesRequest do
|
|
21
|
+
#let(:instance) { SmplkitGeneratedClient::Audit::RetryFailedDeliveriesRequest.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of RetryFailedDeliveriesRequest' do
|
|
24
|
+
it 'should create an instance of RetryFailedDeliveriesRequest' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::RetryFailedDeliveriesRequest)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
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
|
+
|
|
36
|
+
end
|
|
@@ -8,16 +8,19 @@ module Smplkit
|
|
|
8
8
|
# Response time is independent of how many years of events the account has
|
|
9
9
|
# accumulated. Sorted alphabetically; offset paginated.
|
|
10
10
|
class Categories
|
|
11
|
-
def initialize(api)
|
|
11
|
+
def initialize(api, environment: nil)
|
|
12
12
|
@api = api
|
|
13
|
+
@environment = environment
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
# List the distinct +category+ values seen in the account.
|
|
16
17
|
#
|
|
17
18
|
# +environments+ scopes the listing to a set of environments: pass an
|
|
18
19
|
# array of environment keys and/or the reserved +"smplkit"+ control-plane
|
|
19
|
-
# bucket; the values are comma-joined into +filter[environment]+.
|
|
20
|
-
#
|
|
20
|
+
# bucket; the values are comma-joined into +filter[environment]+. Omit it
|
|
21
|
+
# (the default) to scope the listing to the client's configured
|
|
22
|
+
# environment; with no configured environment the filter is left off
|
|
23
|
+
# entirely.
|
|
21
24
|
#
|
|
22
25
|
# @param page_number [Integer, nil] 1-based page index. Omit for the first
|
|
23
26
|
# page.
|
|
@@ -28,7 +31,8 @@ module Smplkit
|
|
|
28
31
|
# count server-side). Omit to skip it.
|
|
29
32
|
# @param environments [Array<String>, nil] Environment keys and/or the
|
|
30
33
|
# reserved +"smplkit"+ control-plane bucket to scope the listing to. Omit
|
|
31
|
-
# to
|
|
34
|
+
# to fall back to the client's configured environment; with no configured
|
|
35
|
+
# environment the filter is left off entirely.
|
|
32
36
|
# @return [Smplkit::Audit::CategoryListPage] A page of the matching
|
|
33
37
|
# category values.
|
|
34
38
|
def list(page_number: nil, page_size: nil, meta_total: nil, environments: nil)
|
|
@@ -36,8 +40,8 @@ module Smplkit
|
|
|
36
40
|
opts[:page_number] = page_number if page_number
|
|
37
41
|
opts[:page_size] = page_size if page_size
|
|
38
42
|
opts[:meta_total] = meta_total unless meta_total.nil?
|
|
39
|
-
|
|
40
|
-
opts[:filter_environment] =
|
|
43
|
+
resolved_environment = Smplkit::Audit.resolve_environment_filter(environments, @environment)
|
|
44
|
+
opts[:filter_environment] = resolved_environment if resolved_environment
|
|
41
45
|
|
|
42
46
|
resp = Smplkit::Audit.call_api { @api.list_categories(opts) }
|
|
43
47
|
rows = (resp.data || []).map { |r| Category.from_resource(r) }
|
data/lib/smplkit/audit/client.rb
CHANGED
|
@@ -21,9 +21,13 @@ module Smplkit
|
|
|
21
21
|
# from +base_domain+/+scheme+; supplied directly by the top-level clients
|
|
22
22
|
# which have already computed it.
|
|
23
23
|
# @param environment [String, nil] Deployment environment to scope recording
|
|
24
|
-
# and reads to.
|
|
25
|
-
# environment
|
|
26
|
-
#
|
|
24
|
+
# and reads to. Sent on the event request body when recording and as the
|
|
25
|
+
# default +filter[environment]+ on the read surfaces (events list and the
|
|
26
|
+
# resource_type / event_type / category discovery lists). Optional —
|
|
27
|
+
# forwarder CRUD is environment-agnostic, and reads accept an explicit
|
|
28
|
+
# +environments: [...]+ filter that overrides this default. With no
|
|
29
|
+
# configured environment, recording falls back to the server-side default
|
|
30
|
+
# environment and the read filter is left off.
|
|
27
31
|
# @param profile [String, nil] Named +~/.smplkit+ profile section.
|
|
28
32
|
# @param base_domain [String, nil] Base domain for API requests (default
|
|
29
33
|
# +"smplkit.com"+).
|
|
@@ -64,21 +68,26 @@ module Smplkit
|
|
|
64
68
|
HttpPool.configure(cfg)
|
|
65
69
|
api_client = SmplkitGeneratedClient::Audit::ApiClient.new(cfg)
|
|
66
70
|
api_client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
|
|
67
|
-
# Runtime audit ops are environment-scoped
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
api_client.default_headers["X-Smplkit-Environment"] = environment unless environment.nil?
|
|
71
|
+
# Runtime audit ops are environment-scoped, but the scoping is
|
|
72
|
+
# body-driven (ADR-055): +events.record+ stamps the configured
|
|
73
|
+
# environment onto the event request body, and the read surfaces
|
|
74
|
+
# (events list plus the resource_type / event_type / category discovery
|
|
75
|
+
# lists) default +filter[environment]+ to it. The transport therefore
|
|
76
|
+
# carries only auth plus any caller-supplied +extra_headers+ — no
|
|
77
|
+
# environment header. Forwarder CRUD is environment-agnostic.
|
|
75
78
|
extra_headers&.each do |k, v|
|
|
76
79
|
api_client.default_headers[k] = v unless SDK_OWNED_HEADERS.include?(k.downcase)
|
|
77
80
|
end
|
|
78
|
-
@events = Events.new(SmplkitGeneratedClient::Audit::EventsApi.new(api_client))
|
|
79
|
-
@resource_types = ResourceTypes.new(
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
@events = Events.new(SmplkitGeneratedClient::Audit::EventsApi.new(api_client), environment: environment)
|
|
82
|
+
@resource_types = ResourceTypes.new(
|
|
83
|
+
SmplkitGeneratedClient::Audit::ResourceTypesApi.new(api_client), environment: environment
|
|
84
|
+
)
|
|
85
|
+
@event_types = EventTypes.new(
|
|
86
|
+
SmplkitGeneratedClient::Audit::EventTypesApi.new(api_client), environment: environment
|
|
87
|
+
)
|
|
88
|
+
@categories = Categories.new(
|
|
89
|
+
SmplkitGeneratedClient::Audit::CategoriesApi.new(api_client), environment: environment
|
|
90
|
+
)
|
|
82
91
|
@forwarders = ForwardersClient.new(SmplkitGeneratedClient::Audit::ForwardersApi.new(api_client))
|
|
83
92
|
end
|
|
84
93
|
|
|
@@ -13,16 +13,19 @@ module Smplkit
|
|
|
13
13
|
#
|
|
14
14
|
# Sorted alphabetically; offset paginated.
|
|
15
15
|
class EventTypes
|
|
16
|
-
def initialize(api)
|
|
16
|
+
def initialize(api, environment: nil)
|
|
17
17
|
@api = api
|
|
18
|
+
@environment = environment
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
# List the distinct +event_type+ slugs seen in the account.
|
|
21
22
|
#
|
|
22
23
|
# +environments+ scopes the listing to a set of environments: pass an
|
|
23
24
|
# array of environment keys and/or the reserved +"smplkit"+ control-plane
|
|
24
|
-
# bucket; the values are comma-joined into +filter[environment]+.
|
|
25
|
-
#
|
|
25
|
+
# bucket; the values are comma-joined into +filter[environment]+. Omit it
|
|
26
|
+
# (the default) to scope the listing to the client's configured
|
|
27
|
+
# environment; with no configured environment the filter is left off
|
|
28
|
+
# entirely.
|
|
26
29
|
#
|
|
27
30
|
# @param filter_resource_type [String, nil] Restrict the listing to
|
|
28
31
|
# event_types seen with this +resource_type+. Omit to list every distinct
|
|
@@ -36,7 +39,8 @@ module Smplkit
|
|
|
36
39
|
# count server-side). Omit to skip it.
|
|
37
40
|
# @param environments [Array<String>, nil] Environment keys and/or the
|
|
38
41
|
# reserved +"smplkit"+ control-plane bucket to scope the listing to. Omit
|
|
39
|
-
# to
|
|
42
|
+
# to fall back to the client's configured environment; with no configured
|
|
43
|
+
# environment the filter is left off entirely.
|
|
40
44
|
# @return [Smplkit::Audit::EventTypeListPage] A page of the matching
|
|
41
45
|
# event-type slugs.
|
|
42
46
|
def list(filter_resource_type: nil, page_number: nil, page_size: nil, meta_total: nil, environments: nil)
|
|
@@ -45,8 +49,8 @@ module Smplkit
|
|
|
45
49
|
opts[:page_number] = page_number if page_number
|
|
46
50
|
opts[:page_size] = page_size if page_size
|
|
47
51
|
opts[:meta_total] = meta_total unless meta_total.nil?
|
|
48
|
-
|
|
49
|
-
opts[:filter_environment] =
|
|
52
|
+
resolved_environment = Smplkit::Audit.resolve_environment_filter(environments, @environment)
|
|
53
|
+
opts[:filter_environment] = resolved_environment if resolved_environment
|
|
50
54
|
|
|
51
55
|
resp = Smplkit::Audit.call_api { @api.list_event_types(opts) }
|
|
52
56
|
rows = (resp.data || []).map { |r| EventType.from_resource(r) }
|
data/lib/smplkit/audit/events.rb
CHANGED
|
@@ -9,8 +9,9 @@ module Smplkit
|
|
|
9
9
|
# +flush: true+ to block until the event is durable before continuing.
|
|
10
10
|
# +#list+ and +#get+ are synchronous reads.
|
|
11
11
|
class Events
|
|
12
|
-
def initialize(api)
|
|
12
|
+
def initialize(api, environment: nil)
|
|
13
13
|
@api = api
|
|
14
|
+
@environment = environment
|
|
14
15
|
@buffer = EventBuffer.new(api)
|
|
15
16
|
end
|
|
16
17
|
|
|
@@ -105,6 +106,13 @@ module Smplkit
|
|
|
105
106
|
data: data || {},
|
|
106
107
|
do_not_forward: do_not_forward
|
|
107
108
|
)
|
|
109
|
+
# Stamp the client's configured environment onto the event body — the
|
|
110
|
+
# body-driven replacement for the old +X-Smplkit-Environment+ header
|
|
111
|
+
# (ADR-055). Left off when nil so a single-environment credential
|
|
112
|
+
# resolves it server-side. Assigning conditionally (rather than passing
|
|
113
|
+
# +environment: nil+ through the constructor) keeps the field out of the
|
|
114
|
+
# serialized body entirely when unconfigured.
|
|
115
|
+
attrs.environment = @environment unless @environment.nil?
|
|
108
116
|
resource = SmplkitGeneratedClient::Audit::EventResource.new(
|
|
109
117
|
id: "",
|
|
110
118
|
type: "event",
|
|
@@ -141,6 +149,13 @@ module Smplkit
|
|
|
141
149
|
# +occurred_at_range+, or with both +resource_type+ and +resource_id+ —
|
|
142
150
|
# or the request is rejected.
|
|
143
151
|
#
|
|
152
|
+
# +environments+ scopes the read to a set of environments: pass an array
|
|
153
|
+
# of environment keys and/or the reserved +"smplkit"+ control-plane
|
|
154
|
+
# bucket; the values are sent comma-separated as +filter[environment]+.
|
|
155
|
+
# Omit it (the default) to scope the read to the client's configured
|
|
156
|
+
# environment; with no configured environment the filter is left off
|
|
157
|
+
# entirely.
|
|
158
|
+
#
|
|
144
159
|
# @param event_type [String, nil] Return only events with this
|
|
145
160
|
# +event_type+. Omit to match any.
|
|
146
161
|
# @param resource_type [String, nil] Return only events about this
|
|
@@ -160,7 +175,8 @@ module Smplkit
|
|
|
160
175
|
# or the request is rejected. Omit to disable text filtering.
|
|
161
176
|
# @param environments [Array<String>, nil] Environment keys (and/or the
|
|
162
177
|
# reserved +"smplkit"+ control-plane bucket) to scope the read to. Omit
|
|
163
|
-
# to
|
|
178
|
+
# to fall back to the client's configured environment; with no configured
|
|
179
|
+
# environment the filter is left off entirely.
|
|
164
180
|
# @param page_size [Integer, nil] Maximum number of events to return in
|
|
165
181
|
# this page.
|
|
166
182
|
# @param page_after [String, nil] Opaque cursor from a previous page's
|
|
@@ -183,8 +199,8 @@ module Smplkit
|
|
|
183
199
|
opts[:filter_actor_id] = actor_id if actor_id
|
|
184
200
|
opts[:filter_occurred_at] = occurred_at_range if occurred_at_range
|
|
185
201
|
opts[:filter_search] = search if search
|
|
186
|
-
|
|
187
|
-
opts[:filter_environment] =
|
|
202
|
+
resolved_environment = Smplkit::Audit.resolve_environment_filter(environments, @environment)
|
|
203
|
+
opts[:filter_environment] = resolved_environment if resolved_environment
|
|
188
204
|
opts[:page_size] = page_size if page_size
|
|
189
205
|
opts[:page_after] = page_after if page_after
|
|
190
206
|
|
data/lib/smplkit/audit/models.rb
CHANGED
|
@@ -79,6 +79,28 @@ module Smplkit
|
|
|
79
79
|
values.empty? ? nil : values.join(",")
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
+
# Resolve the +filter[environment]+ value for a read surface.
|
|
83
|
+
#
|
|
84
|
+
# An explicit, non-empty +environments+ list always wins and is comma-joined
|
|
85
|
+
# via {join_environments}. Otherwise the client's configured +default+
|
|
86
|
+
# environment scopes the read — the body-driven replacement for the old
|
|
87
|
+
# per-request +X-Smplkit-Environment+ header (ADR-055), which previously
|
|
88
|
+
# scoped every read to the client's environment. A client with no configured
|
|
89
|
+
# environment and no explicit list returns +nil+ so the caller omits the
|
|
90
|
+
# query param and the credential's own scoping applies server-side.
|
|
91
|
+
#
|
|
92
|
+
# @param environments [Array<String>, String, nil] Explicit per-call
|
|
93
|
+
# environment filter; an empty/blank value falls through to +default+.
|
|
94
|
+
# @param default [String, nil] The client's configured environment.
|
|
95
|
+
# @return [String, nil] The +filter[environment]+ value, or +nil+ to omit it.
|
|
96
|
+
# @api private
|
|
97
|
+
def self.resolve_environment_filter(environments, default)
|
|
98
|
+
joined = join_environments(environments)
|
|
99
|
+
return joined unless joined.nil?
|
|
100
|
+
|
|
101
|
+
default
|
|
102
|
+
end
|
|
103
|
+
|
|
82
104
|
# Supported SIEM forwarder destination types.
|
|
83
105
|
#
|
|
84
106
|
# Members are declared in alphabetical order. Customers pass these
|
|
@@ -204,7 +226,7 @@ module Smplkit
|
|
|
204
226
|
# Read-only and always present on reads — the audit service resolves it
|
|
205
227
|
# when the event is recorded (from a single-environment credential, or
|
|
206
228
|
# from the runtime SDK's configured environment, which the SDK sends on
|
|
207
|
-
#
|
|
229
|
+
# the recording request body).
|
|
208
230
|
AuditEvent = Struct.new(
|
|
209
231
|
:id, :event_type, :resource_type, :resource_id,
|
|
210
232
|
:occurred_at, :created_at,
|
|
@@ -8,16 +8,19 @@ module Smplkit
|
|
|
8
8
|
# Response time is independent of how many years of events the account has
|
|
9
9
|
# accumulated. Sorted alphabetically; offset paginated.
|
|
10
10
|
class ResourceTypes
|
|
11
|
-
def initialize(api)
|
|
11
|
+
def initialize(api, environment: nil)
|
|
12
12
|
@api = api
|
|
13
|
+
@environment = environment
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
# List the distinct +resource_type+ slugs seen in the account.
|
|
16
17
|
#
|
|
17
18
|
# +environments+ scopes the listing to a set of environments: pass an
|
|
18
19
|
# array of environment keys and/or the reserved +"smplkit"+ control-plane
|
|
19
|
-
# bucket; the values are comma-joined into +filter[environment]+.
|
|
20
|
-
#
|
|
20
|
+
# bucket; the values are comma-joined into +filter[environment]+. Omit it
|
|
21
|
+
# (the default) to scope the listing to the client's configured
|
|
22
|
+
# environment; with no configured environment the filter is left off
|
|
23
|
+
# entirely.
|
|
21
24
|
#
|
|
22
25
|
# @param page_number [Integer, nil] 1-based page index. Omit for the first
|
|
23
26
|
# page.
|
|
@@ -28,7 +31,8 @@ module Smplkit
|
|
|
28
31
|
# count server-side). Omit to skip it.
|
|
29
32
|
# @param environments [Array<String>, nil] Environment keys and/or the
|
|
30
33
|
# reserved +"smplkit"+ control-plane bucket to scope the listing to. Omit
|
|
31
|
-
# to
|
|
34
|
+
# to fall back to the client's configured environment; with no configured
|
|
35
|
+
# environment the filter is left off entirely.
|
|
32
36
|
# @return [Smplkit::Audit::ResourceTypeListPage] A page of the matching
|
|
33
37
|
# resource-type slugs.
|
|
34
38
|
def list(page_number: nil, page_size: nil, meta_total: nil, environments: nil)
|
|
@@ -36,8 +40,8 @@ module Smplkit
|
|
|
36
40
|
opts[:page_number] = page_number if page_number
|
|
37
41
|
opts[:page_size] = page_size if page_size
|
|
38
42
|
opts[:meta_total] = meta_total unless meta_total.nil?
|
|
39
|
-
|
|
40
|
-
opts[:filter_environment] =
|
|
43
|
+
resolved_environment = Smplkit::Audit.resolve_environment_filter(environments, @environment)
|
|
44
|
+
opts[:filter_environment] = resolved_environment if resolved_environment
|
|
41
45
|
|
|
42
46
|
resp = Smplkit::Audit.call_api { @api.list_resource_types(opts) }
|
|
43
47
|
rows = (resp.data || []).map { |r| ResourceType.from_resource(r) }
|
data/lib/smplkit/client.rb
CHANGED
|
@@ -124,9 +124,11 @@ module Smplkit
|
|
|
124
124
|
# borrows the shared logging transport and WebSocket. The two management
|
|
125
125
|
# sub-clients live at client.logging.loggers / client.logging.log_groups.
|
|
126
126
|
@logging = Logging::LoggingClient.new(parent: self, transport: @transports.logging_http, metrics: @metrics)
|
|
127
|
-
# Audit's full surface on one client; this runtime instance
|
|
128
|
-
# configured environment
|
|
129
|
-
#
|
|
127
|
+
# Audit's full surface on one client; this runtime instance scopes audit
|
|
128
|
+
# ops to the configured environment via the body-driven path (ADR-055):
|
|
129
|
+
# ``events.record`` stamps it on the event body and the read surfaces
|
|
130
|
+
# default ``filter[environment]`` to it. Owns its own transport (closed in
|
|
131
|
+
# ``close``).
|
|
130
132
|
@audit = Audit::AuditClient.new(
|
|
131
133
|
api_key: cfg.api_key, base_url: audit_url, environment: cfg.environment, extra_headers: extra_headers
|
|
132
134
|
)
|
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.
|
|
4
|
+
version: 3.0.102
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Smpl Solutions LLC
|
|
@@ -567,6 +567,7 @@ files:
|
|
|
567
567
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_attributes.rb
|
|
568
568
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_list_response.rb
|
|
569
569
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_resource.rb
|
|
570
|
+
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/retry_failed_deliveries_request.rb
|
|
570
571
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/retry_failed_deliveries_summary.rb
|
|
571
572
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/severity.rb
|
|
572
573
|
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/test_forwarder_request.rb
|
|
@@ -635,6 +636,7 @@ files:
|
|
|
635
636
|
- lib/smplkit/_generated/audit/spec/models/resource_type_attributes_spec.rb
|
|
636
637
|
- lib/smplkit/_generated/audit/spec/models/resource_type_list_response_spec.rb
|
|
637
638
|
- lib/smplkit/_generated/audit/spec/models/resource_type_resource_spec.rb
|
|
639
|
+
- lib/smplkit/_generated/audit/spec/models/retry_failed_deliveries_request_spec.rb
|
|
638
640
|
- lib/smplkit/_generated/audit/spec/models/retry_failed_deliveries_summary_spec.rb
|
|
639
641
|
- lib/smplkit/_generated/audit/spec/models/severity_spec.rb
|
|
640
642
|
- lib/smplkit/_generated/audit/spec/models/test_forwarder_request_spec.rb
|