interface AddOpenApiTargetOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.AddOpenApiTargetOptions |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#AddOpenApiTargetOptions |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.AddOpenApiTargetOptions |
Python | aws_cdk.aws_bedrock_agentcore_alpha.AddOpenApiTargetOptions |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป AddOpenApiTargetOptions |
Options for adding an OpenAPI target to a gateway.
Example
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// Create an API key credential provider in Token Vault
const apiKeyProvider = new agentcore.ApiKeyCredentialProvider(this, "MyApiKeyProvider", {
apiKeyCredentialProviderName: "my-apikey",
});
const bucket = s3.Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
const s3mySchema = agentcore.ApiSchema.fromS3File(bucket, "schemas/myschema.yaml");
// Add an OpenAPI target using the L2 construct directly
const target = gateway.addOpenApiTarget("MyTarget", {
gatewayTargetName: "my-api-target",
description: "Target for external API integration",
apiSchema: s3mySchema,
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromApiKeyIdentity(apiKeyProvider, {
credentialLocation: agentcore.ApiKeyCredentialLocation.header({
credentialParameterName: "X-API-Key",
}),
}),
],
});
// This makes sure your s3 bucket is available before target
target.node.addDependency(bucket);
Properties
| Name | Type | Description |
|---|---|---|
| api | Api | The OpenAPI schema defining the API. |
| credential | ICredential[] | Credential providers for outbound authentication (OpenAPI targets use API Key or OAuth, not IAM). |
| description? | string | Optional description for the gateway target. |
| gateway | string | The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). |
| validate | boolean | Whether to validate the OpenAPI schema or not Note: Validation is only performed for inline and asset-based schema and during CDK synthesis. |
apiSchema
Type:
Api
The OpenAPI schema defining the API.
credentialProviderConfigurations?
Type:
ICredential[]
(optional, default: none (no credential configuration on the target; supply providers for secured backends))
Credential providers for outbound authentication (OpenAPI targets use API Key or OAuth, not IAM).
description?
Type:
string
(optional, default: No description)
Optional description for the gateway target.
gatewayTargetName?
Type:
string
(optional, default: auto generate)
The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).
validateOpenApiSchema?
Type:
boolean
(optional, default: true)
Whether to validate the OpenAPI schema or not Note: Validation is only performed for inline and asset-based schema and during CDK synthesis.
S3 schemas cannot be validated at synthesis time.

.NET
Go
Java
Python
TypeScript (