public Cluster create()

in gremlin/gremlin-java-client-demo/src/main/java/org/apache/tinkerpop/gremlin/driver/NeptuneClusterBuilder.java [269:319]


    public Cluster 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) {
                System.out.println("Adding " + networkLoadBalancerEndpoint);
                innerBuilder.addContactPoint(networkLoadBalancerEndpoint);
            } else if (applicationLoadBalancerEndpoint != null) {
                innerBuilder.addContactPoint(applicationLoadBalancerEndpoint);
            }
        }

        if (enableIamAuth) {

            if (isDirectConnection()) {
                innerBuilder.channelizer(SigV4WebSocketChannelizer.class);
            } else {

                HandshakeRequestConfig.HandshakeRequestConfigBuilder handshakeRequestConfigBuilder =
                        HandshakeRequestConfig.builder()
                                .addNeptuneEndpoints(addresses)
                                .setNeptunePort(port);

                if (applicationLoadBalancerEndpoint != null) {
                    handshakeRequestConfigBuilder.removeHostHeaderAfterSigning();
                }

                HandshakeRequestConfig handshakeRequestConfig = handshakeRequestConfigBuilder.build();

                innerBuilder
                        // We're using the JAAS_ENTRY auth property to tunnel Host header info to the channelizer
                        .jaasEntry(handshakeRequestConfig.value())
                        .channelizer(LBAwareSigV4WebSocketChannelizer.class);
            }
        }

        return innerBuilder.create();
    }