Experimental
@aws-cdk/aws-bedrock-agentcore-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
GatewayTarget L2 construct
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
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
declare const credentialProviderConfig: bedrock_agentcore_alpha.ICredentialProviderConfig;
declare const gateway: bedrock_agentcore_alpha.Gateway;
declare const targetConfiguration: bedrock_agentcore_alpha.ITargetConfiguration;
const gatewayTarget = new bedrock_agentcore_alpha.GatewayTarget(this, 'MyGatewayTarget', {
gateway: gateway,
targetConfiguration: targetConfiguration,
// the properties below are optional
credentialProviderConfigurations: [credentialProviderConfig],
description: 'description',
gatewayTargetName: 'gatewayTargetName',
});
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
# credential_provider_config: bedrock_agentcore_alpha.ICredentialProviderConfig
# gateway: bedrock_agentcore_alpha.Gateway
# target_configuration: bedrock_agentcore_alpha.ITargetConfiguration
gateway_target = bedrock_agentcore_alpha.GatewayTarget(self, "MyGatewayTarget",
gateway=gateway,
target_configuration=target_configuration,
# the properties below are optional
credential_provider_configurations=[credential_provider_config],
description="description",
gateway_target_name="gatewayTargetName"
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
ICredentialProviderConfig credentialProviderConfig;
Gateway gateway;
ITargetConfiguration targetConfiguration;
GatewayTarget gatewayTarget = GatewayTarget.Builder.create(this, "MyGatewayTarget")
.gateway(gateway)
.targetConfiguration(targetConfiguration)
// the properties below are optional
.credentialProviderConfigurations(List.of(credentialProviderConfig))
.description("description")
.gatewayTargetName("gatewayTargetName")
.build();
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
ICredentialProviderConfig credentialProviderConfig;
Gateway gateway;
ITargetConfiguration targetConfiguration;
var gatewayTarget = new GatewayTarget(this, "MyGatewayTarget", new GatewayTargetProps {
Gateway = gateway,
TargetConfiguration = targetConfiguration,
// the properties below are optional
CredentialProviderConfigurations = new [] { credentialProviderConfig },
Description = "description",
GatewayTargetName = "gatewayTargetName"
});
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
var credentialProviderConfig ICredentialProviderConfig
var gateway Gateway
var targetConfiguration ITargetConfiguration
gatewayTarget := bedrock_agentcore_alpha.NewGatewayTarget(this, jsii.String("MyGatewayTarget"), &GatewayTargetProps{
Gateway: gateway,
TargetConfiguration: targetConfiguration,
// the properties below are optional
CredentialProviderConfigurations: []ICredentialProviderConfig{
credentialProviderConfig,
},
Description: jsii.String("description"),
GatewayTargetName: jsii.String("gatewayTargetName"),
})
Initializer
new GatewayTarget(scope: Construct, id: string, props: GatewayTargetProps)
GatewayTarget(scope: Construct, id: str, props: GatewayTargetProps)
new GatewayTarget(Construct scope, String id, GatewayTargetProps props)
new GatewayTarget(Construct scope, string id, GatewayTargetProps props)
NewGatewayTarget(Scope Construct, Id *string, Props GatewayTargetProps)
Construct Props
credentialProviderConfigurationsoptionalICredentialProviderConfig[]credential_provider_configurationsoptionaltyping.List[ICredentialProviderConfig]credentialProviderConfigurationsoptionalList<ICredentialProviderConfig>CredentialProviderConfigurationsoptionalICredentialProviderConfig[]CredentialProviderConfigurationsoptional*[]ICredentialProviderConfig#Default: [GatewayCredentialProvider.fromIamRole()]
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#Default: No description
gatewayTargetNameoptionalstringgateway_target_nameoptionalstrgatewayTargetNameoptionalStringGatewayTargetNameoptionalstringGatewayTargetNameoptional*string#Default: auto generate
targetConfigurationITargetConfigurationtarget_configurationITargetConfigurationtargetConfigurationITargetConfigurationTargetConfigurationITargetConfigurationTargetConfigurationITargetConfigurationrequired#Properties
createdAtmay be undefinedstringcreated_atmay be undefinedstrcreatedAtmay be undefinedStringCreatedAtmay be undefinedstringCreatedAtmay be undefined*string#credentialProviderConfigurationsmay be undefinedICredentialProviderConfig[]credential_provider_configurationsmay be undefinedtyping.List[ICredentialProviderConfig]credentialProviderConfigurationsmay be undefinedList<ICredentialProviderConfig>CredentialProviderConfigurationsmay be undefinedICredentialProviderConfig[]CredentialProviderConfigurationsmay be undefined*[]ICredentialProviderConfig#descriptionmay be undefinedstringdescriptionmay be undefinedstrdescriptionmay be undefinedStringDescriptionmay be undefinedstringDescriptionmay be undefined*string#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
gatewayTargetRefGatewayTargetReferencegateway_target_refGatewayTargetReferencegatewayTargetRefGatewayTargetReferenceGatewayTargetRefGatewayTargetReferenceGatewayTargetRefGatewayTargetReferencerequired#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#statusmay be undefinedstringstatusmay be undefinedstrstatusmay be undefinedStringStatusmay be undefinedstringStatusmay be undefined*string#statusReasonsmay be undefinedstring[]status_reasonsmay be undefinedtyping.List[str]statusReasonsmay be undefinedList<String>StatusReasonsmay be undefinedstring[]StatusReasonsmay be undefined*[]*string#targetProtocolTypeGatewayTargetProtocolTypetarget_protocol_typeGatewayTargetProtocolTypetargetProtocolTypeGatewayTargetProtocolTypeTargetProtocolTypeGatewayTargetProtocolTypeTargetProtocolTypeGatewayTargetProtocolTyperequired#targetTypeMcpTargetTypetarget_typeMcpTargetTypetargetTypeMcpTargetTypeTargetTypeMcpTargetTypeTargetTypeMcpTargetTyperequired#updatedAtmay be undefinedstringupdated_atmay be undefinedstrupdatedAtmay be undefinedStringUpdatedAtmay be undefinedstringUpdatedAtmay be undefined*string#Methods
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
forApiGateway(scope: Construct, id: string, props: GatewayTargetApiGatewayProps): GatewayTarget // chainable@staticmethod def for_api_gateway(scope: Construct, id: str, props: GatewayTargetApiGatewayProps) -> GatewayTargetpublic static GatewayTarget forApiGateway(Construct scope, String id, GatewayTargetApiGatewayProps props)public static GatewayTarget ForApiGateway(Construct scope, string id, GatewayTargetApiGatewayProps props)func ForApiGateway(Scope Construct, Id *string, Props GatewayTargetApiGatewayProps) GatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.propspropspropspropsProps— The properties for the API Gateway target.
Returns: A new GatewayTarget instance
forLambda(scope: Construct, id: string, props: GatewayTargetLambdaProps): GatewayTarget // chainable@staticmethod def for_lambda(scope: Construct, id: str, props: GatewayTargetLambdaProps) -> GatewayTargetpublic static GatewayTarget forLambda(Construct scope, String id, GatewayTargetLambdaProps props)public static GatewayTarget ForLambda(Construct scope, string id, GatewayTargetLambdaProps props)func ForLambda(Scope Construct, Id *string, Props GatewayTargetLambdaProps) GatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.propspropspropspropsProps— The properties for the Lambda target.
Returns: A new GatewayTarget instance
forMcpServer(scope: Construct, id: string, props: GatewayTargetMcpServerProps): GatewayTarget // chainable@staticmethod def for_mcp_server(scope: Construct, id: str, props: GatewayTargetMcpServerProps) -> GatewayTargetpublic static GatewayTarget forMcpServer(Construct scope, String id, GatewayTargetMcpServerProps props)public static GatewayTarget ForMcpServer(Construct scope, string id, GatewayTargetMcpServerProps props)func ForMcpServer(Scope Construct, Id *string, Props GatewayTargetMcpServerProps) GatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.propspropspropspropsProps— The properties for the MCP server target.
Returns: A new GatewayTarget instance
forOpenApi(scope: Construct, id: string, props: GatewayTargetOpenApiProps): GatewayTarget // chainable@staticmethod def for_open_api(scope: Construct, id: str, props: GatewayTargetOpenApiProps) -> GatewayTargetpublic static GatewayTarget forOpenApi(Construct scope, String id, GatewayTargetOpenApiProps props)public static GatewayTarget ForOpenApi(Construct scope, string id, GatewayTargetOpenApiProps props)func ForOpenApi(Scope Construct, Id *string, Props GatewayTargetOpenApiProps) GatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.propspropspropspropsProps— The properties for the OpenAPI target.
Returns: A new GatewayTarget instance
forSmithy(scope: Construct, id: string, props: GatewayTargetSmithyProps): GatewayTarget // chainable@staticmethod def for_smithy(scope: Construct, id: str, props: GatewayTargetSmithyProps) -> GatewayTargetpublic static GatewayTarget forSmithy(Construct scope, String id, GatewayTargetSmithyProps props)public static GatewayTarget ForSmithy(Construct scope, string id, GatewayTargetSmithyProps props)func ForSmithy(Scope Construct, Id *string, Props GatewayTargetSmithyProps) GatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.propspropspropspropsProps— The properties for the Smithy target.
Returns: A new GatewayTarget instance
fromGatewayTargetAttributes(scope: Construct, id: string, attrs: GatewayTargetAttributes): IGatewayTarget@staticmethod def from_gateway_target_attributes(scope: Construct, id: str, attrs: GatewayTargetAttributes) -> IGatewayTargetpublic static IGatewayTarget fromGatewayTargetAttributes(Construct scope, String id, GatewayTargetAttributes attrs)public static IGatewayTarget FromGatewayTargetAttributes(Construct scope, string id, GatewayTargetAttributes attrs)func FromGatewayTargetAttributes(Scope Construct, Id *string, Attrs GatewayTargetAttributes) IGatewayTargetstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The construct scope.ididididId— The construct id.attrsattrsattrsattrsAttrs— The attributes of the existing Gateway Target.
Returns: An IGatewayTarget instance representing the imported target
grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#[disable-awslint:no-grants]
2 parameters
Parameters
granteegranteegranteegranteeGrantee— The principal to grant permissions to.actionsactionsactionsactionsActions— The IAM actions to grant.
grantManage(grantee: IGrantable): Grantdef grant_manage(self, grantee: IGrantable) -> Grantpublic Grant grantManage(IGrantable grantee)public Grant GrantManage(IGrantable grantee)func GrantManage(Grantee IGrantable) Grant#[disable-awslint:no-grants]
1 parameter
Parameters
granteegranteegranteegranteeGrantee— The principal to grant manage permissions to.
grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#[disable-awslint:no-grants]
1 parameter
Parameters
granteegranteegranteegranteeGrantee— The principal to grant read permissions to.
grantSync(grantee: IGrantable): Grantdef grant_sync(self, grantee: IGrantable) -> Grantpublic Grant grantSync(IGrantable grantee)public Grant GrantSync(IGrantable grantee)func GrantSync(Grantee IGrantable) Grant#This method grants the SynchronizeGatewayTargets permission, 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]
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.