@Override
  public String getSecret(URI uri) throws IOException {
    Preconditions.checkArgument(getURIScheme().equals(uri.getScheme()));
    initCache();
    String key = uri.getPath();
    key = key.substring(1); // remove the leading slash.

    String secretsString;
    try {
      secretsString = cache.getSecretString(key);
    } catch (Exception e) {
      // Wrap any exception from the above service call to IOException.
      throw new IOException("Error trying to get secret", e);
    }
    if (secretsString == null) {
      throw new IOException("secret was not found");
    }
    try {
      JsonNode passwd = mapper.readTree(secretsString).get("password");
      if (passwd == null) {
        throw new IOException("Expected \"password\" field in secrets json.");
      }
      return passwd.asText();
    } catch (JsonProcessingException e) {
      // Suppress the nested exception, since it may contain info from the secretsString, which should not be leaked.
      throw new IOException("Exception while parsing secretstring as json. Check secret string stored.");
    }
  }
This load the secret from aws-secrets manager.
@param uri The uri should be of format: aws-sm:///{key-arn-or-name}
@return The secret fetched from AWS.
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/secrets/AWSSecretsManagerSecretSource.java