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",
});
// These ARNs are returned when creating the API key credential provider via Console or API
const apiKeyProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey"
const apiKeySecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123"
const bucket = s3.Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
const s3mySchema = agentcore.ApiSchema.fromS3File(bucket, "schemas/myschema.yaml");
// Add an OpenAPI target directly to the gateway
const target = gateway.addOpenApiTarget("MyTarget", {
gatewayTargetName: "my-api-target",
description: "Target for external API integration",
apiSchema: s3mySchema,
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({
providerArn: apiKeyProviderArn,
secretArn: apiKeySecretArn,
credentialLocation: agentcore.ApiKeyCredentialLocation.header({
credentialParameterName: "X-API-Key",
}),
}),
],
});
// This make sure your s3 bucket is available before target
target.node.addDependency(bucket);
Properties
| Name | Type | Description |
|---|---|---|
| api | Api | The OpenAPI schema defining the API. |
| gateway | string | The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). |
| credential | ICredential[] | Credential providers for authentication. |
| description? | string | Optional description for the gateway target. |
| 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.
gatewayTargetName
Type:
string
The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).
credentialProviderConfigurations?
Type:
ICredential[]
(optional, default: [GatewayCredentialProvider.iamRole()])
Credential providers for authentication.
description?
Type:
string
(optional, default: No description)
Optional description for the gateway target.
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 (