ApiKeyCredentialProviderProps Struct
Properties for a new {@link ApiKeyCredentialProvider} (Token Vault resource).
Example
ts
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
apiKeySecretValueapi_keySecretValueapiKeySecretValueApiKeySecretValueApiKeySecretValue= no key in template (provider may…#The API key value.
notes · default
NOTE: The API key will be included in the CloudFormation template as part of synthesis. The service stores the key in Secrets Manager after creation, but the value is visible in the template and deployment history. Use SecretValue.unsafePlainText() to explicitly acknowledge plaintext, or pass a reference from another construct to avoid embedding the literal value.
If omitted, you can supply the key through another mechanism supported by the service.
Default: no key in template (provider may still be created depending on service behavior)
apiKeyCredentialProviderNamestringapi_key_credential_provider_namestrapiKeyCredentialProviderNameStringApiKeyCredentialProviderNamestringApiKeyCredentialProviderName*string= a name generated by CDK#Name of the credential provider.
tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string= no tags#Tags for this credential provider.