Class GatewayTarget
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrockagentcore.GatewayTargetBase
software.amazon.awscdk.services.bedrockagentcore.GatewayTarget
- All Implemented Interfaces:
IGatewayTargetRef,IEnvironmentAware,IResource,IGatewayTarget,IMcpGatewayTarget,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.129.0 (build eaca441)",
date="2026-05-19T08:18:44.412Z")
@Stability(Stable)
public class GatewayTarget
extends GatewayTargetBase
implements IMcpGatewayTarget
Defines tools that your gateway will host.
Supports multiple target types:
- Lambda: Wraps a Lambda function as MCP tools
- OpenAPI: Exposes an OpenAPI/REST API as MCP tools
- Smithy: Exposes a Smithy-modeled API as MCP tools
Example:
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.build();
Function lambdaFunction = Function.Builder.create(this, "MyFunction")
.runtime(Runtime.NODEJS_22_X)
.handler("index.handler")
.code(Code.fromInline("\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n "))
.build();
// Create a gateway target with Lambda and tool schema
GatewayTarget target = GatewayTarget.forLambda(this, "MyLambdaTarget", GatewayTargetLambdaProps.builder()
.gatewayTargetName("my-lambda-target")
.description("Target for Lambda function integration")
.gateway(gateway)
.lambdaFunction(lambdaFunction)
.toolSchema(ToolSchema.fromLocalAsset(path.join(__dirname, "schemas", "my-tool-schema.json")))
.build());
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrockagentcore.IGatewayTarget
IGatewayTarget.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrockagentcore.IMcpGatewayTarget
IMcpGatewayTarget.Jsii$Default, IMcpGatewayTarget.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGatewayTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedGatewayTarget(software.amazon.jsii.JsiiObjectRef objRef) GatewayTarget(software.constructs.Construct scope, String id, GatewayTargetProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic GatewayTargetforApiGateway(software.constructs.Construct scope, String id, GatewayTargetApiGatewayProps props) Create an API Gateway-based target Convenience method for creating a target that connects to an API Gateway REST API.static GatewayTargetforLambda(software.constructs.Construct scope, String id, GatewayTargetLambdaProps props) Create a Lambda-based MCP target Convenience method for creating a target that wraps a Lambda function.static GatewayTargetforMcpServer(software.constructs.Construct scope, String id, GatewayTargetMcpServerProps props) Create an MCP Server-based target Convenience method for creating a target that connects to an external MCP server.static GatewayTargetforOpenApi(software.constructs.Construct scope, String id, GatewayTargetOpenApiProps props) Create an OpenAPI-based MCP target Convenience method for creating a target that exposes an OpenAPI/REST API.static GatewayTargetforSmithy(software.constructs.Construct scope, String id, GatewayTargetSmithyProps props) Create a Smithy-based MCP target Convenience method for creating a target that exposes a Smithy-modeled API.static IGatewayTargetfromGatewayTargetAttributes(software.constructs.Construct scope, String id, GatewayTargetAttributes attrs) Import an existing Gateway Target using its attributes This allows you to reference a Gateway Target that was created outside of CDK.Timestamp when the gateway target was created.The credential providers for this target.Optional description for the gateway target.The gateway this target belongs to.The name of the gateway target.The status of the gateway target.The status reasons for the gateway target.The ARN of the gateway target.The unique identifier of the gateway target.The protocol type (always MCP for now).The specific MCP target type (Lambda, OpenAPI, Smithy, or MCP Server).Timestamp when the gateway target was last updated.grantSync(IGrantable grantee) Grants permission to synchronize this gateway's targets.Methods inherited from class software.amazon.awscdk.services.bedrockagentcore.GatewayTargetBase
getGatewayTargetRef, grant, grantManage, grantReadMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource, withMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNode, withMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.services.bedrockagentcore.IGatewayTarget
grant, grantManage, grantReadMethods inherited from interface software.amazon.awscdk.interfaces.bedrockagentcore.IGatewayTargetRef
getGatewayTargetRefMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
GatewayTarget
protected GatewayTarget(software.amazon.jsii.JsiiObjectRef objRef) -
GatewayTarget
protected GatewayTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
GatewayTarget
@Stability(Stable) public GatewayTarget(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
forApiGateway
@Stability(Stable) @NotNull public static GatewayTarget forApiGateway(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetApiGatewayProps props) Create an API Gateway-based target Convenience method for creating a target that connects to an API Gateway REST API.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.props- The properties for the API Gateway target. This parameter is required.- Returns:
- A new GatewayTarget instance
- See Also:
-
forLambda
@Stability(Stable) @NotNull public static GatewayTarget forLambda(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetLambdaProps props) Create a Lambda-based MCP target Convenience method for creating a target that wraps a Lambda function.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.props- The properties for the Lambda target. This parameter is required.- Returns:
- A new GatewayTarget instance
-
forMcpServer
@Stability(Stable) @NotNull public static GatewayTarget forMcpServer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetMcpServerProps props) Create an MCP Server-based target Convenience method for creating a target that connects to an external MCP server.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.props- The properties for the MCP server target. This parameter is required.- Returns:
- A new GatewayTarget instance
- See Also:
-
forOpenApi
@Stability(Stable) @NotNull public static GatewayTarget forOpenApi(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetOpenApiProps props) Create an OpenAPI-based MCP target Convenience method for creating a target that exposes an OpenAPI/REST API.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.props- The properties for the OpenAPI target. This parameter is required.- Returns:
- A new GatewayTarget instance
-
forSmithy
@Stability(Stable) @NotNull public static GatewayTarget forSmithy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetSmithyProps props) Create a Smithy-based MCP target Convenience method for creating a target that exposes a Smithy-modeled API.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.props- The properties for the Smithy target. This parameter is required.- Returns:
- A new GatewayTarget instance
-
fromGatewayTargetAttributes
@Stability(Stable) @NotNull public static IGatewayTarget fromGatewayTargetAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetAttributes attrs) Import an existing Gateway Target using its attributes This allows you to reference a Gateway Target that was created outside of CDK.- Parameters:
scope- The construct scope. This parameter is required.id- The construct id. This parameter is required.attrs- The attributes of the existing Gateway Target. This parameter is required.- Returns:
- An IGatewayTarget instance representing the imported target
-
grantSync
Grants permission to synchronize this gateway's targets.This method grants the
SynchronizeGatewayTargetspermission, which is primarily needed for MCP Server targets when you need to refresh the tool catalog after the MCP server's tools have changed.[disable-awslint:no-grants]
- Parameters:
grantee- This parameter is required.
-
getGateway
The gateway this target belongs to.- Specified by:
getGatewayin interfaceIGatewayTarget- Specified by:
getGatewayin classGatewayTargetBase
-
getGatewayTargetName
The name of the gateway target.- Specified by:
getGatewayTargetNamein interfaceIGatewayTarget- Specified by:
getGatewayTargetNamein classGatewayTargetBase
-
getTargetArn
The ARN of the gateway target.- Specified by:
getTargetArnin interfaceIGatewayTarget- Specified by:
getTargetArnin classGatewayTargetBase
-
getTargetId
The unique identifier of the gateway target.- Specified by:
getTargetIdin interfaceIGatewayTarget- Specified by:
getTargetIdin classGatewayTargetBase
-
getTargetProtocolType
The protocol type (always MCP for now).- Specified by:
getTargetProtocolTypein interfaceIGatewayTarget- Specified by:
getTargetProtocolTypein classGatewayTargetBase
-
getTargetType
The specific MCP target type (Lambda, OpenAPI, Smithy, or MCP Server).- Specified by:
getTargetTypein interfaceIMcpGatewayTarget
-
getCreatedAt
Timestamp when the gateway target was created.- Specified by:
getCreatedAtin interfaceIGatewayTarget- Specified by:
getCreatedAtin classGatewayTargetBase
-
getCredentialProviderConfigurations
@Stability(Stable) @Nullable public List<ICredentialProviderConfig> getCredentialProviderConfigurations()The credential providers for this target.- Specified by:
getCredentialProviderConfigurationsin interfaceIGatewayTarget- Specified by:
getCredentialProviderConfigurationsin classGatewayTargetBase
-
getDescription
Optional description for the gateway target.- Specified by:
getDescriptionin interfaceIGatewayTarget- Specified by:
getDescriptionin classGatewayTargetBase
-
getStatus
The status of the gateway target.- Specified by:
getStatusin interfaceIGatewayTarget- Specified by:
getStatusin classGatewayTargetBase
-
getStatusReasons
The status reasons for the gateway target.- Specified by:
getStatusReasonsin interfaceIGatewayTarget- Specified by:
getStatusReasonsin classGatewayTargetBase
-
getUpdatedAt
Timestamp when the gateway target was last updated.- Specified by:
getUpdatedAtin interfaceIGatewayTarget- Specified by:
getUpdatedAtin classGatewayTargetBase
-