private Properties getProperties()

in jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDataSource.java [704:752]


  private Properties getProperties(final String accessKey, final String secretKey)
    throws SQLException {
    final Properties properties = new Properties();
    if (accessKey != null && secretKey != null) {
      properties.put(TimestreamConnectionProperty.ACCESS_KEY_ID.getConnectionProperty(), accessKey);
      properties.put(TimestreamConnectionProperty.SECRET_ACCESS_KEY.getConnectionProperty(), secretKey);
    }

    if (this.getSessionToken() != null) {
      properties.put(TimestreamConnectionProperty.SESSION_TOKEN.getConnectionProperty(), this.getSessionToken());
    }

    if (this.endpoint != null) {
      if (this.endpoint.isEmpty()) {
        final String error = Error.lookup(Error.INVALID_ENDPOINT);
        LOGGER.severe(error);
        throw new SQLException(error);
      }

      if (this.region == null) {
        final String error = Error.lookup(Error.MISSING_SERVICE_REGION);
        LOGGER.severe(error);
        throw new SQLException(error);
      }

      properties.put(TimestreamConnectionProperty.ENDPOINT.getConnectionProperty(), this.endpoint);
      properties.put(TimestreamConnectionProperty.REGION.getConnectionProperty(), this.region);
    }

    if (this.samlAuthenticationProperties
        .get(TimestreamConnectionProperty.IDP_NAME.getConnectionProperty()) != null) {
      properties.putAll(samlAuthenticationProperties);
    }

    if (this.credentialsProviderClass != null) {
      properties.put(
        TimestreamConnectionProperty.AWS_CREDENTIALS_PROVIDER_CLASS.getConnectionProperty(),
        this.credentialsProviderClass);

      if (this.credentialsFilePath != null) {
        properties.put(
          TimestreamConnectionProperty.CUSTOM_CREDENTIALS_FILE_PATH.getConnectionProperty(),
          this.credentialsFilePath);
      }
    }

    properties.putAll(sdkProperties);
    return properties;
  }