Class CreateTunnel.Builder

  • Enclosing class:
    CreateTunnel

    public static class CreateTunnel.Builder
    extends java.lang.Object
    Builder for a CreateTunnel, which can be used to construct a request that conforms to ngrok's tunnel definition. See docs for that class for example usage.
    • Constructor Detail

      • Builder

        public Builder()
        Use this constructor if default values should not be populated in required attributes when build() is called.

        If required attributes are not set in the built CreateTunnel, default values will be used in methods like NgrokClient.connect(CreateTunnel).

      • Builder

        public Builder​(boolean setDefaults)
        Use this constructor if default values should be populated in required attributes when build() is called.
        Parameters:
        setDefaults - true to populate defaults.
      • Builder

        public Builder​(CreateTunnel createTunnel)
        Copy a CreateTunnel in to a new Builder. Using this constructor will also set default attributes when build() is called.
        Parameters:
        createTunnel - The CreateTunnel to copy.
    • Method Detail

      • withName

        public CreateTunnel.Builder withName​(java.lang.String name)
        The name of the tunnel.
      • withoutInspect

        public CreateTunnel.Builder withoutInspect()
        Disable HTTP request inspection on tunnels.
      • withAuth

        public CreateTunnel.Builder withAuth​(java.lang.String auth)
        HTTP basic authentication credentials to enforce on tunneled requests
      • withHostHeader

        public CreateTunnel.Builder withHostHeader​(java.lang.String hostHeader)
        Rewrite the HTTP Host header to this value, or preserve to leave it unchanged.
      • withSubdomain

        public CreateTunnel.Builder withSubdomain​(java.lang.String subdomain)
        Subdomain name to request. If unspecified, uses the tunnel name.
      • withHostname

        public CreateTunnel.Builder withHostname​(java.lang.String hostname)
        Hostname to request (requires reserved name and DNS CNAME).
      • withCrt

        public CreateTunnel.Builder withCrt​(java.lang.String crt)
        PEM TLS certificate at this path to terminate TLS traffic before forwarding locally.
      • withKey

        public CreateTunnel.Builder withKey​(java.lang.String key)
        PEM TLS private key at this path to terminate TLS traffic before forwarding locally.
      • withClientCas

        public CreateTunnel.Builder withClientCas​(java.lang.String clientCas)
        PEM TLS certificate authority at this path will verify incoming TLS client connection certificates.
      • withRemoteAddr

        public CreateTunnel.Builder withRemoteAddr​(java.lang.String remoteAddr)
        Bind the remote TCP port on the given address.
      • withMetadata

        public CreateTunnel.Builder withMetadata​(java.lang.String metadata)
        Arbitrary user-defined metadata that will appear in the ngrok service API when listing tunnels.
      • withTunnelDefinition

        public void withTunnelDefinition​(java.util.Map<java.lang.String,​java.lang.Object> tunnelDefinition)
        Populate any null attributes (with the exception of name) in this Builder with values from the given tunnelDefinition.
        Parameters:
        tunnelDefinition - The map from which null attributes will be populated.