Class GatewayCredentialProvider
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Example:
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.build();
// Outbound auth: ApiKeyCredentialProvider + bindForGatewayApiKeyTarget, or ARNs from console/API
String apiKeyIdentityArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey";
String apiKeySecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123";
AssetApiSchema opneapiSchema = ApiSchema.fromLocalAsset(path.join(__dirname, "mySchema.yml"));
opneapiSchema.bind(this);
// Create a gateway target with OpenAPI Schema
GatewayTarget target = GatewayTarget.forOpenApi(this, "MyTarget", GatewayTargetOpenApiProps.builder()
.gatewayTargetName("my-api-target")
.description("Target for external API integration")
.gateway(gateway) // Note: you need to pass the gateway reference
.apiSchema(opneapiSchema)
.credentialProviderConfigurations(List.of(GatewayCredentialProvider.fromApiKeyIdentityArn(ApiKeyCredentialProviderOptions.builder()
.providerArn(apiKeyIdentityArn)
.secretArn(apiKeySecretArn)
.build())))
.build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedGatewayCredentialProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedGatewayCredentialProvider(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic ICredentialProviderConfigfromApiKeyIdentity(IApiKeyCredentialProvider provider) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.static ICredentialProviderConfigfromApiKeyIdentity(IApiKeyCredentialProvider provider, FromApiKeyIdentityOptions options) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.static ICredentialProviderConfigCreate an API key credential provider from Identity ARN Use this method when you have the Identity ARN as a string.static ICredentialProviderConfigCreate an IAM role credential provider.static ICredentialProviderConfigCreate an IAM role credential provider.static ICredentialProviderConfigfromOauthIdentity(IOAuth2CredentialProvider provider, FromOauthIdentityOptions options) Create an OAuth outbound auth configuration from a Token VaultIOAuth2CredentialProviderconstruct.static ICredentialProviderConfigCreate an OAuth credential provider from Identity ARN Use this method when you have the Identity ARN as a string.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
GatewayCredentialProvider
protected GatewayCredentialProvider(software.amazon.jsii.JsiiObjectRef objRef) -
GatewayCredentialProvider
protected GatewayCredentialProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
GatewayCredentialProvider
@Stability(Stable) protected GatewayCredentialProvider()
-
-
Method Details
-
fromApiKeyIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentity(@NotNull IApiKeyCredentialProvider provider, @Nullable FromApiKeyIdentityOptions options) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromApiKeyIdentityArn- Parameters:
provider- This parameter is required.options-
-
fromApiKeyIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentity(@NotNull IApiKeyCredentialProvider provider) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromApiKeyIdentityArn- Parameters:
provider- This parameter is required.
-
fromApiKeyIdentityArn
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentityArn(@NotNull ApiKeyCredentialProviderOptions props) Create an API key credential provider from Identity ARN Use this method when you have the Identity ARN as a string.- Parameters:
props-- The configuration properties for the API key credential provider.
- Returns:
- ICredentialProviderConfig configured for API key authentication
-
fromIamRole
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromIamRole(@Nullable GatewayIamRoleCredentialProviderProps props) Create an IAM role credential provider.The gateway authenticates outbound requests using its own execution role (SigV4). Provide
serviceand optionallyregionto explicitly choose the SigV4 signing service / region instead of relying on the gateway's inference from the target endpoint. Useful for cross-region calls and for targets where the service can't be inferred from the URL. Explicitservice/regionis only supported for MCP Server and OpenAPI targets; other target types must use the barefromIamRole().- Parameters:
props-
-
fromIamRole
Create an IAM role credential provider.The gateway authenticates outbound requests using its own execution role (SigV4). Provide
serviceand optionallyregionto explicitly choose the SigV4 signing service / region instead of relying on the gateway's inference from the target endpoint. Useful for cross-region calls and for targets where the service can't be inferred from the URL. Explicitservice/regionis only supported for MCP Server and OpenAPI targets; other target types must use the barefromIamRole(). -
fromOauthIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromOauthIdentity(@NotNull IOAuth2CredentialProvider provider, @NotNull FromOauthIdentityOptions options) Create an OAuth outbound auth configuration from a Token VaultIOAuth2CredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromOauthIdentityArn- Parameters:
provider- This parameter is required.options- This parameter is required.
-
fromOauthIdentityArn
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromOauthIdentityArn(@NotNull OAuthConfiguration props) Create an OAuth credential provider from Identity ARN Use this method when you have the Identity ARN as a string.- Parameters:
props-- The configuration properties for the OAuth credential provider.
- Returns:
- ICredentialProviderConfig configured for OAuth authentication
-