Class CreateToken.Request
- java.lang.Object
-
- io.helidon.integrations.common.rest.ApiJsonBuilder<T>
-
- io.helidon.integrations.common.rest.ApiJsonRequest<T>
-
- io.helidon.integrations.vault.VaultRequest<CreateToken.Request>
-
- io.helidon.integrations.vault.auths.token.CreateToken.Request
-
- All Implemented Interfaces:
ApiRequest<CreateToken.Request>
- Enclosing class:
- CreateToken
public static class CreateToken.Request extends VaultRequest<CreateToken.Request>
Request object. Can be configured with additional headers, query parameters etc.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CreateToken.Request
addMetadata(String key, String value)
Request metadata, passed through to the audit devices.CreateToken.Request
addPolicy(String policy)
Add a policy for the token.static CreateToken.Request
builder()
Fluent API builder for configuring a request.CreateToken.Request
displayName(String displayName)
The display name of the token.CreateToken.Request
entityAlias(String entityAlias)
Name of the entity alias to associate with during token creation.CreateToken.Request
explicitMaxTtl(Duration explicitMaxTtl)
If set, the token will have an explicit max TTL set upon it.CreateToken.Request
id(String id)
The ID of the client token.CreateToken.Request
noDefaultPolicy(boolean noDefaultPolicy)
If configured totrue
, thedefault
policy will not be contained in this token's policy set.CreateToken.Request
noParent(boolean noParent)
This argument only has effect if used by a root or sudo caller.CreateToken.Request
numUses(int numUses)
The maximum uses for the given token.CreateToken.Request
period(String period)
If specified, the token will be periodic; it will have no maximum TTL (unless an "explicit-max-ttl" is also set) but every renewal will use the given period.CreateToken.Request
renewable(boolean renewable)
Set tofalse
to disable the ability of the token to be renewed past its initial TTL.CreateToken.Request
roleName(String roleName)
The name of the token role.CreateToken.Request
ttl(Duration ttl)
The TTL period of the token.CreateToken.Request
type(String type)
Choose token type.-
Methods inherited from class io.helidon.integrations.vault.VaultRequest
add, addCommaDelimitedArray, addToCommaDelimitedArray, durationToTtl, preBuild
-
Methods inherited from class io.helidon.integrations.common.rest.ApiJsonRequest
addHeader, addQueryParam, headers, queryParams, requestId, requestId, requestMediaType, requestMediaType, responseMediaType, responseMediaType
-
Methods inherited from class io.helidon.integrations.common.rest.ApiJsonBuilder
add, add, add, add, add, add, addBase64, addToArray, addToArray, addToArray, addToArray, addToArray, addToArray, addToObject, addToObject, addToObject, addToObject, addToObject, emptyArray, me, postBuild, toJson
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.integrations.common.rest.ApiRequest
toJson
-
-
-
-
Method Detail
-
builder
public static CreateToken.Request builder()
Fluent API builder for configuring a request. The request builder is passed as is, without a build method. The equivalent of a build method isApiJsonBuilder.toJson(javax.json.JsonBuilderFactory)
used by theRestApi
.- Returns:
- new request builder
-
addPolicy
public CreateToken.Request addPolicy(String policy)
Add a policy for the token. Policies must be a subset of the policies belonging to the token making the request, unless root. If not specified, defaults to all the policies of the calling token.- Parameters:
policy
- policy to add- Returns:
- updated request
-
addMetadata
public CreateToken.Request addMetadata(String key, String value)
Request metadata, passed through to the audit devices.- Parameters:
key
- namevalue
- value- Returns:
- updated request
-
noParent
public CreateToken.Request noParent(boolean noParent)
This argument only has effect if used by a root or sudo caller. When set to true, the token created will not have a parent.- Parameters:
noParent
- set totrue
to create an orphan token- Returns:
- updated request
-
noDefaultPolicy
public CreateToken.Request noDefaultPolicy(boolean noDefaultPolicy)
If configured totrue
, thedefault
policy will not be contained in this token's policy set.- Parameters:
noDefaultPolicy
- whether to exclude default policy- Returns:
- updated request
-
renewable
public CreateToken.Request renewable(boolean renewable)
Set tofalse
to disable the ability of the token to be renewed past its initial TTL. Setting the value totrue
will allow the token to be renewable up to the system/mount maximum TTL.Defaults to
true
.- Parameters:
renewable
- whether the token should be renewable- Returns:
- updated request
-
numUses
public CreateToken.Request numUses(int numUses)
The maximum uses for the given token. This can be used to create a one-time-token or limited use token. The value of 0 has no limit to the number of uses.- Parameters:
numUses
- number of uses, defaults to0
- unlimited- Returns:
- updated request
-
id
public CreateToken.Request id(String id)
The ID of the client token. Can only be specified by a root token. The ID provided may not contain a . character. Otherwise, the token ID is a randomly generated value.Note: The ID should not start with the s. prefix.
- Parameters:
id
- id of the client token- Returns:
- updated request
-
roleName
public CreateToken.Request roleName(String roleName)
The name of the token role.- Parameters:
roleName
- role name- Returns:
- updated request
-
type
public CreateToken.Request type(String type)
Choose token type. Defaults to "service".- Parameters:
type
- token type- Returns:
- updated request
- See Also:
TokenAuthRx.TYPE_SERVICE
,TokenAuthRx.TYPE_BATCH
-
displayName
public CreateToken.Request displayName(String displayName)
The display name of the token.- Parameters:
displayName
- display name- Returns:
- updated request
-
entityAlias
public CreateToken.Request entityAlias(String entityAlias)
Name of the entity alias to associate with during token creation. Only works in combination with role_name argument and used entity alias must be listed in allowed_entity_aliases. If this has been specified, the entity will not be inherited from the parent.- Parameters:
entityAlias
- entity alias- Returns:
- updated request
-
period
public CreateToken.Request period(String period)
If specified, the token will be periodic; it will have no maximum TTL (unless an "explicit-max-ttl" is also set) but every renewal will use the given period. Requires a root token or one with the sudo capability.- Parameters:
period
- period- Returns:
- updated request
-
ttl
public CreateToken.Request ttl(Duration ttl)
The TTL period of the token. If not provided, the token is valid for the default lease TTL, or indefinitely if the root policy is used.- Parameters:
ttl
- duration of the token, smallest unit is seconds- Returns:
- updated request
-
explicitMaxTtl
public CreateToken.Request explicitMaxTtl(Duration explicitMaxTtl)
If set, the token will have an explicit max TTL set upon it. This maximum token TTL cannot be changed later, and unlike with normal tokens, updates to the system/mount max TTL value will have no effect at renewal time -- the token will never be able to be renewed or used past the value set at issue time.- Parameters:
explicitMaxTtl
- duration of the max TTL, smallest unit is seconds- Returns:
- updated request
-
-