Class VaultEndpoint

java.lang.Object
org.springframework.vault.client.VaultEndpoint
All Implemented Interfaces:
Serializable

public class VaultEndpoint extends Object implements Serializable
Value object that defines Vault connection coordinates.

A VaultEndpoint defines the hostname, TCP port, the protocol scheme (HTTP or HTTPS), and the context path prefix. The path defaults to API_VERSION.

Author:
Mark Paluch
See Also:
  • Field Details

  • Constructor Details

    • VaultEndpoint

      public VaultEndpoint()
  • Method Details

    • create

      public static VaultEndpoint create(String host, int port)
      Create a secure VaultEndpoint given a host and port using https.
      Parameters:
      host - must not be empty or null.
      port - must be a valid port in the range of 1-65535
      Returns:
      a new VaultEndpoint.
    • from

      public static VaultEndpoint from(String uri)
      Create a VaultEndpoint given a URI.
      Parameters:
      uri - must contain hostname, port and scheme, must not be empty or null.
      Returns:
      a new VaultEndpoint.
      Since:
      3.1
      See Also:
    • from

      public static VaultEndpoint from(URI uri)
      Create a VaultEndpoint given a URI.
      Parameters:
      uri - must contain hostname, port and scheme, must not be empty or null.
      Returns:
      a new VaultEndpoint.
    • getHost

      public String getHost()
      Returns:
      the hostname.
    • setHost

      public void setHost(String host)
      Sets the hostname.
      Parameters:
      host - must not be empty or null.
    • getPort

      public int getPort()
      Returns:
      the port.
    • setPort

      public void setPort(int port)
      Parameters:
      port - must be a valid port in the range of 1-65535
    • getScheme

      public String getScheme()
      Returns:
      the protocol scheme.
    • setScheme

      public void setScheme(String scheme)
      Parameters:
      scheme - must be http or https.
    • getPath

      public String getPath()
      Returns:
      the context path prefix.
      Since:
      2.1
    • setPath

      public void setPath(String path)
      Parameters:
      path - context path prefix. Must not be null or empty and must not start with a leading slash.
      Since:
      2.1
    • createUri

      public URI createUri(String path)
      Build the Vault URI based on the given path.
      Parameters:
      path - must not be empty or null.
      Returns:
      constructed URI.
    • createUriString

      public String createUriString(String path)
      Build the Vault URI string based on the given path.
      Parameters:
      path - must not be empty or null.
      Returns:
      constructed URI 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