Class OrderedStableIdResolver
- java.lang.Object
-
- org.forgerock.secrets.propertyresolver.OrderedStableIdResolver
-
- All Implemented Interfaces:
StableIdResolver
public class OrderedStableIdResolver extends Object implements StableIdResolver
AStableIdResolver
that uses a version suffix and a subsequent number to determine the stableId of aSecret
. 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
Constructors Constructor Description OrderedStableIdResolver(String versionSuffix)
Constructor for OrderedVersionStableIdResolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<SecretResource>
candidatesForPurpose(Stream<SecretResource> candidates, String purpose)
Creates candidate stream in order from latest to oldest, latest being the active secret for the purpose label.String
getPurposeLabelFromStableId(String stableId)
Pulls the purpose label from the stableId.
-
-
-
Constructor Detail
-
OrderedStableIdResolver
public OrderedStableIdResolver(String versionSuffix)
Constructor for OrderedVersionStableIdResolver.- Parameters:
versionSuffix
- the version suffix prepended to each version
-
-
Method Detail
-
getPurposeLabelFromStableId
public String getPurposeLabelFromStableId(String stableId)
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
-
-