Class Tunnel

java.lang.Object
com.ngrok.definitions.Tunnel

public class Tunnel extends Object
A class encapsulating the Tunnel resource.
  • Constructor Details

    • Tunnel

      public Tunnel(String id, URI publicUrl, OffsetDateTime startedAt, String metadata, String proto, String region, Ref tunnelSession, Optional<Ref> endpoint, Map<String,String> labels, Optional<List<Ref>> backends, String forwardsTo)
      Creates a new instance of Tunnel.
      Parameters:
      id - unique tunnel resource identifier
      publicUrl - URL of the ephemeral tunnel's public endpoint
      startedAt - timestamp when the tunnel was initiated in RFC 3339 format
      metadata - user-supplied metadata for the tunnel defined in the ngrok configuration file. See the tunnel metadata configuration option In API version 0, this value was instead pulled from the top-level metadata configuration option.
      proto - tunnel protocol for ephemeral tunnels. one of http, https, tcp or tls
      region - identifier of tune region where the tunnel is running
      tunnelSession - reference object pointing to the tunnel session on which this tunnel was started
      endpoint - the ephemeral endpoint this tunnel is associated with, if this is an agent-initiated tunnel
      labels - the labels the tunnel group backends will match against, if this is a backend tunnel
      backends - tunnel group backends served by this backend tunnel
      forwardsTo - upstream address the ngrok agent forwards traffic over this tunnel to. this may be expressed as a URL or a network address.
  • Method Details

    • getId

      public String getId()
      unique tunnel resource identifier
      Returns:
      the value of the property as a String
    • getPublicUrl

      public URI getPublicUrl()
      URL of the ephemeral tunnel's public endpoint
      Returns:
      the value of the property as a URI
    • getStartedAt

      public OffsetDateTime getStartedAt()
      timestamp when the tunnel was initiated in RFC 3339 format
      Returns:
      the value of the property as a OffsetDateTime
    • getMetadata

      public String getMetadata()
      user-supplied metadata for the tunnel defined in the ngrok configuration file. See the tunnel metadata configuration option In API version 0, this value was instead pulled from the top-level metadata configuration option.
      Returns:
      the value of the property as a String
    • getProto

      public String getProto()
      tunnel protocol for ephemeral tunnels. one of http, https, tcp or tls
      Returns:
      the value of the property as a String
    • getRegion

      public String getRegion()
      identifier of tune region where the tunnel is running
      Returns:
      the value of the property as a String
    • getTunnelSession

      public Ref getTunnelSession()
      reference object pointing to the tunnel session on which this tunnel was started
      Returns:
      the value of the property as a Ref
    • getEndpoint

      public Optional<Ref> getEndpoint()
      the ephemeral endpoint this tunnel is associated with, if this is an agent-initiated tunnel
      Returns:
      the value of the property as a Ref wrapped in an Optional
    • getLabels

      public Map<String,String> getLabels()
      the labels the tunnel group backends will match against, if this is a backend tunnel
      Returns:
      the value of the property as a Map of String to String
    • getBackends

      public Optional<List<Ref>> getBackends()
      tunnel group backends served by this backend tunnel
      Returns:
      the value of the property as a List of Ref wrapped in an Optional
    • getForwardsTo

      public String getForwardsTo()
      upstream address the ngrok agent forwards traffic over this tunnel to. this may be expressed as a URL or a network address.
      Returns:
      the value of the property as a String
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object