private String getServiceRegion()

in gremlin-client/src/main/java/software/amazon/neptune/cluster/LBAwareHandshakeInterceptor.java [96:117]


    private String getServiceRegion() {

        if (StringUtils.isNotEmpty(iamAuthConfig.serviceRegion())) {
            logger.debug("Using service region supplied in config");
            return iamAuthConfig.serviceRegion();
        } else if (StringUtils.isNotEmpty(System.getenv("SERVICE_REGION"))) {
            logger.debug("Using SERVICE_REGION environment variable as service region");
            return StringUtils.trim(System.getenv("SERVICE_REGION"));
        } else if (StringUtils.isNotEmpty(System.getProperty("SERVICE_REGION"))) {
            logger.debug("Using SERVICE_REGION system property as service region");
            return StringUtils.trim(System.getProperty("SERVICE_REGION"));
        } else {
            String currentRegionName = RegionUtils.getCurrentRegionName();
            if (currentRegionName != null) {
                logger.debug("Using current region as service region");
                return currentRegionName;
            } else {
                throw new IllegalStateException("Unable to determine Neptune service region. Use the SERVICE_REGION environment variable or system property, or the NeptuneGremlinClusterBuilder.serviceRegion() method to specify the Neptune service region.");
            }
        }

    }