Class: Datadog::AIGuard::Component
- Inherits:
-
Object
- Object
- Datadog::AIGuard::Component
- Defined in:
- lib/datadog/ai_guard/component.rb
Overview
Component for API Guard product
Instance Attribute Summary collapse
-
#api_client ⇒ Object
readonly
Returns the value of attribute api_client.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_client, logger:, telemetry:) ⇒ Component
constructor
A new instance of Component.
- #shutdown! ⇒ Object
Constructor Details
#initialize(api_client, logger:, telemetry:) ⇒ Component
Returns a new instance of Component.
31 32 33 34 35 |
# File 'lib/datadog/ai_guard/component.rb', line 31 def initialize(api_client, logger:, telemetry:) @api_client = api_client @logger = logger @telemetry = telemetry end |
Instance Attribute Details
#api_client ⇒ Object (readonly)
Returns the value of attribute api_client.
16 17 18 |
# File 'lib/datadog/ai_guard/component.rb', line 16 def api_client @api_client end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
16 17 18 |
# File 'lib/datadog/ai_guard/component.rb', line 16 def logger @logger end |
Class Method Details
.build(settings, logger:, telemetry:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/datadog/ai_guard/component.rb', line 18 def self.build(settings, logger:, telemetry:) return unless settings.respond_to?(:ai_guard) && settings.ai_guard.enabled api_client = APIClient.new( endpoint: settings.ai_guard.endpoint, api_key: settings.api_key, application_key: settings.ai_guard.app_key, timeout: settings.ai_guard.timeout_ms / 1_000 ) new(api_client, logger: logger, telemetry: telemetry) end |
Instance Method Details
#shutdown! ⇒ Object
37 38 39 |
# File 'lib/datadog/ai_guard/component.rb', line 37 def shutdown! # no-op end |