Class: Smplkit::Audit::AuditClient

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/audit/client.rb

Overview

Audit-product entry point — accessed via client.audit.

Owns event recording and read-side queries: fire-and-forget #events.record, plus the audit-log list / get and the distinct-value listings that back the Activity tab filter dropdowns. ADR-047 §2.7.

SIEM forwarder CRUD lives on ManagementClient under mgmt.audit.forwarders.*.

Constant Summary collapse

SDK_OWNED_HEADERS =
%w[authorization content-type user-agent].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, base_url:, timeout: 10.0, extra_headers: nil) ⇒ AuditClient

Returns a new instance of AuditClient.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/smplkit/audit/client.rb', line 19

def initialize(api_key:, base_url:, timeout: 10.0, extra_headers: nil)
  cfg = SmplkitGeneratedClient::Audit::Configuration.new
  cfg.host = URI.parse(base_url).host
  cfg.scheme = URI.parse(base_url).scheme
  cfg.access_token = api_key
  cfg.timeout = timeout
  api_client = SmplkitGeneratedClient::Audit::ApiClient.new(cfg)
  api_client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
  extra_headers&.each do |k, v|
    api_client.default_headers[k] = v unless SDK_OWNED_HEADERS.include?(k.downcase)
  end
  @events = Events.new(SmplkitGeneratedClient::Audit::EventsApi.new(api_client))
  @resource_types = ResourceTypes.new(SmplkitGeneratedClient::Audit::ResourceTypesApi.new(api_client))
  @actions = Actions.new(SmplkitGeneratedClient::Audit::ActionsApi.new(api_client))
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



15
16
17
# File 'lib/smplkit/audit/client.rb', line 15

def actions
  @actions
end

#eventsObject (readonly)

Returns the value of attribute events.



15
16
17
# File 'lib/smplkit/audit/client.rb', line 15

def events
  @events
end

#resource_typesObject (readonly)

Returns the value of attribute resource_types.



15
16
17
# File 'lib/smplkit/audit/client.rb', line 15

def resource_types
  @resource_types
end

Instance Method Details

#_closeObject



35
36
37
# File 'lib/smplkit/audit/client.rb', line 35

def _close
  @events._close
end