GatewayTargetOpenApiProps Struct
Properties for creating an OpenAPI-based Gateway Target.
Example
ts
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// Outbound auth: ApiKeyCredentialProvider + bindForGatewayApiKeyTarget, or ARNs from console/API
const apiKeyIdentityArn = "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 opneapiSchema = agentcore.ApiSchema.fromLocalAsset(path.join(__dirname, "mySchema.yml"));
opneapiSchema.bind(this);
// Create a gateway target with OpenAPI Schema
const target = agentcore.GatewayTarget.forOpenApi(this, "MyTarget", {
gatewayTargetName: "my-api-target",
description: "Target for external API integration",
gateway: gateway, // Note: you need to pass the gateway reference
apiSchema: opneapiSchema,
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({
providerArn: apiKeyIdentityArn,
secretArn: apiKeySecretArn
}),
],
});
Properties
apiSchemaApiSchemaapi_schemaApiSchemaapiSchemaApiSchemaApiSchemaApiSchemaApiSchemaApiSchemarequired#The OpenAPI schema defining the API.
credentialProviderConfigurationsoptionalICredentialProviderConfig[]credential_provider_configurationsoptionaltyping.List[ICredentialProviderConfig]credentialProviderConfigurationsoptionalList<ICredentialProviderConfig>CredentialProviderConfigurationsoptionalICredentialProviderConfig[]CredentialProviderConfigurationsoptional*[]ICredentialProviderConfig#Credential providers for authentication OpenAPI targets support API key and OAuth authentication (not IAM).
Default: If not provided, defaults to IAM role which will fail at runtime
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#Optional description for the gateway target The description can have up to 200 characters.
Default: No description
The gateway this target belongs to.
gatewayTargetNameoptionalstringgateway_target_nameoptionalstrgatewayTargetNameoptionalStringGatewayTargetNameoptionalstringGatewayTargetNameoptional*string#The name of the gateway target The name must be unique within the gateway Pattern: ^([0-9a-zA-Z][-]?){1,100}$.
Default: auto generate
validateOpenApiSchemaoptionalbooleanvalidate_open_api_schemaoptionalboolvalidateOpenApiSchemaoptionalBooleanValidateOpenApiSchemaoptionalboolValidateOpenApiSchemaoptional*bool= true#Whether to validate the OpenAPI schema (only applies to inline schemas) Note: Validation is only performed for inline schemas during CDK synthesis.
S3 and asset-based schemas cannot be validated at synthesis time.