smplkit 1.0.24 → 1.0.26

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: 716ac41c7f53fba00f896876246f36ca44e3db661aa3306d647675972edd64e9
4
- data.tar.gz: 96d4b2c60234daea039444a9e05ee9441adcf84bc99cd21b690fa504ab1b5ff8
3
+ metadata.gz: 7bdf868508ed91a94310a12e8341733ae453385e42104713e694c60641538bc1
4
+ data.tar.gz: 003c013da94f5776a03d32458704700bbca466b3b00c6b67b93971bba5e2f746
5
5
  SHA512:
6
- metadata.gz: 04dc39a5fdc6e5d809686e9d0b5fc8468771722ff4b50fd8cf644e9baa9be89815213facb0dee695c7d832c7d45c04f1090837300eddd3bb7e95020fa62a4900
7
- data.tar.gz: faf0afd4dc392a14c44fcf91d34d631f8c819aa85561296839246346ef429015df0fa16d5d6427f931da1ea2960b0177c45f07ff070b4299aa11282d878b759c
6
+ metadata.gz: a7aec9a8462b8c935bee1467149de3789d168f92fab61862b41ba36e4bded04b32f487110bc509033b77a39b01254c35cd5ed4d903d694d6b62d026d8975f4a9
7
+ data.tar.gz: 1a4cb3c19a8e58e51a0347d059825b0ff1fe9f9f90350f140cf7a68c2714107d4bcfdc2870b44ee2afd754c993e90454e41101fa046e277b30476952469479e9
@@ -217,7 +217,7 @@ module SmplkitGeneratedClient::Audit
217
217
  end
218
218
 
219
219
  # Get Forwarder
220
- # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller's account, including if the forwarder is soft-deleted. Header values in the response are always redacted regardless of caller permission.
220
+ # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller's account, including if the forwarder is soft-deleted. Header values in the response are returned in plaintext so callers can perform a GET-modify-PUT round-trip without re-entering secrets (ADR-014). The persisted ``forwarder_delivery.request`` log column is what keeps redaction; that read path is unaffected by this route.
221
221
  # @param forwarder_id [String]
222
222
  # @param [Hash] opts the optional parameters
223
223
  # @return [ForwarderResponse]
@@ -227,7 +227,7 @@ module SmplkitGeneratedClient::Audit
227
227
  end
228
228
 
229
229
  # Get Forwarder
230
- # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller's account, including if the forwarder is soft-deleted. Header values in the response are always redacted regardless of caller permission.
230
+ # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller's account, including if the forwarder is soft-deleted. Header values in the response are returned in plaintext so callers can perform a GET-modify-PUT round-trip without re-entering secrets (ADR-014). The persisted ``forwarder_delivery.request`` log column is what keeps redaction; that read path is unaffected by this route.
231
231
  # @param forwarder_id [String]
232
232
  # @param [Hash] opts the optional parameters
233
233
  # @return [Array<(ForwarderResponse, Integer, Hash)>] ForwarderResponse data, response status code and response headers
@@ -564,7 +564,7 @@ module SmplkitGeneratedClient::Audit
564
564
  end
565
565
 
566
566
  # Update Forwarder
567
- # Full-replace update. PUT semantics — every field is overwritten. The header values must be re-supplied; the GET path redacts them, but a PUT body that contains ``\"<redacted>\"`` would persist that literal. Customers must round-trip the actual secret back. This is the standard get-mutate-put pattern (see CLAUDE.md \"Updating Resources via the API\"); the SDK helpers track the un-redacted secret client-side so customers don't usually need to re-enter it.
567
+ # Full-replace update. PUT semantics — every field is overwritten. The GET path returns plaintext header values, so the standard get-mutate-put round-trip (ADR-014) preserves secrets without any extra work from the caller: GET, change one field, PUT the result.
568
568
  # @param forwarder_id [String]
569
569
  # @param forwarder_response [ForwarderResponse]
570
570
  # @param [Hash] opts the optional parameters
@@ -575,7 +575,7 @@ module SmplkitGeneratedClient::Audit
575
575
  end
576
576
 
577
577
  # Update Forwarder
578
- # Full-replace update. PUT semantics — every field is overwritten. The header values must be re-supplied; the GET path redacts them, but a PUT body that contains &#x60;&#x60;\&quot;&lt;redacted&gt;\&quot;&#x60;&#x60; would persist that literal. Customers must round-trip the actual secret back. This is the standard get-mutate-put pattern (see CLAUDE.md \&quot;Updating Resources via the API\&quot;); the SDK helpers track the un-redacted secret client-side so customers don&#39;t usually need to re-enter it.
578
+ # Full-replace update. PUT semantics — every field is overwritten. The GET path returns plaintext header values, so the standard get-mutate-put round-trip (ADR-014) preserves secrets without any extra work from the caller: GET, change one field, PUT the result.
579
579
  # @param forwarder_id [String]
580
580
  # @param forwarder_response [ForwarderResponse]
581
581
  # @param [Hash] opts the optional parameters
@@ -70,7 +70,7 @@ describe 'ForwardersApi' do
70
70
 
71
71
  # unit tests for get_forwarder
72
72
  # Get Forwarder
73
- # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller&#39;s account, including if the forwarder is soft-deleted. Header values in the response are always redacted regardless of caller permission.
73
+ # Retrieve a single forwarder by id. Returns 404 if no forwarder with that id exists in the caller&#39;s account, including if the forwarder is soft-deleted. Header values in the response are returned in plaintext so callers can perform a GET-modify-PUT round-trip without re-entering secrets (ADR-014). The persisted &#x60;&#x60;forwarder_delivery.request&#x60;&#x60; log column is what keeps redaction; that read path is unaffected by this route.
74
74
  # @param forwarder_id
75
75
  # @param [Hash] opts the optional parameters
76
76
  # @return [ForwarderResponse]
@@ -138,7 +138,7 @@ describe 'ForwardersApi' do
138
138
 
139
139
  # unit tests for update_forwarder
140
140
  # Update Forwarder
141
- # Full-replace update. PUT semantics — every field is overwritten. The header values must be re-supplied; the GET path redacts them, but a PUT body that contains &#x60;&#x60;\&quot;&lt;redacted&gt;\&quot;&#x60;&#x60; would persist that literal. Customers must round-trip the actual secret back. This is the standard get-mutate-put pattern (see CLAUDE.md \&quot;Updating Resources via the API\&quot;); the SDK helpers track the un-redacted secret client-side so customers don&#39;t usually need to re-enter it.
141
+ # Full-replace update. PUT semantics — every field is overwritten. The GET path returns plaintext header values, so the standard get-mutate-put round-trip (ADR-014) preserves secrets without any extra work from the caller: GET, change one field, PUT the result.
142
142
  # @param forwarder_id
143
143
  # @param forwarder_response
144
144
  # @param [Hash] opts the optional parameters
@@ -10,13 +10,19 @@ module Smplkit
10
10
  class AuditClient
11
11
  attr_reader :events, :forwarders, :functions
12
12
 
13
- def initialize(api_key:, base_url:, timeout: 10.0)
13
+ SDK_OWNED_HEADERS = %w[authorization content-type user-agent].freeze
14
+
15
+ def initialize(api_key:, base_url:, timeout: 10.0, extra_headers: nil)
14
16
  cfg = SmplkitGeneratedClient::Audit::Configuration.new
15
17
  cfg.host = URI.parse(base_url).host
16
18
  cfg.scheme = URI.parse(base_url).scheme
17
19
  cfg.access_token = api_key
18
20
  cfg.timeout = timeout
19
21
  api_client = SmplkitGeneratedClient::Audit::ApiClient.new(cfg)
22
+ api_client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
23
+ extra_headers&.each do |k, v|
24
+ api_client.default_headers[k] = v unless SDK_OWNED_HEADERS.include?(k.downcase)
25
+ end
20
26
  events_api = SmplkitGeneratedClient::Audit::EventsApi.new(api_client)
21
27
  forwarders_api = SmplkitGeneratedClient::Audit::ForwardersApi.new(api_client)
22
28
  @events = Events.new(events_api)
@@ -43,7 +43,8 @@ module Smplkit
43
43
  end
44
44
 
45
45
  def initialize(api_key: nil, environment: nil, service: nil, profile: nil, # rubocop:disable Metrics/AbcSize
46
- base_domain: nil, scheme: nil, debug: nil, telemetry: nil)
46
+ base_domain: nil, scheme: nil, debug: nil, telemetry: nil,
47
+ extra_headers: nil)
47
48
  cfg = ConfigResolution.resolve_config(
48
49
  profile: profile, api_key: api_key, base_domain: base_domain, scheme: scheme,
49
50
  environment: environment, service: service, debug: debug, telemetry: telemetry
@@ -67,7 +68,8 @@ module Smplkit
67
68
  mgmt_cfg = ConfigResolution::ResolvedManagementConfig.new(
68
69
  api_key: cfg.api_key, base_domain: cfg.base_domain, scheme: cfg.scheme, debug: cfg.debug
69
70
  )
70
- @manage = ManagementClient.from_resolved(mgmt_cfg)
71
+ @extra_headers = extra_headers
72
+ @manage = ManagementClient.from_resolved(mgmt_cfg, extra_headers: extra_headers)
71
73
 
72
74
  app_url = ConfigResolution.service_url(cfg.scheme, "app", cfg.base_domain)
73
75
  flags_url = ConfigResolution.service_url(cfg.scheme, "flags", cfg.base_domain)
@@ -87,7 +89,8 @@ module Smplkit
87
89
  flags_base_url: flags_url, app_base_url: app_url)
88
90
  @logging = Logging::LoggingClient.new(self, manage: @manage, metrics: @metrics,
89
91
  logging_base_url: logging_url, app_base_url: app_url)
90
- @audit = Audit::AuditClient.new(api_key: cfg.api_key, base_url: audit_url)
92
+ @audit = Audit::AuditClient.new(api_key: cfg.api_key, base_url: audit_url,
93
+ extra_headers: extra_headers)
91
94
 
92
95
  @closed = false
93
96
  schedule_periodic_flush
@@ -170,6 +173,7 @@ module Smplkit
170
173
  def _api_key = @api_key
171
174
  def _app_base_url = @app_base_url
172
175
  def _metrics = @metrics
176
+ def _extra_headers = @extra_headers
173
177
 
174
178
  def _ensure_ws
175
179
  @_ensure_ws ||= begin
@@ -30,12 +30,12 @@ module Smplkit
30
30
  attr_reader :contexts, :context_types, :environments, :account_settings,
31
31
  :config, :flags, :loggers, :log_groups
32
32
 
33
- def self.from_resolved(resolved)
34
- new(_resolved: resolved)
33
+ def self.from_resolved(resolved, extra_headers: nil)
34
+ new(_resolved: resolved, extra_headers: extra_headers)
35
35
  end
36
36
 
37
37
  def initialize(api_key: nil, base_domain: nil, scheme: nil, profile: nil,
38
- debug: nil, _resolved: nil)
38
+ debug: nil, _resolved: nil, extra_headers: nil)
39
39
  cfg = _resolved ||
40
40
  ConfigResolution.resolve_management_config(
41
41
  api_key: api_key, base_domain: base_domain, scheme: scheme,
@@ -45,6 +45,7 @@ module Smplkit
45
45
 
46
46
  @resolved = cfg
47
47
 
48
+ @extra_headers = extra_headers
48
49
  @app_api_client = build_api_client(SmplkitGeneratedClient::App, "app", cfg)
49
50
  @config_api_client = build_api_client(SmplkitGeneratedClient::Config, "config", cfg)
50
51
  @flags_api_client = build_api_client(SmplkitGeneratedClient::Flags, "flags", cfg)
@@ -71,6 +72,8 @@ module Smplkit
71
72
  def _flags_http = @flags_api_client
72
73
  def _logging_http = @logging_api_client
73
74
 
75
+ SDK_OWNED_HEADERS = %w[authorization content-type user-agent].freeze
76
+
74
77
  private
75
78
 
76
79
  def build_api_client(generated_module, subdomain, cfg)
@@ -82,6 +85,9 @@ module Smplkit
82
85
  configuration.debugging = cfg.debug
83
86
  generated_module::ApiClient.new(configuration).tap do |client|
84
87
  client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
88
+ @extra_headers&.each do |k, v|
89
+ client.default_headers[k] = v unless SDK_OWNED_HEADERS.include?(k.downcase)
90
+ end
85
91
  end
86
92
  end
87
93
 
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: 1.0.24
4
+ version: 1.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC