Class SecureSetting<T>

  • All Implemented Interfaces:
    ToXContent, ToXContentObject

    public abstract class SecureSetting<T>
    extends Setting<T>
    A secure setting. This class allows access to settings from the Elasticsearch keystore.
    • Method Detail

      • getDefaultRaw

        public java.lang.String getDefaultRaw​(Settings settings)
        Description copied from class: Setting
        Returns the default value string representation for this setting.
        Overrides:
        getDefaultRaw in class Setting<T>
        Parameters:
        settings - a settings object for settings that has a default value depending on another setting if available
      • getDefault

        public T getDefault​(Settings settings)
        Description copied from class: Setting
        Returns the default value for this setting.
        Overrides:
        getDefault in class Setting<T>
        Parameters:
        settings - a settings object for settings that has a default value depending on another setting if available
      • getRaw

        public java.lang.String getRaw​(Settings settings)
        Description copied from class: Setting
        Returns the raw (string) settings value. If the setting is not present in the given settings object the default value is returned instead. This is useful if the value can't be parsed due to an invalid value to access the actual value.
        Overrides:
        getRaw in class Setting<T>
      • exists

        public boolean exists​(Settings settings)
        Description copied from class: Setting
        Returns true iff this setting is present in the given settings object. Otherwise false
        Overrides:
        exists in class Setting<T>
      • get

        public T get​(Settings settings)
        Description copied from class: Setting
        Returns the settings value. If the setting is not present in the given settings object the default value is returned instead.
        Overrides:
        get in class Setting<T>
      • diff

        public void diff​(Settings.Builder builder,
                         Settings source,
                         Settings defaultSettings)
        Overrides the diff operation to make this a no-op for secure settings as they shouldn't be returned in a diff
        Overrides:
        diff in class Setting<T>
        Parameters:
        builder - the settings builder to fill the diff into
        source - the source settings object to diff
        defaultSettings - the default settings object to diff against
      • secureString

        public static Setting<SecureString> secureString​(java.lang.String name,
                                                         Setting<SecureString> fallback,
                                                         Setting.Property... properties)
        A setting which contains a sensitive string. This may be any sensitive string, e.g. a username, a password, an auth token, etc.
      • secureFile

        public static Setting<java.io.InputStream> secureFile​(java.lang.String name,
                                                              Setting<java.io.InputStream> fallback,
                                                              Setting.Property... properties)
        A setting which contains a file. Reading the setting opens an input stream to the file. This may be any sensitive file, e.g. a set of credentials normally in plaintext.