Class PatchKeySpec.Builder
java.lang.Object
co.ankatech.ankasecure.sdk.model.PatchKeySpec.Builder
- Enclosing class:
PatchKeySpec
Fluent builder for assembling a
PatchKeySpec
.
Each mutator sets one of the optional attributes that can be patched
on a key. Attributes left null
are omitted from the JSON
Merge-Patch produced by PatchKeySpec.toMergePatch()
.
Example
PatchKeySpec spec = new PatchKeySpec.Builder()
.expiresAt(Instant.parse("2030-05-31T23:59:59Z"))
.softUsageLimit(10_000)
.build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aPatchKeySpec
instance.Sets the hard expiration date of the key.maxUsageLimit
(int limit) Sets the hard usage limit (absolute cap).Sets the soft-limit expiration date.softUsageLimit
(int limit) Sets the soft usage limit (number of allowed operations before the soft-limit warning).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
expiresAt
Sets the hard expiration date of the key.- Parameters:
t
- UTC instant (RFC 3339); must not benull
- Returns:
- this builder for chaining
- Throws:
NullPointerException
- ift
isnull
-
softLimitExpiration
Sets the soft-limit expiration date. The key remains usable after this instant, but a renewal reminder can be issued.- Parameters:
t
- UTC instant (RFC 3339); must not benull
- Returns:
- this builder for chaining
- Throws:
NullPointerException
- ift
isnull
-
softUsageLimit
Sets the soft usage limit (number of allowed operations before the soft-limit warning).- Parameters:
limit
- positive integer- Returns:
- this builder for chaining
-
maxUsageLimit
Sets the hard usage limit (absolute cap). When reached the key becomes invalid.- Parameters:
limit
- positive integer- Returns:
- this builder for chaining
-
build
Builds aPatchKeySpec
instance.- Returns:
- a new patch specification
- Throws:
IllegalStateException
- if every field isnull
-