From 9f76c511303ade88dcfa7c8151e9e953b35639ea Mon Sep 17 00:00:00 2001 From: Sumin Hong <35161069+suminhong@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:47:25 +0900 Subject: [PATCH] add bedrock endpoint in aws credentials --- .../nodes-base/credentials/Aws.credentials.ts | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/packages/nodes-base/credentials/Aws.credentials.ts b/packages/nodes-base/credentials/Aws.credentials.ts index bb7b30d4cf..f93e88c2fb 100644 --- a/packages/nodes-base/credentials/Aws.credentials.ts +++ b/packages/nodes-base/credentials/Aws.credentials.ts @@ -139,6 +139,10 @@ export type AwsCredentialsType = { sesEndpoint?: string; sqsEndpoint?: string; s3Endpoint?: string; + bedrockEndpoint?: string; + bedrockRuntimeEndpoint?: string; + bedrockAgentEndpoint?: string; + bedrockAgentRuntimeEndpoint?: string; }; // Some AWS services are global and don't have a region @@ -295,6 +299,62 @@ export class Aws implements ICredentialType { default: '', placeholder: 'https://s3.{region}.amazonaws.com', }, + { + displayName: 'Bedrock Endpoint', + name: 'bedrockEndpoint', + description: + 'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Bedrock using a VPC endpoint. Leave blank to use the default endpoint.', + type: 'string', + displayOptions: { + show: { + customEndpoints: [true], + }, + }, + default: '', + placeholder: 'https://{id}.bedrock.{region}.amazonaws.com', + }, + { + displayName: 'Bedrock Runtime Endpoint', + name: 'bedrockRuntimeEndpoint', + description: + 'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Bedrock Runtime using a VPC endpoint. Leave blank to use the default endpoint.', + type: 'string', + displayOptions: { + show: { + customEndpoints: [true], + }, + }, + default: '', + placeholder: 'https://{id}.bedrock-runtime.{region}.amazonaws.com', + }, + { + displayName: 'Bedrock Agent Endpoint', + name: 'bedrockAgentEndpoint', + description: + 'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Bedrock Agent using a VPC endpoint. Leave blank to use the default endpoint.', + type: 'string', + displayOptions: { + show: { + customEndpoints: [true], + }, + }, + default: '', + placeholder: 'https://{id}.bedrock-agent.{region}.amazonaws.com', + }, + { + displayName: 'Bedrock Agent Runtime Endpoint', + name: 's3Endpoint', + description: + 'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Bedrock Agent Runtime using a VPC endpoint. Leave blank to use the default endpoint.', + type: 'string', + displayOptions: { + show: { + customEndpoints: [true], + }, + }, + default: '', + placeholder: 'https://{id}.bedrock-agent-runtime.{region}.amazonaws.com', + }, ]; async authenticate( @@ -355,6 +415,14 @@ export class Aws implements ICredentialType { endpointString = credentials.rekognitionEndpoint; } else if (service === 'sqs' && credentials.sqsEndpoint) { endpointString = credentials.sqsEndpoint; + } else if (service === 'bedrock' && credentials.bedrockEndpoint) { + endpointString = credentials.bedrockEndpoint; + } else if (service === 'bedrock-runtime' && credentials.bedrockRuntimeEndpoint) { + endpointString = credentials.sesEndpoint; + } else if (service === 'bedrock-agent' && credentials.bedrockAgentEndpoint) { + endpointString = credentials.bedrockAgentEndpoint; + } else if (service === 'bedrock-agent-runtime' && credentials.bedrockAgentRuntimeEndpoint) { + endpointString = credentials.bedrockAgentRuntimeEndpoint; } else if (service) { endpointString = `https://${service}.${region}.amazonaws.com`; }