Package codes.grow.packages.vault
Class Sys
java.lang.Object
codes.grow.packages.vault.Sys
System backend:
client.sys() (health, seal status, leader, capabilities, policies,
mounts, auth methods, AppRole admin). Most write calls need a privileged (root or sudo) token.-
Method Summary
Modifier and TypeMethodDescriptioncapabilities(String token, String... paths) Another token's capabilities on each path (POST sys/capabilities; the caller needsupdateonsys/capabilities, otherwisePermissionDeniedException).capabilities(String token, List<String> paths) Another token's capabilities on each path (POST sys/capabilities).capabilitiesAsync(String token, List<String> paths) Asynchronouscapabilities(String, List).capabilitiesSelf(String... paths) The client token's capabilities on each path (POST sys/capabilities-self), so callers can check a policy before acting.capabilitiesSelf(List<String> paths) The client token's capabilities on each path (POST sys/capabilities-self).capabilitiesSelfAsync(List<String> paths) AsynchronouscapabilitiesSelf(List).voidcreateAppRole(String name, AppRoleOptions options) Creates or updates an AppRole role.createAppRoleAsync(String name, AppRoleOptions o) AsynchronouscreateAppRole(String, AppRoleOptions).voiddeleteAppRole(String name) Deletes an AppRole role on mountapprole.voiddeleteAppRole(String name, String mount) Deletes an AppRole role.deleteAppRoleAsync(String name, String mount) AsynchronousdeleteAppRole(String, String).voiddeletePolicy(String name) Deletes an ACL policy.deletePolicyAsync(String name) AsynchronousdeletePolicy(String).voiddisableAuthMethod(String path) Disables an auth method; its tokens are revoked.disableAuthMethodAsync(String path) AsynchronousdisableAuthMethod(String).voiddisableSecretsEngine(String path) Disables (unmounts) a secrets engine; its data is deleted.AsynchronousdisableSecretsEngine(String).voidenableAuthMethod(String path, String type) Enables an auth method atpath.voidenableAuthMethod(String path, String type, EnableOptions options) Enables an auth method with options.enableAuthMethodAsync(String path, String type, EnableOptions options) AsynchronousenableAuthMethod(String, String, EnableOptions).voidenableSecretsEngine(String path, String type) Enables a secrets engine atpath.voidenableSecretsEngine(String path, String type, EnableOptions options) Enables a secrets engine with options.enableSecretsEngineAsync(String path, String type, EnableOptions options) AsynchronousenableSecretsEngine(String, String, EnableOptions).generateSecretId(String name) Generates a new secret id for an AppRole role on mountapprole.generateSecretId(String name, SecretIdOptions options) Generates a new secret id with options.generateSecretIdAsync(String name, SecretIdOptions o) AsynchronousgenerateSecretId(String, SecretIdOptions).health()GET sys/health(unauthenticated).Asynchronoushealth().leader()GET sys/leader(unauthenticated).Asynchronousleader().AppRole role names on mountapprole; empty when there is none.listAppRoles(String mount) AppRole role names on a mount.listAppRolesAsync(String mount) AsynchronouslistAppRoles(String).Auth methods by path ("approle/"to info).AsynchronouslistAuthMethods().Secrets engines by path ("secret/"to info).AsynchronouslistMounts().ACL policy names (includesdefaultandroot).AsynchronouslistPolicies().readPolicy(String name) Reads an ACL policy;NotFoundExceptionwhen missing.readPolicyAsync(String name) AsynchronousreadPolicy(String).readRoleId(String name) The role id of an AppRole role on mountapprole;NotFoundExceptionfor unknown roles.readRoleId(String name, String mount) The role id of an AppRole role.readRoleIdAsync(String name, String mount) AsynchronousreadRoleId(String, String).GET sys/seal-status(unauthenticated).AsynchronoussealStatus().version()Server version fromsys/health;UnsupportedExceptionwhen none is reported.Asynchronousversion().voidwritePolicy(String name, String policy) Creates or replaces an ACL policy:PUT sys/policies/acl/<name>.writePolicyAsync(String name, String policy) AsynchronouswritePolicy(String, String).
-
Method Details
-
health
GET sys/health(unauthenticated). Sealed, standby and uninitialised nodes are no error.- Returns:
- the health
-
healthAsync
Asynchronoushealth().- Returns:
- a future with the health
-
sealStatus
GET sys/seal-status(unauthenticated).- Returns:
- the seal status
-
sealStatusAsync
AsynchronoussealStatus().- Returns:
- a future with the seal status
-
leader
GET sys/leader(unauthenticated).- Returns:
- the leader status
-
leaderAsync
Asynchronousleader().- Returns:
- a future with the leader status
-
version
Server version fromsys/health;UnsupportedExceptionwhen none is reported.- Returns:
- the version, e.g.
2.2.2
-
versionAsync
Asynchronousversion().- Returns:
- a future with the version
-
capabilitiesSelf
The client token's capabilities on each path (POST sys/capabilities-self), so callers can check a policy before acting. At least one path is required.- Parameters:
paths- one or more API paths, e.g.secret/data/app/db- Returns:
- capabilities by path
-
capabilitiesSelf
The client token's capabilities on each path (POST sys/capabilities-self).- Parameters:
paths- one or more API paths- Returns:
- capabilities by path
-
capabilitiesSelfAsync
AsynchronouscapabilitiesSelf(List).- Parameters:
paths- one or more API paths- Returns:
- a future with the capabilities by path
-
capabilities
Another token's capabilities on each path (POST sys/capabilities; the caller needsupdateonsys/capabilities, otherwisePermissionDeniedException).- Parameters:
token- the token to checkpaths- one or more API paths- Returns:
- capabilities by path
-
capabilities
Another token's capabilities on each path (POST sys/capabilities).- Parameters:
token- the token to checkpaths- one or more API paths- Returns:
- capabilities by path
-
capabilitiesAsync
Asynchronouscapabilities(String, List).- Parameters:
token- the token to checkpaths- one or more API paths- Returns:
- a future with the capabilities by path
-
writePolicy
Creates or replaces an ACL policy:PUT sys/policies/acl/<name>. Invalid HCL raisesValidationException.- Parameters:
name- policy namepolicy- HCL text
-
writePolicyAsync
AsynchronouswritePolicy(String, String).- Parameters:
name- policy namepolicy- HCL text- Returns:
- a future completed when done
-
readPolicy
Reads an ACL policy;NotFoundExceptionwhen missing.- Parameters:
name- policy name- Returns:
- the policy
-
readPolicyAsync
AsynchronousreadPolicy(String).- Parameters:
name- policy name- Returns:
- a future with the policy
-
listPolicies
ACL policy names (includesdefaultandroot).- Returns:
- the names
-
listPoliciesAsync
AsynchronouslistPolicies().- Returns:
- a future with the names
-
deletePolicy
Deletes an ACL policy.- Parameters:
name- policy name
-
deletePolicyAsync
AsynchronousdeletePolicy(String).- Parameters:
name- policy name- Returns:
- a future completed when done
-
listMounts
Secrets engines by path ("secret/"to info).- Returns:
- the mounts
-
listMountsAsync
AsynchronouslistMounts().- Returns:
- a future with the mounts
-
enableSecretsEngine
Enables a secrets engine atpath. A used path raisesValidationException.- Parameters:
path- mount pathtype- engine type, e.g.kv,transit
-
enableSecretsEngine
Enables a secrets engine with options.- Parameters:
path- mount pathtype- engine typeoptions- options (e.g.option("version", "2"))
-
enableSecretsEngineAsync
public CompletableFuture<Void> enableSecretsEngineAsync(String path, String type, EnableOptions options) AsynchronousenableSecretsEngine(String, String, EnableOptions).- Parameters:
path- mount pathtype- engine typeoptions- options- Returns:
- a future completed when done
-
disableSecretsEngine
Disables (unmounts) a secrets engine; its data is deleted.- Parameters:
path- mount path
-
disableSecretsEngineAsync
AsynchronousdisableSecretsEngine(String).- Parameters:
path- mount path- Returns:
- a future completed when done
-
listAuthMethods
Auth methods by path ("approle/"to info).- Returns:
- the auth mounts
-
listAuthMethodsAsync
AsynchronouslistAuthMethods().- Returns:
- a future with the auth mounts
-
enableAuthMethod
Enables an auth method atpath.- Parameters:
path- mount pathtype- method type, e.g.approle,userpass
-
enableAuthMethod
Enables an auth method with options.- Parameters:
path- mount pathtype- method typeoptions- options
-
enableAuthMethodAsync
public CompletableFuture<Void> enableAuthMethodAsync(String path, String type, EnableOptions options) AsynchronousenableAuthMethod(String, String, EnableOptions).- Parameters:
path- mount pathtype- method typeoptions- options- Returns:
- a future completed when done
-
disableAuthMethod
Disables an auth method; its tokens are revoked.- Parameters:
path- mount path
-
disableAuthMethodAsync
AsynchronousdisableAuthMethod(String).- Parameters:
path- mount path- Returns:
- a future completed when done
-
createAppRole
Creates or updates an AppRole role.- Parameters:
name- role nameoptions- role settings and mount
-
createAppRoleAsync
AsynchronouscreateAppRole(String, AppRoleOptions).- Parameters:
name- role nameo- options- Returns:
- a future completed when done
-
listAppRoles
AppRole role names on mountapprole; empty when there is none.- Returns:
- the names
-
listAppRoles
AppRole role names on a mount.- Parameters:
mount- AppRole mount- Returns:
- the names
-
listAppRolesAsync
AsynchronouslistAppRoles(String).- Parameters:
mount- AppRole mount- Returns:
- a future with the names
-
deleteAppRole
Deletes an AppRole role on mountapprole.- Parameters:
name- role name
-
deleteAppRole
Deletes an AppRole role.- Parameters:
name- role namemount- AppRole mount
-
deleteAppRoleAsync
AsynchronousdeleteAppRole(String, String).- Parameters:
name- role namemount- AppRole mount- Returns:
- a future completed when done
-
readRoleId
The role id of an AppRole role on mountapprole;NotFoundExceptionfor unknown roles.- Parameters:
name- role name- Returns:
- the role id
-
readRoleId
The role id of an AppRole role.- Parameters:
name- role namemount- AppRole mount- Returns:
- the role id
-
readRoleIdAsync
AsynchronousreadRoleId(String, String).- Parameters:
name- role namemount- AppRole mount- Returns:
- a future with the role id
-
generateSecretId
Generates a new secret id for an AppRole role on mountapprole.- Parameters:
name- role name- Returns:
- the secret id
-
generateSecretId
Generates a new secret id with options.- Parameters:
name- role nameoptions- metadata, CIDRs, TTL, uses, mount- Returns:
- the secret id
-
generateSecretIdAsync
AsynchronousgenerateSecretId(String, SecretIdOptions).- Parameters:
name- role nameo- options- Returns:
- a future with the secret id
-