Interface ManagedSecret.SecretAccessor
- All Known Subinterfaces:
ManagedSecret.UsernamePassword
- Enclosing class:
- ManagedSecret
public static interface ManagedSecret.SecretAccessor
Interface to access secrets obtained from Vault.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <P> Pas(Function<? super ManagedSecret.SecretAccessor, P> transformer) Transform thisManagedSecret.SecretAccessorinto a target type.@Nullable ObjectReturn the value for the given key.<T> @Nullable TReturn the value for the given key.default intReturn the requiredintvalue for the given key or throwNoSuchElementException.default intReturn theintvalue for the given key ordefaultValueif the key is not present or its value wasnull.default intgetInt(String key, IntSupplier defaultValue) Return theintvalue for the given key or the value ofIntSupplier.getAsInt()if the key is not present or its value wasnull.default longReturn the requiredlongvalue for the given key or throwNoSuchElementException.default longReturn thelongvalue for the given key ordefaultValueif the key is not present or its value wasnull.default longgetLong(String key, LongSupplier defaultValue) Return thelongvalue for the given key or the value ofLongSupplier.getAsLong()if the key is not present or its value wasnull.default <T> TgetRequired(String key, Class<T> expectedType) Return the required value for the given key or throwNoSuchElementException.default StringgetRequiredString(String key) Return the requiredStringvalue for the given key or throwNoSuchElementException.default @Nullable StringReturn theStringvalue for the given key.default StringReturn theStringvalue for the given key ordefaultValueif the key is not present or its value wasnull.default StringReturn theStringvalue for the given key or the value ofSupplier.get()if the key is not present or its value wasnull.
-
Method Details
-
getInt
Return the requiredintvalue for the given key or throwNoSuchElementException.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped.
- Throws:
NoSuchElementException- if the key is not present or its value was null.
-
getInt
Return theintvalue for the given key ordefaultValueif the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
defaultValue.
-
getInt
Return theintvalue for the given key or the value ofIntSupplier.getAsInt()if the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
IntSupplier.getAsInt().
-
getLong
Return the requiredlongvalue for the given key or throwNoSuchElementException.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped.
- Throws:
NoSuchElementException- if the key is not present or its value was null.
-
getLong
Return thelongvalue for the given key ordefaultValueif the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
defaultValue.
-
getLong
Return thelongvalue for the given key or the value ofLongSupplier.getAsLong()if the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
LongSupplier.getAsLong().
-
getString
Return theStringvalue for the given key.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped, can be null.
-
getRequiredString
Return the requiredStringvalue for the given key or throwNoSuchElementException.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped.
- Throws:
NoSuchElementException- if the key is not present or its value was null.
-
getString
Return theStringvalue for the given key ordefaultValueif the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
defaultValue.
-
getString
Return theStringvalue for the given key or the value ofSupplier.get()if the key is not present or its value wasnull.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped or
Supplier.get().
-
getRequired
Return the required value for the given key or throwNoSuchElementException.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped.
- Throws:
NoSuchElementException- if the key is not present or its value was null.
-
get
Return the value for the given key.- Parameters:
key- the key whose associated value is to be returned.- Returns:
- the value to which the specified key is mapped, can be null.
-
get
Return the value for the given key.- Parameters:
key- the key whose associated value is to be returned.expectedType- the expected data type.- Returns:
- the value to which the specified key is mapped, can be null.
-
as
Transform thisManagedSecret.SecretAccessorinto a target type.accessor.as(UsernamePassword::from)- Type Parameters:
P- the returned instance type- Parameters:
transformer- theFunctionto map thisSecretsAccessorinto a target type instance.- Returns:
- the
SecretsAccessortransformed to an instance ofP
-