smplkit 3.0.122 → 3.0.123

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 (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb +5 -17
  3. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/{http_configuration.rb → forwarder_http_configuration.rb} +7 -7
  4. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/test_forwarder_request.rb +3 -3
  5. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client.rb +1 -3
  6. data/lib/smplkit/_generated/audit/spec/models/{http_configuration_spec.rb → forwarder_http_configuration_spec.rb} +6 -6
  7. data/lib/smplkit/_generated/audit/spec/models/forwarder_spec.rb +0 -6
  8. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +2 -2
  9. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_http_configuration.rb +4 -4
  10. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +0 -2
  11. data/lib/smplkit/audit/forwarders.rb +18 -24
  12. data/lib/smplkit/audit/models.rb +175 -103
  13. data/lib/smplkit/jobs/client.rb +21 -26
  14. data/lib/smplkit/jobs/models.rb +233 -273
  15. metadata +3 -11
  16. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder_environment.rb +0 -162
  17. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/http_header.rb +0 -220
  18. data/lib/smplkit/_generated/audit/spec/models/forwarder_environment_spec.rb +0 -42
  19. data/lib/smplkit/_generated/audit/spec/models/http_header_spec.rb +0 -42
  20. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/http_header.rb +0 -220
  21. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_environment.rb +0 -206
  22. data/lib/smplkit/_generated/jobs/spec/models/http_header_spec.rb +0 -42
  23. data/lib/smplkit/_generated/jobs/spec/models/job_environment_spec.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 032aaefb0a2a4bddff31f0d49789a1acf9a13f6b13aec6a6ba2669fd8ab03ebf
4
- data.tar.gz: a0dfadc1df2957115ce1aec553e1f6f4efd0c69a435014a10a3c2b9301746990
3
+ metadata.gz: 2e34faeddba61d519c038ddbdfa67a966428a8abde386af2faed155fd98dfb22
4
+ data.tar.gz: 3bfaa6bbe205fdc5a3e9427228e95545b1af057d8ff8c50f5e0dc0f8649e5131
5
5
  SHA512:
6
- metadata.gz: 567080f84a1b30df90fa3a0d814a33bdb5424e3033f98529947cfe61832636120247c98d93057e653fa02e6c11af662aefadd4f311e003635aaeb4a76a2bdf37
7
- data.tar.gz: 242f57632778e8e401cec809b834f96272f70488616b201567665b27d48514c0fa66aa35c67be0061a8af8dcba1979d0b8bf545661a62c348dfee7cc01b5cf41
6
+ metadata.gz: b99d22b368a343511b45936b3a6c113bd86550eea77076a68bde20782139f2cd1ebc659f5b0260475e87ce7f1d631b1149556106c4d02a0ad6d344d6acf9dd3c
7
+ data.tar.gz: d1c8337f22b5dc95791bfa5474fc288fbffc207b62058b7ad4465b86429246e39de6d871cbd3f7207f8122826bfc7bd5078b76becb5e20db60e0e3c08008c701
@@ -25,9 +25,6 @@ module SmplkitGeneratedClient::Audit
25
25
  # Destination type.
26
26
  attr_accessor :forwarder_type
27
27
 
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
- attr_accessor :enabled
30
-
31
28
  # When true, this forwarder also receives platform change events that smplkit records about your own resources (flag, configuration, and similar changes). Each such event is delivered through every environment this forwarder is enabled in, using that environment's resolved configuration. Defaults to false — platform change events are not forwarded unless you opt in. Independent of the per-environment `enabled` settings, since platform change events are not tied to a deployment environment.
32
29
  attr_accessor :forward_smplkit_events
33
30
 
@@ -40,10 +37,10 @@ module SmplkitGeneratedClient::Audit
40
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.
41
38
  attr_accessor :transform
42
39
 
43
- # 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.
40
+ # Base delivery configuration template. Shape is discriminated by ``forwarder_type``; today all destination types deliver over HTTP. 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 entry in `environments` overrides individual fields of this template for that environment; fields it omits are inherited from here.
44
41
  attr_accessor :configuration
45
42
 
46
- # 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.
43
+ # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry is a sparse map of only the fields that differ in that environment: `enabled` (whether the forwarder delivers there) plus any of `url`, `method`, `success_status`, `tls_verify`, `ca_cert`, and individual headers as `headers.<name>` (e.g. `headers.Authorization`). Fields you omit are inherited from the base `configuration`; an entry never needs to repeat the whole configuration. A forwarder with no entry for an environment is disabled there. Every referenced environment must exist and be managed for the account.
47
44
  attr_accessor :environments
48
45
 
49
46
  # When the forwarder was created.
@@ -86,7 +83,6 @@ module SmplkitGeneratedClient::Audit
86
83
  :'name' => :'name',
87
84
  :'description' => :'description',
88
85
  :'forwarder_type' => :'forwarder_type',
89
- :'enabled' => :'enabled',
90
86
  :'forward_smplkit_events' => :'forward_smplkit_events',
91
87
  :'filter' => :'filter',
92
88
  :'transform_type' => :'transform_type',
@@ -116,13 +112,12 @@ module SmplkitGeneratedClient::Audit
116
112
  :'name' => :'String',
117
113
  :'description' => :'String',
118
114
  :'forwarder_type' => :'ForwarderType',
119
- :'enabled' => :'Boolean',
120
115
  :'forward_smplkit_events' => :'Boolean',
121
116
  :'filter' => :'Hash<String, Object>',
122
117
  :'transform_type' => :'String',
123
118
  :'transform' => :'Object',
124
- :'configuration' => :'HttpConfiguration',
125
- :'environments' => :'Hash<String, ForwarderEnvironment>',
119
+ :'configuration' => :'ForwarderHttpConfiguration',
120
+ :'environments' => :'Hash<String, Hash<String, Object>>',
126
121
  :'created_at' => :'Time',
127
122
  :'updated_at' => :'Time',
128
123
  :'deleted_at' => :'Time',
@@ -176,12 +171,6 @@ module SmplkitGeneratedClient::Audit
176
171
  self.forwarder_type = nil
177
172
  end
178
173
 
179
- if attributes.key?(:'enabled')
180
- self.enabled = attributes[:'enabled']
181
- else
182
- self.enabled = false
183
- end
184
-
185
174
  if attributes.key?(:'forward_smplkit_events')
186
175
  self.forward_smplkit_events = attributes[:'forward_smplkit_events']
187
176
  else
@@ -344,7 +333,6 @@ module SmplkitGeneratedClient::Audit
344
333
  name == o.name &&
345
334
  description == o.description &&
346
335
  forwarder_type == o.forwarder_type &&
347
- enabled == o.enabled &&
348
336
  forward_smplkit_events == o.forward_smplkit_events &&
349
337
  filter == o.filter &&
350
338
  transform_type == o.transform_type &&
@@ -366,7 +354,7 @@ module SmplkitGeneratedClient::Audit
366
354
  # Calculates hash code according to all attributes.
367
355
  # @return [Integer] Hash code
368
356
  def hash
369
- [name, description, forwarder_type, enabled, forward_smplkit_events, filter, transform_type, transform, configuration, environments, created_at, updated_at, deleted_at, version].hash
357
+ [name, description, forwarder_type, forward_smplkit_events, filter, transform_type, transform, configuration, environments, created_at, updated_at, deleted_at, version].hash
370
358
  end
371
359
 
372
360
  # Builds the object from hash
@@ -14,15 +14,15 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Audit
17
- # HTTP request configuration for delivering a payload to a destination. The shared base shape for any product that posts to a customer-supplied HTTP destination. Smpl Audit forwarders use it directly; Smpl Jobs extends it (adding ``body`` and ``timeout``). When other transports land (``FTP``, ``SQS``, …) their own configuration schemas will join this one as members of a discriminated union under a ``configuration`` field.
18
- class HttpConfiguration < ApiModelBase
17
+ # HTTP request a forwarder makes to deliver an event. Identical to the shared HTTP configuration except that ``headers`` is a name→value object so an individual header can be overridden per environment by its name.
18
+ class ForwarderHttpConfiguration < ApiModelBase
19
19
  # HTTP method used when delivering the request.
20
20
  attr_accessor :method
21
21
 
22
22
  # Destination URL. Must be an absolute `http://` or `https://` URL with a hostname (e.g. `https://siem.example.com/in`).
23
23
  attr_accessor :url
24
24
 
25
- # HTTP headers attached to each request.
25
+ # HTTP headers attached to each delivery, as a name→value object (e.g. `{\"DD-API-KEY\": \"s3cr3t\"}`). A header is overridden in a specific environment by its name via a `headers.<name>` entry in that environment's overrides; header names match case-insensitively.
26
26
  attr_accessor :headers
27
27
 
28
28
  # HTTP response status that indicates success. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
@@ -83,7 +83,7 @@ module SmplkitGeneratedClient::Audit
83
83
  {
84
84
  :'method' => :'String',
85
85
  :'url' => :'String',
86
- :'headers' => :'Array<HttpHeader>',
86
+ :'headers' => :'Hash<String, String>',
87
87
  :'success_status' => :'String',
88
88
  :'tls_verify' => :'Boolean',
89
89
  :'ca_cert' => :'String'
@@ -101,14 +101,14 @@ module SmplkitGeneratedClient::Audit
101
101
  # @param [Hash] attributes Model attributes in the form of hash
102
102
  def initialize(attributes = {})
103
103
  if (!attributes.is_a?(Hash))
104
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::HttpConfiguration` initialize method"
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration` initialize method"
105
105
  end
106
106
 
107
107
  # check to see if the attribute exists and convert string to symbol for hash key
108
108
  acceptable_attribute_map = self.class.acceptable_attribute_map
109
109
  attributes = attributes.each_with_object({}) { |(k, v), h|
110
110
  if (!acceptable_attribute_map.key?(k.to_sym))
111
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::HttpConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
112
  end
113
113
  h[k.to_sym] = v
114
114
  }
@@ -126,7 +126,7 @@ module SmplkitGeneratedClient::Audit
126
126
  end
127
127
 
128
128
  if attributes.key?(:'headers')
129
- if (value = attributes[:'headers']).is_a?(Array)
129
+ if (value = attributes[:'headers']).is_a?(Hash)
130
130
  self.headers = value
131
131
  end
132
132
  end
@@ -22,7 +22,7 @@ module SmplkitGeneratedClient::Audit
22
22
  # Destination URL. Must be an absolute `http://` or `https://` URL with a hostname (e.g. `https://siem.example.com/in`).
23
23
  attr_accessor :url
24
24
 
25
- # HTTP headers attached to the test request.
25
+ # HTTP headers attached to the test request, as a name→value object (e.g. `{\"Authorization\": \"Bearer s3cr3t\"}`).
26
26
  attr_accessor :headers
27
27
 
28
28
  # HTTP response status that indicates success. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
@@ -91,7 +91,7 @@ module SmplkitGeneratedClient::Audit
91
91
  {
92
92
  :'method' => :'String',
93
93
  :'url' => :'String',
94
- :'headers' => :'Array<HttpHeader>',
94
+ :'headers' => :'Hash<String, String>',
95
95
  :'success_status' => :'String',
96
96
  :'timeout_ms' => :'Integer',
97
97
  :'tls_verify' => :'Boolean',
@@ -138,7 +138,7 @@ module SmplkitGeneratedClient::Audit
138
138
  end
139
139
 
140
140
  if attributes.key?(:'headers')
141
- if (value = attributes[:'headers']).is_a?(Array)
141
+ if (value = attributes[:'headers']).is_a?(Hash)
142
142
  self.headers = value
143
143
  end
144
144
  end
@@ -49,7 +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
+ require 'smplkit_audit_client/models/forwarder_http_configuration'
53
53
  require 'smplkit_audit_client/models/forwarder_list_response'
54
54
  require 'smplkit_audit_client/models/forwarder_request'
55
55
  require 'smplkit_audit_client/models/forwarder_resource'
@@ -63,8 +63,6 @@ require 'smplkit_audit_client/models/forwarder_type_placeholder'
63
63
  require 'smplkit_audit_client/models/forwarder_type_resource'
64
64
  require 'smplkit_audit_client/models/forwarder_type_response'
65
65
  require 'smplkit_audit_client/models/forwarder_type_transform'
66
- require 'smplkit_audit_client/models/http_configuration'
67
- require 'smplkit_audit_client/models/http_header'
68
66
  require 'smplkit_audit_client/models/list_meta'
69
67
  require 'smplkit_audit_client/models/pagination_meta'
70
68
  require 'smplkit_audit_client/models/resource_type_attributes'
@@ -14,16 +14,16 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for SmplkitGeneratedClient::Audit::HttpConfiguration
17
+ # Unit tests for SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe SmplkitGeneratedClient::Audit::HttpConfiguration do
21
- #let(:instance) { SmplkitGeneratedClient::Audit::HttpConfiguration.new }
20
+ describe SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration do
21
+ #let(:instance) { SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration.new }
22
22
 
23
- describe 'test an instance of HttpConfiguration' do
24
- it 'should create an instance of HttpConfiguration' do
23
+ describe 'test an instance of ForwarderHttpConfiguration' do
24
+ it 'should create an instance of ForwarderHttpConfiguration' do
25
25
  # uncomment below to test the instance creation
26
- #expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::HttpConfiguration)
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::Audit::ForwarderHttpConfiguration)
27
27
  end
28
28
  end
29
29
 
@@ -45,12 +45,6 @@ describe SmplkitGeneratedClient::Audit::Forwarder do
45
45
  end
46
46
  end
47
47
 
48
- describe 'test attribute "enabled"' do
49
- it 'should work' do
50
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
- end
52
- end
53
-
54
48
  describe 'test attribute "forward_smplkit_events"' do
55
49
  it 'should work' do
56
50
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -34,7 +34,7 @@ module SmplkitGeneratedClient::Jobs
34
34
  # The HTTP request to perform, including method, url, headers, body, and timeout.
35
35
  attr_accessor :configuration
36
36
 
37
- # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry sets `enabled` (whether the job is enabled scheduled, for a recurring job, or triggerable, for a manual job in that environment), an optional `schedule` override (a cron expression for recurring jobs; omit to inherit the base `schedule`), an optional `timezone` override (an IANA zone for recurring jobs; omit to inherit the base `timezone`, else UTC), and an optional `configuration` override (omit to inherit the base `configuration`); it also reports the read-only `next_run_at` for that environment. A job with no entry for an environment is disabled there. For a recurring or manual job, supply this map to choose where it runs. For a one-off job, the environment it is created in is recorded here automatically — name it with the `X-Smplkit-Environment` header. Every referenced environment must exist for the account.
37
+ # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry is a flat, sparse overlay: only the leaves that differ from the base definition are present, and everything absent is inherited. Set `enabled` to `true` to run the job in that environment (the base is disabled everywhere; an environment with no entry, or an entry without `enabled: true`, does not run). Overridable leaves are `url`, `method`, `timeout`, `body`, `success_status`, `tls_verify`, `ca_cert`, `schedule` and `timezone` (recurring jobs only), `retry_policy` (the `id` of a retry policy, or `Default`), and an individual header as `headers.<name>` (e.g. `headers.Authorization`). On read, each entry also reports the read-only `next_run_at` for that environment (the next fire time, or `null`). For a recurring or manual job, supply this map to choose where it runs. For a one-off job, the environment it is created in is recorded here automatically — name it with the `X-Smplkit-Environment` header. Every referenced environment must exist for the account.
38
38
  attr_accessor :environments
39
39
 
40
40
  # How overlapping runs are handled. `ALLOW` (the only value today) permits them.
@@ -119,7 +119,7 @@ module SmplkitGeneratedClient::Jobs
119
119
  :'schedule' => :'String',
120
120
  :'timezone' => :'String',
121
121
  :'configuration' => :'JobHttpConfiguration',
122
- :'environments' => :'Hash<String, JobEnvironment>',
122
+ :'environments' => :'Hash<String, Hash<String, Object>>',
123
123
  :'concurrency_policy' => :'String',
124
124
  :'retry_policy' => :'String',
125
125
  :'kind' => :'String',
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Jobs
17
- # HTTP request a job performs when it fires. Extends the shared forwarder configuration with the two fields a scheduled job needs beyond a forwarder.
17
+ # HTTP request a job performs when it fires. Extends the shared forwarder configuration with the two fields a scheduled job needs beyond a forwarder, and represents headers as a name→value object so an individual header can be overridden per environment by its name.
18
18
  class JobHttpConfiguration < ApiModelBase
19
19
  # HTTP method used when delivering the request.
20
20
  attr_accessor :method
@@ -22,7 +22,7 @@ module SmplkitGeneratedClient::Jobs
22
22
  # Destination URL. Must be an absolute `http://` or `https://` URL with a hostname (e.g. `https://siem.example.com/in`).
23
23
  attr_accessor :url
24
24
 
25
- # HTTP headers attached to each request.
25
+ # HTTP headers sent on each request, as a name→value object (e.g. `{\"Authorization\": \"Bearer s3cr3t\"}`). A header is overridden per environment by its name via a `headers.<name>` entry in that environment's overrides; header names match case-insensitively.
26
26
  attr_accessor :headers
27
27
 
28
28
  # HTTP response status that indicates success. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
@@ -91,7 +91,7 @@ module SmplkitGeneratedClient::Jobs
91
91
  {
92
92
  :'method' => :'String',
93
93
  :'url' => :'String',
94
- :'headers' => :'Array<HttpHeader>',
94
+ :'headers' => :'Hash<String, String>',
95
95
  :'success_status' => :'String',
96
96
  :'tls_verify' => :'Boolean',
97
97
  :'ca_cert' => :'String',
@@ -137,7 +137,7 @@ module SmplkitGeneratedClient::Jobs
137
137
  end
138
138
 
139
139
  if attributes.key?(:'headers')
140
- if (value = attributes[:'headers']).is_a?(Array)
140
+ if (value = attributes[:'headers']).is_a?(Hash)
141
141
  self.headers = value
142
142
  end
143
143
  end
@@ -20,11 +20,9 @@ require 'smplkit_jobs_client/configuration'
20
20
  # Models
21
21
  require 'smplkit_jobs_client/models/error'
22
22
  require 'smplkit_jobs_client/models/error_response'
23
- require 'smplkit_jobs_client/models/http_header'
24
23
  require 'smplkit_jobs_client/models/job'
25
24
  require 'smplkit_jobs_client/models/job_create_request'
26
25
  require 'smplkit_jobs_client/models/job_create_resource'
27
- require 'smplkit_jobs_client/models/job_environment'
28
26
  require 'smplkit_jobs_client/models/job_http_configuration'
29
27
  require 'smplkit_jobs_client/models/job_list_response'
30
28
  require 'smplkit_jobs_client/models/job_request'
@@ -38,13 +38,15 @@ module Smplkit
38
38
  # returned in plaintext on reads, so a get-mutate-put round-trip
39
39
  # preserves them without re-entering secrets.
40
40
  # @param environments [Hash{String => Smplkit::Audit::ForwarderEnvironment, Hash}, nil]
41
- # Per-environment overrides keyed by environment key (e.g.
41
+ # Per-environment sparse overrides keyed by environment key (e.g.
42
42
  # +"production"+). A forwarder delivers in an environment only when that
43
43
  # environment's entry has +enabled: true+. Values may be
44
- # {Smplkit::Audit::ForwarderEnvironment} instances or plain hashes
45
- # (+{ enabled: true }+, optionally with a +:configuration+
46
- # {Smplkit::Audit::HttpConfiguration} override). Omit to create a
47
- # forwarder that delivers nowhere until enabled per environment.
44
+ # {Smplkit::Audit::ForwarderEnvironment} instances or plain hashes of its
45
+ # constructor kwargs (+{ enabled: true }+, optionally with request leaves
46
+ # like +:url+ and a +:headers+ name→value map); each entry overrides only
47
+ # the leaves it sets, inheriting the base +configuration+ for the rest.
48
+ # Omit to create a forwarder that delivers nowhere until enabled per
49
+ # environment.
48
50
  # @param description [String, nil] Optional free-text description.
49
51
  # @param forward_smplkit_events [Boolean] When +true+, the forwarder also
50
52
  # receives platform change events that smplkit records about the
@@ -162,34 +164,26 @@ module Smplkit
162
164
  # Coerce a caller's +environments+ map to wrapper instances.
163
165
  #
164
166
  # Accepts either {Smplkit::Audit::ForwarderEnvironment} values or plain
165
- # hashes (+{ enabled: true, configuration: HttpConfiguration.new(...) }+)
166
- # so callers can use the lightweight hash form without importing the model.
167
+ # hashes of its constructor kwargs (+{ enabled: true, url: "https://...",
168
+ # headers: { "DD-API-KEY" => "x" } }+) so callers can use the lightweight
169
+ # hash form without importing the model. Both symbol- and string-keyed
170
+ # hashes work.
167
171
  def normalize_environments(environments)
168
172
  return {} if environments.nil? || environments.empty?
169
173
 
170
174
  environments.each_with_object({}) do |(env_key, value), out|
171
- out[env_key.to_s] = if value.is_a?(ForwarderEnvironment)
172
- value
173
- else
174
- ForwarderEnvironment.new(
175
- enabled: value[:enabled] || value["enabled"] || false,
176
- configuration: value[:configuration] || value["configuration"]
177
- )
178
- end
175
+ out[env_key.to_s] =
176
+ value.is_a?(ForwarderEnvironment) ? value : ForwarderEnvironment.new(**value.transform_keys(&:to_sym))
179
177
  end
180
178
  end
181
179
 
182
- # Convert the wrapper +environments+ map to the generated model hash.
183
- #
184
- # Per-environment +configuration+ overrides are sent as full
185
- # {Smplkit::Audit::HttpConfiguration} payloads (plaintext headers in),
186
- # mirroring the base configuration's round-trip semantics.
180
+ # Convert the wrapper +environments+ map to the flat per-environment overlay
181
+ # the generated +Forwarder+ model carries (ADR-056). Each value is the
182
+ # environment's sparse leaf-path overlay: +enabled+ plus only the leaves it
183
+ # overrides, with each header as a +headers.<name>+ leaf.
187
184
  def environments_to_wire(environments)
188
185
  (environments || {}).each_with_object({}) do |(env_key, env), out|
189
- out[env_key.to_s] = SmplkitGeneratedClient::Audit::ForwarderEnvironment.new(
190
- enabled: env.enabled,
191
- configuration: env.configuration.nil? ? nil : HttpConfiguration.to_wire(env.configuration)
192
- )
186
+ out[env_key.to_s] = env.to_payload
193
187
  end
194
188
  end
195
189