Class Secret


  • public final class Secret
    extends Object
    Keeps a secret.
    • Constructor Detail

      • Secret

        public Secret​(String name,
                      boolean env,
                      net.morimekta.collect.util.Binary value)
        Create a secret.
        Parameters:
        name - The name of the secret.
        env - If the secret comes from environment.
        value - The initial secret value.
    • Method Detail

      • getName

        public String getName()
        Returns:
        The secret name. The name is surrounded with '${}' if it comes from environment.
      • getAsString

        public String getAsString()
        Returns:
        The secret value as string.
      • getAsBytes

        public byte[] getAsBytes()
        Returns:
        The secret value as bytes.
      • getAsBinary

        public net.morimekta.collect.util.Binary getAsBinary()
        Returns:
        The secret value as binary.
      • addListener

        public void addListener​(SecretListener listener)
        Add a listener for secret changes.
        Parameters:
        listener - The secret change listener.
      • removeListener

        public void removeListener​(SecretListener listener)
        Remove a listener for secret changes.
        Parameters:
        listener - The secret change listener.
      • setSecret

        public void setSecret​(net.morimekta.collect.util.Binary secret)
        Set the secret to a new value. Should only be called from SecretsManager, and is mainly visible for testing purposes.
        Parameters:
        secret - The secret value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object