Class AwsSecretsManagerClient

java.lang.Object
codes.grow.packages.awssecretsmanager.AwsSecretsManagerClient
All Implemented Interfaces:
AutoCloseable

public final class AwsSecretsManagerClient extends Object implements AutoCloseable
Client for AWS Secrets Manager, built on the official AWS SDK for Java v2 (SPEC section 2.3 "Cloud SDK services").

It builds a SecretsManagerClient from the Grow configuration (region, credentials, optional assume-role, endpoint override, timeouts, retries, TLS, proxy, headers, User-Agent, hooks) or wraps one the caller passes (withSdkClient(SecretsManagerClient)). Thread-safe; create one per account and region and close it when done.


 try (AwsSecretsManagerClient client = AwsSecretsManagerClient.fromEnv()) {
   AwsSecretValue db = client.getSecretValue("prod/db");
   String password = client.getJsonField("prod/db", "password").map(JsonNode::asText).orElseThrow();
 }
 

Every I/O method has a blocking form and an …Async form returning CompletableFuture; cancelling the future interrupts the call (CancelledException). Errors are mapped by AWS error code to the AwsSecretsManagerException subclasses.