in neptune-gremlin-client/gremlin-client/src/main/java/software/amazon/neptune/cluster/NeptuneGremlinClusterBuilder.java [310:360]
public GremlinCluster create() {
if (addresses.isEmpty()) {
if (isDirectConnection()) {
throw new IllegalArgumentException("You must supply one or more Neptune endpoints");
} else if (enableIamAuth) {
throw new IllegalArgumentException("You must supply one or more Neptune endpoints to sign the Host header");
}
}
if (isDirectConnection()) {
innerBuilder.port(port);
for (String address : addresses) {
innerBuilder.addContactPoint(address);
}
} else {
innerBuilder.port(loadBalancerPort);
if (networkLoadBalancerEndpoint != null) {
innerBuilder.addContactPoint(networkLoadBalancerEndpoint);
} else if (applicationLoadBalancerEndpoint != null) {
innerBuilder.addContactPoint(applicationLoadBalancerEndpoint);
}
}
if (interceptor != null) {
innerBuilder.handshakeInterceptor(interceptor);
} else if (enableIamAuth) {
IamAuthConfig.IamAuthConfigBuilder iamAuthConfigBuilder =
IamAuthConfig.builder()
.addNeptuneEndpoints(addresses)
.setNeptunePort(port)
.setServiceRegion(serviceRegion)
.setIamProfile(iamProfile)
.setCredentials(credentials);
if (!isDirectConnection()) {
iamAuthConfigBuilder.connectViaLoadBalancer();
}
if (applicationLoadBalancerEndpoint != null) {
iamAuthConfigBuilder.removeHostHeaderAfterSigning();
}
IamAuthConfig iamAuthConfig = iamAuthConfigBuilder.build();
innerBuilder.handshakeInterceptor(new LBAwareHandshakeInterceptor(iamAuthConfig));
}
return innerBuilder.create();
}