UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

347 lines • 14.2 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentcoreGatewayTarget = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an AWS Bedrock AgentCore Gateway Target. Gateway targets define the endpoints and configurations that a gateway can invoke, such as Lambda functions or APIs, allowing agents to interact with external services through the Model Context Protocol (MCP). * * ## Example Usage * * ### Lambda Target with Gateway IAM Role * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const gatewayAssume = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * actions: ["sts:AssumeRole"], * principals: [{ * type: "Service", * identifiers: ["bedrock-agentcore.amazonaws.com"], * }], * }], * }); * const gatewayRole = new aws.iam.Role("gateway_role", { * name: "bedrock-gateway-role", * assumeRolePolicy: gatewayAssume.then(gatewayAssume => gatewayAssume.json), * }); * const lambdaAssume = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * actions: ["sts:AssumeRole"], * principals: [{ * type: "Service", * identifiers: ["lambda.amazonaws.com"], * }], * }], * }); * const lambdaRole = new aws.iam.Role("lambda_role", { * name: "example-lambda-role", * assumeRolePolicy: lambdaAssume.then(lambdaAssume => lambdaAssume.json), * }); * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("example.zip"), * name: "example-function", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS20dX, * }); * const exampleAgentcoreGateway = new aws.bedrock.AgentcoreGateway("example", { * name: "example-gateway", * roleArn: gatewayRole.arn, * authorizerConfiguration: { * customJwtAuthorizer: { * discoveryUrl: "https://accounts.google.com/.well-known/openid-configuration", * }, * }, * }); * const exampleAgentcoreGatewayTarget = new aws.bedrock.AgentcoreGatewayTarget("example", { * name: "example-target", * gatewayIdentifier: exampleAgentcoreGateway.gatewayId, * description: "Lambda function target for processing requests", * credentialProviderConfiguration: { * gatewayIamRole: {}, * }, * targetConfiguration: { * mcp: { * lambda: { * lambdaArn: example.arn, * toolSchema: { * inlinePayloads: [{ * name: "process_request", * description: "Process incoming requests", * inputSchema: { * type: "object", * description: "Request processing schema", * properties: [ * { * name: "message", * type: "string", * description: "Message to process", * required: true, * }, * { * name: "options", * type: "object", * properties: [ * { * name: "priority", * type: "string", * }, * { * name: "tags", * type: "array", * items: [{ * type: "string", * }], * }, * ], * }, * ], * }, * outputSchema: { * type: "object", * properties: [ * { * name: "status", * type: "string", * required: true, * }, * { * name: "result", * type: "string", * }, * ], * }, * }], * }, * }, * }, * }, * }); * ``` * * ### Target with API Key Authentication * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const apiKeyExample = new aws.bedrock.AgentcoreGatewayTarget("api_key_example", { * name: "api-target", * gatewayIdentifier: exampleAwsBedrockagentcoreGateway.gatewayId, * description: "External API target with API key authentication", * credentialProviderConfiguration: { * apiKey: { * providerArn: "arn:aws:iam::123456789012:oidc-provider/example.com", * credentialLocation: "HEADER", * credentialParameterName: "X-API-Key", * credentialPrefix: "Bearer", * }, * }, * targetConfiguration: { * mcp: { * lambda: { * lambdaArn: example.arn, * toolSchema: { * inlinePayloads: [{ * name: "api_tool", * description: "External API integration tool", * inputSchema: { * type: "string", * description: "Simple string input for API calls", * }, * }], * }, * }, * }, * }, * }); * ``` * * ### Target with OAuth Authentication * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const oauthExample = new aws.bedrock.AgentcoreGatewayTarget("oauth_example", { * name: "oauth-target", * gatewayIdentifier: exampleAwsBedrockagentcoreGateway.gatewayId, * credentialProviderConfiguration: { * oauth: { * providerArn: "arn:aws:iam::123456789012:oidc-provider/oauth.example.com", * scopes: [ * "read", * "write", * ], * customParameters: { * client_type: "confidential", * grant_type: "authorization_code", * }, * }, * }, * targetConfiguration: { * mcp: { * lambda: { * lambdaArn: example.arn, * toolSchema: { * inlinePayloads: [{ * name: "oauth_tool", * description: "OAuth-authenticated service", * inputSchema: { * type: "array", * items: { * type: "object", * properties: [ * { * name: "id", * type: "string", * required: true, * }, * { * name: "value", * type: "number", * }, * ], * }, * }, * }], * }, * }, * }, * }, * }); * ``` * * ### Complex Schema with JSON Serialization * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const complexSchema = new aws.bedrock.AgentcoreGatewayTarget("complex_schema", { * name: "complex-target", * gatewayIdentifier: exampleAwsBedrockagentcoreGateway.gatewayId, * credentialProviderConfiguration: { * gatewayIamRole: {}, * }, * targetConfiguration: { * mcp: { * lambda: { * lambdaArn: example.arn, * toolSchema: { * inlinePayloads: [{ * name: "complex_tool", * description: "Tool with complex nested schema", * inputSchema: { * type: "object", * properties: [{ * name: "profile", * type: "object", * properties: [ * { * name: "nested_tags", * type: "array", * itemsJson: JSON.stringify({ * type: "string", * }), * }, * { * name: "metadata", * type: "object", * propertiesJson: JSON.stringify({ * properties: { * created_at: { * type: "string", * }, * version: { * type: "number", * }, * }, * required: ["created_at"], * }), * }, * ], * }], * }, * }], * }, * }, * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Bedrock AgentCore Gateway Target using the gateway identifier and target ID separated by a comma. For example: * * ```sh * $ pulumi import aws:bedrock/agentcoreGatewayTarget:AgentcoreGatewayTarget example GATEWAY1234567890,TARGET0987654321 * ``` */ class AgentcoreGatewayTarget extends pulumi.CustomResource { /** * Get an existing AgentcoreGatewayTarget resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new AgentcoreGatewayTarget(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of AgentcoreGatewayTarget. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === AgentcoreGatewayTarget.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["credentialProviderConfiguration"] = state?.credentialProviderConfiguration; resourceInputs["description"] = state?.description; resourceInputs["gatewayIdentifier"] = state?.gatewayIdentifier; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["targetConfiguration"] = state?.targetConfiguration; resourceInputs["targetId"] = state?.targetId; resourceInputs["timeouts"] = state?.timeouts; } else { const args = argsOrState; if (args?.gatewayIdentifier === undefined && !opts.urn) { throw new Error("Missing required property 'gatewayIdentifier'"); } resourceInputs["credentialProviderConfiguration"] = args?.credentialProviderConfiguration; resourceInputs["description"] = args?.description; resourceInputs["gatewayIdentifier"] = args?.gatewayIdentifier; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["targetConfiguration"] = args?.targetConfiguration; resourceInputs["timeouts"] = args?.timeouts; resourceInputs["targetId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AgentcoreGatewayTarget.__pulumiType, name, resourceInputs, opts); } } exports.AgentcoreGatewayTarget = AgentcoreGatewayTarget; /** @internal */ AgentcoreGatewayTarget.__pulumiType = 'aws:bedrock/agentcoreGatewayTarget:AgentcoreGatewayTarget'; //# sourceMappingURL=agentcoreGatewayTarget.js.map