Class OrderedStableIdResolver
java.lang.Object
org.forgerock.secrets.propertyresolver.OrderedStableIdResolver
- All Implemented Interfaces:
StableIdResolver
A
StableIdResolver
that uses a version suffix and a subsequent number to determine
the stableId of a Secret
.
For example, using a version suffix of '.v' with a purpose of 'purpose' the stableIds in order would be:
purpose, purpose.v1, purpose.v2, purpose.v3 etc. with the id with the largest number being the active secret.
Cases where there are leading zeroes like purpose.v01 would have .v01 be later than .v1 and before .v2.
For example the order with leading zeroes would be: purpose, purpose.v1, purpose.v01, purpose.v001 purpose.v2.-
Constructor Summary
ConstructorDescriptionOrderedStableIdResolver
(String versionSuffix) Constructor for OrderedVersionStableIdResolver. -
Method Summary
Modifier and TypeMethodDescriptioncandidatesForPurpose
(Stream<SecretResource> candidates, String purpose) Creates candidate stream in order from latest to oldest, latest being the active secret for the purpose label.getPurposeLabelFromStableId
(String stableId) Pulls the purpose label from the stableId.
-
Constructor Details
-
OrderedStableIdResolver
Constructor for OrderedVersionStableIdResolver.- Parameters:
versionSuffix
- the version suffix prepended to each version
-
-
Method Details
-
getPurposeLabelFromStableId
Description copied from interface:StableIdResolver
Pulls the purpose label from the stableId.- Specified by:
getPurposeLabelFromStableId
in interfaceStableIdResolver
- Parameters:
stableId
- The stableId of a secret- Returns:
- The purpose label of the given stableId
-
candidatesForPurpose
public Stream<SecretResource> candidatesForPurpose(Stream<SecretResource> candidates, String purpose) Description copied from interface:StableIdResolver
Creates candidate stream in order from latest to oldest, latest being the active secret for the purpose label.- Specified by:
candidatesForPurpose
in interfaceStableIdResolver
- Parameters:
candidates
- stream of candidate secret resources for the secretpurpose
- purpose label for the secret to match candidates to- Returns:
- stream of
SecretResource
-