aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.5 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataSourceConfig=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var validation_helpers_1=()=>{var tmp=require("./validation-helpers");return validation_helpers_1=()=>tmp,tmp};class DataSourceConfig{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_bedrockagentcore.DataSourceConfig",version:"2.257.0"};static fromCloudWatchLogs(config){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_bedrockagentcore_CloudWatchLogsDataSourceConfig(config)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromCloudWatchLogs),error}return(0,validation_helpers_1().throwIfInvalid)(validation_helpers_1().validateLogGroupNames,config.logGroupNames),(0,validation_helpers_1().throwIfInvalid)(validation_helpers_1().validateServiceNames,config.serviceNames),new DataSourceConfig({logGroupNames:config.logGroupNames,serviceNames:config.serviceNames})}static fromAgentRuntimeEndpoint(runtime,endpoint){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_bedrockagentcore_IBedrockAgentRuntime(runtime),jsiiDeprecationWarnings().aws_cdk_lib_aws_bedrockagentcore_IRuntimeEndpoint(endpoint)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAgentRuntimeEndpoint),error}const endpointName=endpoint?.endpointName??"DEFAULT";return DataSourceConfig.buildFromRuntime(runtime,endpointName)}static fromAgentRuntimeEndpointName(runtime,endpointName){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_bedrockagentcore_IBedrockAgentRuntime(runtime)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAgentRuntimeEndpointName),error}return DataSourceConfig.buildFromRuntime(runtime,endpointName)}static buildFromRuntime(runtime,endpointName){const logGroupName=`/aws/bedrock-agentcore/runtimes/${runtime.agentRuntimeId}-${endpointName}`,serviceName=`${runtime.agentRuntimeName}.${endpointName}`;return new DataSourceConfig({logGroupNames:[logGroupName],serviceNames:[serviceName]})}cloudWatchLogsConfig;constructor(config){this.cloudWatchLogsConfig=config}bind(){return{cloudWatchLogs:{logGroupNames:this.cloudWatchLogsConfig.logGroupNames,serviceNames:this.cloudWatchLogsConfig.serviceNames}}}}exports.DataSourceConfig=DataSourceConfig;