in common/lib/authentication/aws_secrets_manager_plugin.ts [46:82]
constructor(pluginService: PluginService, properties: Map<string, any>) {
super();
this.pluginService = pluginService;
const secretId = WrapperProperties.SECRET_ID.get(properties);
const endpoint = WrapperProperties.SECRET_ENDPOINT.get(properties);
let region = WrapperProperties.SECRET_REGION.get(properties);
const config: SecretsManagerClientConfig = {};
if (!secretId) {
throw new AwsWrapperError(Messages.get("AwsSecretsManagerConnectionPlugin.missingRequiredConfigParameter", WrapperProperties.SECRET_ID.name));
}
if (!region) {
const groups = secretId.match(AwsSecretsManagerPlugin.SECRETS_ARN_PATTERN)?.groups;
if (groups?.region) {
region = groups.region;
} else {
throw new AwsWrapperError(
Messages.get("AwsSecretsManagerConnectionPlugin.missingRequiredConfigParameter", WrapperProperties.SECRET_REGION.name)
);
}
}
config.region = region;
if (endpoint) {
config.endpoint = endpoint;
}
this.secretKey = new SecretCacheKey(secretId, region);
this.secretsManagerClient = new SecretsManagerClient(config);
this.fetchCredentialsCounter = this.pluginService
.getTelemetryFactory()
.createCounter(AwsSecretsManagerPlugin.TELEMETRY_FETCH_CREDENTIALS_COUNTER);
}