smplkit 3.0.59 → 3.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9567330aa922eab7f0af4eec8d511d5ec123a4dd4c8b1a8c8186e87eecc05337
4
- data.tar.gz: d120b23546fc8306431d13db81526b189f91b39fd9eb28448287e426fabb21a4
3
+ metadata.gz: 43242353842d4384ef5fee09749bb8030fe60d62ed0124a368694470adf7341c
4
+ data.tar.gz: 9149f6dd070aad95584fba15b9d7ced15b1e1103ef2a845d304854c03a51da6a
5
5
  SHA512:
6
- metadata.gz: 7a1d433f63c0d94067d36eeee48fcf0dd954a06c649e9a1288c9b37714df77ce713117229e5087f1a744593d44a02e13eeb1b4c16139f4b38327babfec2a9672
7
- data.tar.gz: e77a79352fe10237e44519648aaff78002ea0899eb39fd697758e8ea8a3a86e6f2e8956f0c887683a5c7aff3f0525c2052bd2709e8cac598cbd1a900f26ce169
6
+ metadata.gz: b8fa96a1fbaaf9e0c7d9c8b5d8064c31c9a1115714c3f3e5a5d4771664c3e3cf655b939b26b6fc90fc2166fd73d9b9c425a50bd47adadd98eac1cb21f9927bbb
7
+ data.tar.gz: 188a87a5c388d4ebc7277dcdef51633c01fc244e58c5bb53b560ee4d2a602afffc5128c079aa523b7a1135ca9fa831898be4861b8ab1736da84f29f9d3c0ec01
@@ -28,6 +28,12 @@ module SmplkitGeneratedClient::Audit
28
28
  # HTTP response status that indicates a successful delivery. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
29
29
  attr_accessor :success_status
30
30
 
31
+ # Whether to verify the destination server's TLS certificate against trusted certificate authorities. Defaults to `true` and should be left on for any production destination. Set to `false` only for development or short-lived testing against a destination that presents an untrusted certificate (e.g. a Splunk Cloud trial stack on `:8088` serving its default self-signed certificate). When `false`, deliveries proceed without certificate verification — they are vulnerable to man-in-the-middle attacks. For long-lived self-signed setups, pin the issuing CA via `ca_cert` instead of disabling verification entirely.
32
+ attr_accessor :tls_verify
33
+
34
+ # Optional PEM-encoded certificate (or bundle) used to verify the destination server's TLS certificate, in addition to the system trust store. Use this to pin a private or self-signed CA (e.g. Splunk's default `SplunkCommonCA`) without disabling verification entirely via `tls_verify`. Must contain one or more `-----BEGIN CERTIFICATE-----` blocks. Ignored when `tls_verify` is `false`.
35
+ attr_accessor :ca_cert
36
+
31
37
  class EnumAttributeValidator
32
38
  attr_reader :datatype
33
39
  attr_reader :allowable_values
@@ -56,7 +62,9 @@ module SmplkitGeneratedClient::Audit
56
62
  :'method' => :'method',
57
63
  :'url' => :'url',
58
64
  :'headers' => :'headers',
59
- :'success_status' => :'success_status'
65
+ :'success_status' => :'success_status',
66
+ :'tls_verify' => :'tls_verify',
67
+ :'ca_cert' => :'ca_cert'
60
68
  }
61
69
  end
62
70
 
@@ -76,13 +84,16 @@ module SmplkitGeneratedClient::Audit
76
84
  :'method' => :'String',
77
85
  :'url' => :'String',
78
86
  :'headers' => :'Array<HttpHeader>',
79
- :'success_status' => :'String'
87
+ :'success_status' => :'String',
88
+ :'tls_verify' => :'Boolean',
89
+ :'ca_cert' => :'String'
80
90
  }
81
91
  end
82
92
 
83
93
  # List of attributes with nullable: true
84
94
  def self.openapi_nullable
85
95
  Set.new([
96
+ :'ca_cert'
86
97
  ])
87
98
  end
88
99
 
@@ -125,6 +136,16 @@ module SmplkitGeneratedClient::Audit
125
136
  else
126
137
  self.success_status = '2xx'
127
138
  end
139
+
140
+ if attributes.key?(:'tls_verify')
141
+ self.tls_verify = attributes[:'tls_verify']
142
+ else
143
+ self.tls_verify = true
144
+ end
145
+
146
+ if attributes.key?(:'ca_cert')
147
+ self.ca_cert = attributes[:'ca_cert']
148
+ end
128
149
  end
129
150
 
130
151
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -148,6 +169,10 @@ module SmplkitGeneratedClient::Audit
148
169
  invalid_properties.push('invalid value for "success_status", the character length must be smaller than or equal to 3.')
149
170
  end
150
171
 
172
+ if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
173
+ invalid_properties.push('invalid value for "ca_cert", the character length must be smaller than or equal to 65536.')
174
+ end
175
+
151
176
  invalid_properties
152
177
  end
153
178
 
@@ -161,6 +186,7 @@ module SmplkitGeneratedClient::Audit
161
186
  return false if @url.to_s.length > 2048
162
187
  return false if @url.to_s.length < 1
163
188
  return false if !@success_status.nil? && @success_status.to_s.length > 3
189
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
164
190
  true
165
191
  end
166
192
 
@@ -206,6 +232,16 @@ module SmplkitGeneratedClient::Audit
206
232
  @success_status = success_status
207
233
  end
208
234
 
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] ca_cert Value to be assigned
237
+ def ca_cert=(ca_cert)
238
+ if !ca_cert.nil? && ca_cert.to_s.length > 65536
239
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be smaller than or equal to 65536.'
240
+ end
241
+
242
+ @ca_cert = ca_cert
243
+ end
244
+
209
245
  # Checks equality by comparing each attribute.
210
246
  # @param [Object] Object to be compared
211
247
  def ==(o)
@@ -214,7 +250,9 @@ module SmplkitGeneratedClient::Audit
214
250
  method == o.method &&
215
251
  url == o.url &&
216
252
  headers == o.headers &&
217
- success_status == o.success_status
253
+ success_status == o.success_status &&
254
+ tls_verify == o.tls_verify &&
255
+ ca_cert == o.ca_cert
218
256
  end
219
257
 
220
258
  # @see the `==` method
@@ -226,7 +264,7 @@ module SmplkitGeneratedClient::Audit
226
264
  # Calculates hash code according to all attributes.
227
265
  # @return [Integer] Hash code
228
266
  def hash
229
- [method, url, headers, success_status].hash
267
+ [method, url, headers, success_status, tls_verify, ca_cert].hash
230
268
  end
231
269
 
232
270
  # Builds the object from hash
@@ -31,6 +31,12 @@ module SmplkitGeneratedClient::Audit
31
31
  # Per-request timeout in milliseconds. Capped at 30 seconds.
32
32
  attr_accessor :timeout_ms
33
33
 
34
+ # Whether to verify the destination server's TLS certificate. Mirrors the parent forwarder field of the same name — see its description for security guidance. Defaults to `true`.
35
+ attr_accessor :tls_verify
36
+
37
+ # Optional PEM-encoded certificate (or bundle) used to verify the destination server's TLS certificate. Mirrors the parent forwarder field. Must contain one or more `-----BEGIN CERTIFICATE-----` blocks.
38
+ attr_accessor :ca_cert
39
+
34
40
  # Request body sent to the destination. When omitted, an empty body is sent (suitable for connectivity probes). When set, the body is sent verbatim — pair with an appropriate `Content-Type` entry in `headers` so the destination interprets it correctly. Limit 1 MiB.
35
41
  attr_accessor :body
36
42
 
@@ -64,6 +70,8 @@ module SmplkitGeneratedClient::Audit
64
70
  :'headers' => :'headers',
65
71
  :'success_status' => :'success_status',
66
72
  :'timeout_ms' => :'timeout_ms',
73
+ :'tls_verify' => :'tls_verify',
74
+ :'ca_cert' => :'ca_cert',
67
75
  :'body' => :'body'
68
76
  }
69
77
  end
@@ -86,6 +94,8 @@ module SmplkitGeneratedClient::Audit
86
94
  :'headers' => :'Array<HttpHeader>',
87
95
  :'success_status' => :'String',
88
96
  :'timeout_ms' => :'Integer',
97
+ :'tls_verify' => :'Boolean',
98
+ :'ca_cert' => :'String',
89
99
  :'body' => :'String'
90
100
  }
91
101
  end
@@ -94,6 +104,7 @@ module SmplkitGeneratedClient::Audit
94
104
  def self.openapi_nullable
95
105
  Set.new([
96
106
  :'timeout_ms',
107
+ :'ca_cert',
97
108
  :'body'
98
109
  ])
99
110
  end
@@ -142,6 +153,16 @@ module SmplkitGeneratedClient::Audit
142
153
  self.timeout_ms = attributes[:'timeout_ms']
143
154
  end
144
155
 
156
+ if attributes.key?(:'tls_verify')
157
+ self.tls_verify = attributes[:'tls_verify']
158
+ else
159
+ self.tls_verify = true
160
+ end
161
+
162
+ if attributes.key?(:'ca_cert')
163
+ self.ca_cert = attributes[:'ca_cert']
164
+ end
165
+
145
166
  if attributes.key?(:'body')
146
167
  self.body = attributes[:'body']
147
168
  end
@@ -176,6 +197,10 @@ module SmplkitGeneratedClient::Audit
176
197
  invalid_properties.push('invalid value for "timeout_ms", must be greater than or equal to 1.')
177
198
  end
178
199
 
200
+ if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
201
+ invalid_properties.push('invalid value for "ca_cert", the character length must be smaller than or equal to 65536.')
202
+ end
203
+
179
204
  if !@body.nil? && @body.to_s.length > 1048576
180
205
  invalid_properties.push('invalid value for "body", the character length must be smaller than or equal to 1048576.')
181
206
  end
@@ -195,6 +220,7 @@ module SmplkitGeneratedClient::Audit
195
220
  return false if !@success_status.nil? && @success_status.to_s.length > 3
196
221
  return false if !@timeout_ms.nil? && @timeout_ms > 30000
197
222
  return false if !@timeout_ms.nil? && @timeout_ms < 1
223
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
198
224
  return false if !@body.nil? && @body.to_s.length > 1048576
199
225
  true
200
226
  end
@@ -255,6 +281,16 @@ module SmplkitGeneratedClient::Audit
255
281
  @timeout_ms = timeout_ms
256
282
  end
257
283
 
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] ca_cert Value to be assigned
286
+ def ca_cert=(ca_cert)
287
+ if !ca_cert.nil? && ca_cert.to_s.length > 65536
288
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be smaller than or equal to 65536.'
289
+ end
290
+
291
+ @ca_cert = ca_cert
292
+ end
293
+
258
294
  # Custom attribute writer method with validation
259
295
  # @param [Object] body Value to be assigned
260
296
  def body=(body)
@@ -275,6 +311,8 @@ module SmplkitGeneratedClient::Audit
275
311
  headers == o.headers &&
276
312
  success_status == o.success_status &&
277
313
  timeout_ms == o.timeout_ms &&
314
+ tls_verify == o.tls_verify &&
315
+ ca_cert == o.ca_cert &&
278
316
  body == o.body
279
317
  end
280
318
 
@@ -287,7 +325,7 @@ module SmplkitGeneratedClient::Audit
287
325
  # Calculates hash code according to all attributes.
288
326
  # @return [Integer] Hash code
289
327
  def hash
290
- [method, url, headers, success_status, timeout_ms, body].hash
328
+ [method, url, headers, success_status, timeout_ms, tls_verify, ca_cert, body].hash
291
329
  end
292
330
 
293
331
  # Builds the object from hash
@@ -55,4 +55,16 @@ describe SmplkitGeneratedClient::Audit::HttpConfiguration do
55
55
  end
56
56
  end
57
57
 
58
+ describe 'test attribute "tls_verify"' do
59
+ it 'should work' do
60
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
61
+ end
62
+ end
63
+
64
+ describe 'test attribute "ca_cert"' do
65
+ it 'should work' do
66
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
67
+ end
68
+ end
69
+
58
70
  end
@@ -61,6 +61,18 @@ describe SmplkitGeneratedClient::Audit::TestForwarderRequest do
61
61
  end
62
62
  end
63
63
 
64
+ describe 'test attribute "tls_verify"' do
65
+ it 'should work' do
66
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
67
+ end
68
+ end
69
+
70
+ describe 'test attribute "ca_cert"' do
71
+ it 'should work' do
72
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
73
+ end
74
+ end
75
+
64
76
  describe 'test attribute "body"' do
65
77
  it 'should work' do
66
78
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -262,12 +262,32 @@ module Smplkit
262
262
  # @return [String] Status the destination must return for delivery to count
263
263
  # as success — an exact code (+"200"+, +"204"+) or a class (+"2xx"+, +"4xx"+).
264
264
  # Defaults to +"2xx"+.
265
+ # @!attribute [rw] tls_verify
266
+ # @return [Boolean] Whether to verify the destination's TLS certificate
267
+ # chain. Defaults to +true+; flip to +false+ only for short-lived
268
+ # testing against a destination that serves an untrusted certificate.
269
+ # Prefer pinning the issuing CA via +ca_cert+ for long-lived self-signed
270
+ # setups.
271
+ # @!attribute [rw] ca_cert
272
+ # @return [String, nil] Optional PEM-encoded certificate (or bundle)
273
+ # trusted in addition to the system CA store. Ignored when
274
+ # +tls_verify+ is +false+. +nil+ (the default) means "use system CAs
275
+ # only".
265
276
  #
266
277
  # rubocop:disable Lint/StructNewOverride -- ``:method`` matches the
267
278
  # API attribute and shadowing Struct#method is the expected ergonomics.
268
- HttpConfiguration = Struct.new(:method, :url, :headers, :success_status, keyword_init: true) do
269
- def initialize(method: HttpMethod::POST, url: "", headers: nil, success_status: "2xx")
270
- super(method: HttpMethod.coerce(method), url: url, headers: headers || [], success_status: success_status)
279
+ HttpConfiguration = Struct.new(
280
+ :method, :url, :headers, :success_status, :tls_verify, :ca_cert,
281
+ keyword_init: true
282
+ ) do
283
+ def initialize(
284
+ method: HttpMethod::POST, url: "", headers: nil,
285
+ success_status: "2xx", tls_verify: true, ca_cert: nil
286
+ )
287
+ super(
288
+ method: HttpMethod.coerce(method), url: url, headers: headers || [],
289
+ success_status: success_status, tls_verify: tls_verify, ca_cert: ca_cert
290
+ )
271
291
  end
272
292
 
273
293
  def self.to_wire(src)
@@ -284,18 +304,29 @@ module Smplkit
284
304
  end
285
305
  SmplkitGeneratedClient::Audit::HttpHeader.new(name: name, value: value)
286
306
  end,
287
- success_status: h.success_status
307
+ success_status: h.success_status,
308
+ tls_verify: h.tls_verify,
309
+ ca_cert: h.ca_cert
288
310
  )
289
311
  end
290
312
 
291
313
  def self.from_wire(src)
292
314
  return new if src.nil?
293
315
 
316
+ # Absent ``tls_verify`` on the wire means a forwarder persisted
317
+ # before the field landed — default to verifying so its prior
318
+ # secure behaviour is preserved.
294
319
  new(
295
320
  method: src.method || HttpMethod::POST,
296
321
  url: src.url || "",
297
322
  headers: (src.headers || []).map { |h| HttpHeader.new(name: h.name, value: h.value) },
298
- success_status: src.success_status || "2xx"
323
+ success_status: src.success_status || "2xx",
324
+ # rubocop:disable Style/RedundantCondition -- nil and false are
325
+ # distinct: nil means "field absent on the wire" (default to true);
326
+ # explicit false means "verification disabled".
327
+ tls_verify: src.tls_verify.nil? ? true : src.tls_verify,
328
+ # rubocop:enable Style/RedundantCondition
329
+ ca_cert: src.ca_cert
299
330
  )
300
331
  end
301
332
  end
@@ -311,7 +342,10 @@ module Smplkit
311
342
  # Re-supply real values before calling {#save}; the SDK does not cache
312
343
  # them client-side.
313
344
  class Forwarder
314
- # @return [String, nil] Server-assigned UUID, +nil+ until {#save} has run.
345
+ # @return [String, nil] Caller-supplied unique identifier (key) for this
346
+ # forwarder. Unique within an account; immutable for the lifetime of
347
+ # the forwarder. +nil+ only while the object represents an unsaved
348
+ # instance constructed without an id (which {#save} would then reject).
315
349
  attr_accessor :id
316
350
 
317
351
  # @return [String] Display name. Free-form.
@@ -56,13 +56,14 @@ module Smplkit
56
56
  # nil or both set, or when +transform_type+ is +JSONATA+ and +transform+
57
57
  # is not a +String+.
58
58
  # @return [Smplkit::Audit::Forwarder]
59
- def new_forwarder(name:, forwarder_type:, configuration:,
59
+ def new_forwarder(id, forwarder_type:, configuration:, name: nil,
60
60
  enabled: true, description: nil,
61
61
  filter: nil, transform: nil, transform_type: nil)
62
62
  Smplkit::Audit::Forwarder.send(:validate_transform_pair!, transform, transform_type)
63
63
  Smplkit::Audit::Forwarder.new(
64
64
  self,
65
- name: name,
65
+ id: id,
66
+ name: name || id,
66
67
  forwarder_type: forwarder_type,
67
68
  configuration: configuration,
68
69
  enabled: enabled,
@@ -118,7 +119,11 @@ module Smplkit
118
119
  # @api private — POST a new forwarder. Called by
119
120
  # {Smplkit::Audit::Forwarder#save} on unsaved instances.
120
121
  def _create_forwarder(forwarder)
121
- resp = Smplkit::Audit.call_api { @api.create_forwarder(build_body(forwarder)) }
122
+ if forwarder.id.nil? || forwarder.id.empty?
123
+ raise ArgumentError, "Forwarder.id is required on create (caller-supplied key)"
124
+ end
125
+
126
+ resp = Smplkit::Audit.call_api { @api.create_forwarder(build_create_body(forwarder)) }
122
127
  Smplkit::Audit::Forwarder.from_resource(resp.data, client: self)
123
128
  end
124
129
 
@@ -138,8 +143,8 @@ module Smplkit
138
143
 
139
144
  private
140
145
 
141
- def build_body(forwarder)
142
- attrs = SmplkitGeneratedClient::Audit::Forwarder.new(
146
+ def build_attrs(forwarder)
147
+ SmplkitGeneratedClient::Audit::Forwarder.new(
143
148
  name: forwarder.name,
144
149
  description: forwarder.description,
145
150
  forwarder_type: Smplkit::Audit::ForwarderType.coerce(forwarder.forwarder_type),
@@ -149,10 +154,26 @@ module Smplkit
149
154
  transform: forwarder.transform,
150
155
  configuration: Smplkit::Audit::HttpConfiguration.to_wire(forwarder.configuration)
151
156
  )
157
+ end
158
+
159
+ def build_create_body(forwarder)
160
+ # Create uses the distinct ForwarderCreateRequest envelope; the
161
+ # audit service requires data.id (the customer-supplied key) on
162
+ # create and 409s on conflict.
163
+ resource = SmplkitGeneratedClient::Audit::ForwarderCreateResource.new(
164
+ id: forwarder.id.to_s,
165
+ type: "forwarder",
166
+ attributes: build_attrs(forwarder)
167
+ )
168
+ SmplkitGeneratedClient::Audit::ForwarderCreateRequest.new(data: resource)
169
+ end
170
+
171
+ def build_body(forwarder)
172
+ # Update path uses the generic ForwarderRequest envelope.
152
173
  resource = SmplkitGeneratedClient::Audit::ForwarderResource.new(
153
- id: forwarder.id ? forwarder.id.to_s : "",
174
+ id: forwarder.id.to_s,
154
175
  type: "forwarder",
155
- attributes: attrs
176
+ attributes: build_attrs(forwarder)
156
177
  )
157
178
  SmplkitGeneratedClient::Audit::ForwarderRequest.new(data: resource)
158
179
  end
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.59
4
+ version: 3.0.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC