Class BedrockBackend.Builder
-
- All Implemented Interfaces:
public final class BedrockBackend.BuilderA builder for a BedrockBackend used to connect an Anthropic client to an Amazon Bedrock backend service.
The AWS credentials and region can be extracted from the environment and set on the builder by calling fromEnv before calling build to create the BedrockBackend. Alternatively, set the AWS credentials and region explicitly via awsCredentials and region before calling build. A custom AWS credentials provider can be passed to fromEnv or awsCredentialsProvider.
-
-
Method Summary
Modifier and Type Method Description final BedrockBackend.BuilderfromEnv(AwsCredentialsProvider awsCredentialsProvider)Resolves the AWS credentials from the environment, or other sources configured by the credentials provider. final BedrockBackend.BuilderfromEnv()Resolves the AWS credentials from the environment, or other sources configured by the credentials provider. final BedrockBackend.BuilderawsCredentialsProvider(AwsCredentialsProvider awsCredentialsProvider)Sets the AWS credentials provider that will be used to resolve credentials. final BedrockBackend.BuilderawsCredentials(AwsCredentials awsCredentials)Creates and sets an AWS credentials provider that provides only the given credentials. final BedrockBackend.Builderregion(Region region)Sets the region to use when constructing the base URL for requests. final BedrockBackendbuild()-
-
Method Detail
-
fromEnv
@JvmOverloads() final BedrockBackend.Builder fromEnv(AwsCredentialsProvider awsCredentialsProvider)
Resolves the AWS credentials from the environment, or other sources configured by the credentials provider. If no provider is given, the AWS
DefaultCredentialsProvideris used, which is suitable for many use cases. The configuration of that provider follows its usual defaults, so asynchronous refreshing is not enabled. See the AWS documentation for details. For other use cases, pass a credentials provider configured as required. The provider, whether given explicitly or by default, overrides any provider set via awsCredentialsProvider or awsCredentials.The region is also resolved immediately using the default AWS region provider chain. Once resolved here, the region will not be changed again.
When called, this method will immediately attempt to resolve the AWS credentials and region. An error will occur if they cannot be resolved.
-
fromEnv
@JvmOverloads() final BedrockBackend.Builder fromEnv()
Resolves the AWS credentials from the environment, or other sources configured by the credentials provider. If no provider is given, the AWS
DefaultCredentialsProvideris used, which is suitable for many use cases. The configuration of that provider follows its usual defaults, so asynchronous refreshing is not enabled. See the AWS documentation for details. For other use cases, pass a credentials provider configured as required. The provider, whether given explicitly or by default, overrides any provider set via awsCredentialsProvider or awsCredentials.The region is also resolved immediately using the default AWS region provider chain. Once resolved here, the region will not be changed again.
When called, this method will immediately attempt to resolve the AWS credentials and region. An error will occur if they cannot be resolved.
-
awsCredentialsProvider
final BedrockBackend.Builder awsCredentialsProvider(AwsCredentialsProvider awsCredentialsProvider)
Sets the AWS credentials provider that will be used to resolve credentials. Credentials will not be resolved immediately. If misconfigured, an error may not be reported until the first client request is made. To set a credentials provider and confirm that it can resolve credentials, call fromEnv. If called after fromEnv, this overrides the credentials provider configured by fromEnv.
-
awsCredentials
final BedrockBackend.Builder awsCredentials(AwsCredentials awsCredentials)
Creates and sets an AWS credentials provider that provides only the given credentials. This is a convenience for simple use cases, such as when testing. The provider overrides any provider previously set by awsCredentialsProvider or fromEnv.
-
region
final BedrockBackend.Builder region(Region region)
Sets the region to use when constructing the base URL for requests. Alternatively, this may be resolved from the environment by calling fromEnv. If called after fromEnv, this overrides the region resolved by fromEnv.
-
build
final BedrockBackend build()
-
-
-
-