use of com.amazonaws.services.secretsmanager.model.UpdateSecretRequest in project datarouter by hotpads.
the class AwsSecretClient method update.
@Override
public final void update(Secret secret) {
// this can update various stuff (like description and kms key) AND updates the version stage to AWSCURRENT.
// for rotation, use PutSecretValue, which only updates the version stages and value of a secret explicitly
var request = new UpdateSecretRequest().withSecretId(secret.getName()).withSecretString(secret.getValue());
try {
try (var $ = TracerTool.startSpan("AWSSecretsManager updateSecret", TraceSpanGroupType.CLOUD_STORAGE)) {
TracerTool.appendToSpanInfo(secret.getName());
client.updateSecret(request);
}
} catch (ResourceExistsException e) {
throw new SecretExistsException("Requested update already exists.", secret.getName(), e);
} catch (ResourceNotFoundException e) {
throw new SecretNotFoundException(secret.getName(), e);
}
}
Aggregations