Module: Smplkit

Defined in:
lib/smplkit.rb,
lib/smplkit/ws.rb,
lib/smplkit/debug.rb,
lib/smplkit/client.rb,
lib/smplkit/errors.rb,
lib/smplkit/buffers.rb,
lib/smplkit/context.rb,
lib/smplkit/helpers.rb,
lib/smplkit/metrics.rb,
lib/smplkit/railtie.rb,
lib/smplkit/version.rb,
lib/smplkit/http_pool.rb,
lib/smplkit/log_level.rb,
lib/smplkit/transport.rb,
lib/smplkit/api_support.rb,
lib/smplkit/flags/types.rb,
lib/smplkit/jobs/client.rb,
lib/smplkit/jobs/models.rb,
lib/smplkit/audit/buffer.rb,
lib/smplkit/audit/client.rb,
lib/smplkit/audit/events.rb,
lib/smplkit/audit/models.rb,
lib/smplkit/flags/client.rb,
lib/smplkit/flags/models.rb,
lib/smplkit/config/client.rb,
lib/smplkit/config/models.rb,
lib/smplkit/flags/helpers.rb,
lib/smplkit/account/client.rb,
lib/smplkit/account/models.rb,
lib/smplkit/config/helpers.rb,
lib/smplkit/logging/client.rb,
lib/smplkit/logging/levels.rb,
lib/smplkit/logging/models.rb,
lib/smplkit/platform/types.rb,
lib/smplkit/logging/helpers.rb,
lib/smplkit/logging/sources.rb,
lib/smplkit/platform/client.rb,
lib/smplkit/platform/models.rb,
lib/smplkit/audit/categories.rb,
lib/smplkit/audit/forwarders.rb,
lib/smplkit/audit/event_types.rb,
lib/smplkit/config_resolution.rb,
lib/smplkit/logging/normalize.rb,
lib/smplkit/logging/resolution.rb,
lib/smplkit/audit/resource_types.rb,
lib/smplkit/logging/adapters/base.rb,
lib/smplkit/generators/install_generator.rb,
lib/smplkit/logging/adapters/stdlib_logger_adapter.rb,
lib/smplkit/logging/adapters/semantic_logger_adapter.rb,
sig/smplkit.rbs,
sig/smplkit/flags.rbs,
sig/smplkit/config.rbs,
sig/smplkit/logging.rbs,
sig/smplkit/management.rbs

Overview

SIEM forwarder CRUD for the Smpl Audit client.

Forwarders are part of the single unified audit surface — there is no runtime/management split for audit (see Smplkit::Audit::AuditClient). This file holds the forwarder CRUD sub-client that the unified AuditClient exposes as .forwarders:

  • ForwardersClientforwarders.new/get/list/save/delete

The forwarder model classes (+Forwarder+, ForwarderEnvironment, …) live in lib/smplkit/audit/models.rb.

Defined Under Namespace

Modules: Account, ApiSupport, Audit, Config, ConfigResolution, Debug, Errors, Flags, Generators, Helpers, HttpPool, Jobs, Logging, Management, Op, Platform, RequestContext, Transport Classes: ApiErrorDetail, Client, ConfigRegistrationBuffer, ConflictError, ConnectionError, Context, ContextRegistrationBuffer, ContextScope, Error, FlagDeclaration, FlagRegistrationBuffer, LogLevel, LoggerRegistrationBuffer, ManagementClient, MetricsReporter, NotFoundError, NotInstalledError, PaymentRequiredError, Railtie, Rule, SharedWebSocket, TimeoutError, ValidationError

Constant Summary collapse

CONTEXT_REGISTRATION_LRU_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

When the deduplication LRU exceeds this size, the oldest entry is evicted. The next observation of an evicted entry will re-flush.

10_000
CONTEXT_BATCH_FLUSH_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Pending-queue size that triggers an immediate background flush from inside register. The periodic timer on Client covers the tail case for low-traffic services.

100
FLAG_BATCH_FLUSH_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

50
LOGGER_BATCH_FLUSH_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

50
CONFIG_BATCH_FLUSH_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

50
VERSION =

Local-development fallback only. The canonical version of a published gem is stamped into the gem's build-time metadata from the release tag by the gemspec (see smplkit.gemspec); Smplkit.gem_version reads that metadata at runtime. This constant is used when the SDK runs from a source checkout that has no installed gem to consult.

Returns:

  • (String)
"0.0.0"
JobsClient =
Jobs::JobsClient
AuditClient =
Audit::AuditClient
FlagsClient =
Flags::FlagsClient
FlagValue =

Top-level re-exports for convenience.

Returns:

Flags::FlagValue
FlagRule =

Returns:

Flags::FlagRule
FlagEnvironment =

Returns:

Flags::FlagEnvironment
ConfigClient =
Config::ConfigClient
ConfigChangeEvent =
Config::ConfigChangeEvent
ConfigItem =

Top-level re-exports.

Returns:

Config::ConfigItem
ConfigEnvironment =

Returns:

Config::ConfigEnvironment
ItemType =

Returns:

Config::ItemType
AccountClient =
Account::AccountClient
LoggingClient =
Logging::LoggingClient
Color =

Returns:

Platform::Color
EnvironmentClassification =
Platform::EnvironmentClassification
LoggerSource =

Top-level re-export.

Returns:

Logging::LoggerSource
PlatformClient =
Platform::PlatformClient
LoggingAdapter =

Top-level re-export.

Returns:

Logging::Adapters::Base
StdlibLoggerAdapter =
Logging::Adapters::StdlibLoggerAdapter
SemanticLoggerAdapter =

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Returns the value of attribute client.



46
47
48
# File 'lib/smplkit/railtie.rb', line 46

def client
  @client
end

.context_providerObject

Returns the value of attribute context_provider.



46
47
48
# File 'lib/smplkit/railtie.rb', line 46

def context_provider
  @context_provider
end

Class Method Details

.configure_for_rails(options) ⇒ Client

Construct the global Smplkit.client from a Rails-friendly options struct. Falls back to SMPLKIT_* env vars + ~/.smplkit resolution for any field the customer left blank.

Parameters:

  • (Object)

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/smplkit/railtie.rb', line 29

def configure_for_rails(options)
  client = Client.new(
    api_key: options.api_key,
    environment: options.environment || (defined?(::Rails) ? ::Rails.env : nil),
    service: options.service,
    profile: options.profile,
    base_domain: options.base_domain,
    scheme: options.scheme,
    debug: options.debug,
    telemetry: options.telemetry
  )
  @client = client
  @context_provider = options.context_provider
  client
end

.debug(subsystem, message) ⇒ void

This method returns an undefined value.

Parameters:

  • (String)
  • (String)


43
44
45
# File 'lib/smplkit/debug.rb', line 43

def debug(subsystem, message)
  Debug.emit(subsystem, message)
end

.enable_debugvoid

This method returns an undefined value.



47
48
49
# File 'lib/smplkit/debug.rb', line 47

def enable_debug
  Debug.enable!
end

.gem_versionString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The version of the smplkit gem actually loaded, read from RubyGems package metadata.

The release workflow never rewrites VERSION above — the published version exists only in the git tag and, via the gemspec's build-time derivation, in the built gem's serialized specification. An installed gem therefore reports the real release version through Gem.loaded_specs, while a plain source checkout falls back to VERSION. The smplkit-sdk name is the ADR-046 §2.1 fallback gem name.

Returns:

  • (String)

    the loaded gem's version, or VERSION when the SDK is not running from an installed gem.



24
25
26
27
# File 'lib/smplkit/version.rb', line 24

def self.gem_version
  spec = Gem.loaded_specs["smplkit"] || Gem.loaded_specs["smplkit-sdk"]
  spec ? spec.version.to_s : VERSION
end

.request_contextArray[Context]

Returns:



65
66
67
# File 'lib/smplkit/context.rb', line 65

def request_context
  RequestContext.get
end

.set_request_context(contexts) ⇒ ContextScope

Parameters:

Returns:



60
61
62
63
# File 'lib/smplkit/context.rb', line 60

def set_request_context(contexts)
  previous = RequestContext.set(contexts)
  ContextScope.new(previous)
end

.user_agentString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The default User-Agent stamped on every outbound request (HTTP and the WebSocket handshake) when the caller has not supplied their own.

The platform sits behind a WAF that rejects requests carrying no User-Agent, and an SDK-identifying value keeps support/telemetry able to attribute traffic to an SDK and version in access logs.

Returns:

  • (String)

    smplkit-sdk-ruby/<version>



38
39
40
# File 'lib/smplkit/version.rb', line 38

def self.user_agent
  "smplkit-sdk-ruby/#{gem_version}"
end