Class: AWSCDK::BedrockAgentCore::DataSourceConfig

Inherits:
Jsii::Object
  • Object
show all
Defined in:
bedrock_agent_core/data_source_config.rb

Overview

Configuration for the data source used in online evaluation.

Use the static factory methods to create data source configurations:

  • DataSourceConfig.fromAgentRuntimeEndpoint() for AgentCore Runtime (recommended)
  • DataSourceConfig.fromAgentRuntimeEndpointName() for AgentCore Runtime using endpoint name string
  • DataSourceConfig.fromCloudWatchLogs() for external agents or custom log groups

Examples:

# CloudWatch Logs data source (for external agents)
data_source = AWSCDK::BedrockAgentCore::DataSourceConfig.from_cloud_watch_logs({
    log_group_names: ["/aws/my-external-agent/logs"],
    service_names: ["my-external-agent"],
})

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ DataSourceConfig

Returns a new instance of DataSourceConfig.

Raises:

  • (NoMethodError)


21
22
23
# File 'bedrock_agent_core/data_source_config.rb', line 21

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_bedrockagentcore.DataSourceConfig does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.from_agent_runtime_endpoint(runtime, endpoint = nil) ⇒ AWSCDK::BedrockAgentCore::DataSourceConfig

Creates a data source configuration from an AgentCore Runtime and optional endpoint.

This is the recommended way to configure evaluation for AgentCore Runtime agents. It automatically derives the CloudWatch log group and service name from the runtime and endpoint.

Examples:

# Using a specific endpoint
runtime = nil # AWSCDK::BedrockAgentCore::Runtime

endpoint = runtime.add_endpoint("PROD")
data_source = AWSCDK::BedrockAgentCore::DataSourceConfig.from_agent_runtime_endpoint(runtime, endpoint)

Parameters:

Returns:

  • (AWSCDK::BedrockAgentCore::DataSourceConfig)

    A DataSourceConfig instance



46
47
48
49
50
# File 'bedrock_agent_core/data_source_config.rb', line 46

def self.from_agent_runtime_endpoint(runtime, endpoint = nil)
  Jsii::Type.check_type(runtime, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JQmVkcm9ja0FnZW50UnVudGltZSJ9")), "runtime")
  Jsii::Type.check_type(endpoint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JUnVudGltZUVuZHBvaW50In0=")), "endpoint") unless endpoint.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.DataSourceConfig", "fromAgentRuntimeEndpoint", [runtime, endpoint])
end

.from_agent_runtime_endpoint_name(runtime, endpoint_name) ⇒ AWSCDK::BedrockAgentCore::DataSourceConfig

Creates a data source configuration from an AgentCore Runtime and an endpoint name string.

Use this method when you want to reference an endpoint by name without having a construct reference. For construct references, prefer from_agent_runtime_endpoint().

Examples:

runtime = nil # AWSCDK::BedrockAgentCore::Runtime

data_source = AWSCDK::BedrockAgentCore::DataSourceConfig.from_agent_runtime_endpoint_name(runtime, "PROD")

Parameters:

Returns:

  • (AWSCDK::BedrockAgentCore::DataSourceConfig)

    A DataSourceConfig instance



64
65
66
67
68
# File 'bedrock_agent_core/data_source_config.rb', line 64

def self.from_agent_runtime_endpoint_name(runtime, endpoint_name)
  Jsii::Type.check_type(runtime, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JQmVkcm9ja0FnZW50UnVudGltZSJ9")), "runtime")
  Jsii::Type.check_type(endpoint_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "endpointName")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.DataSourceConfig", "fromAgentRuntimeEndpointName", [runtime, endpoint_name])
end

.from_cloud_watch_logs(config) ⇒ AWSCDK::BedrockAgentCore::DataSourceConfig

Creates a CloudWatch Logs data source configuration.

Use this when your agent traces are stored in CloudWatch Logs, such as for external agents or when you need to specify log groups directly.

Examples:

data_source = AWSCDK::BedrockAgentCore::DataSourceConfig.from_cloud_watch_logs({
    log_group_names: ["/aws/bedrock-agentcore/runtimes/myRuntime-abc123-DEFAULT"],
    service_names: ["myRuntime.DEFAULT"],
})

Parameters:

Returns:

  • (AWSCDK::BedrockAgentCore::DataSourceConfig)

    A DataSourceConfig instance



82
83
84
85
86
# File 'bedrock_agent_core/data_source_config.rb', line 82

def self.from_cloud_watch_logs(config)
  config = config.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::CloudWatchLogsDataSourceConfig.new(**config.transform_keys(&:to_sym)) : config
  Jsii::Type.check_type(config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5DbG91ZFdhdGNoTG9nc0RhdGFTb3VyY2VDb25maWcifQ==")), "config")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.DataSourceConfig", "fromCloudWatchLogs", [config])
end

.jsii_overridable_methodsObject



25
26
27
28
29
30
# File 'bedrock_agent_core/data_source_config.rb', line 25

def self.jsii_overridable_methods
  {
    :cloud_watch_logs_config => { kind: :property, name: "cloudWatchLogsConfig", is_optional: false },
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bindAWSCDK::BedrockAgentCore::DataSourceConfigBindResult

Binds the data source configuration to produce the L1 property.



98
99
100
# File 'bedrock_agent_core/data_source_config.rb', line 98

def bind()
  jsii_call_method("bind", [])
end

#cloud_watch_logs_configAWSCDK::BedrockAgentCore::CloudWatchLogsDataSourceConfig

The CloudWatch Logs configuration.



91
92
93
# File 'bedrock_agent_core/data_source_config.rb', line 91

def cloud_watch_logs_config()
  jsii_get_property("cloudWatchLogsConfig")
end