private void establishConnection()

in java/datastax-v4/connection-lambda/src/main/java/example/KeyspacesSigV4Session.java [45:76]


    private void establishConnection(LambdaLogger logger) throws Exception {
        if (session != null) {
            return;
        }

        File trustStore = getTrustStoreFile(SSL_TRUSTSTORE_FILENAME);

        System.setProperty(SSL_TRUSTSTORE_PROPERTY_NAME, trustStore.getAbsolutePath());
        String SSL_TRUSTSTORE_PASSWORD = System.getenv("SSL_TRUSTSTORE_PASSWORD");

        if (StringUtils.isNullOrEmpty(SSL_TRUSTSTORE_PASSWORD)) {
            logger.log("SSL_TRUSTSTORE_PASSWORD: not found");
        } else {
            logger.log("SSL_TRUSTSTORE_PASSWORD: found");
        }

        System.setProperty(SSL_TRUSTSTORE_PASSWORD_PROPERTY_NAME, SSL_TRUSTSTORE_PASSWORD);

        String region = System.getenv("AWS_REGION");
        logger.log("AWS_REGION: " + region);

        SSLContext context = SSLContext.getDefault();

        logger.log("Preparing to build session");
        DriverConfigLoader loader = DriverConfigLoader.fromClasspath("application.conf");

        this.session = CqlSession.builder()
                                 .withConfigLoader(loader)
                                 .build();
        logger.log("Finished building session");

    }