public class KeywhizClient extends HttpClient
Facilitates the manipulation of Clients, Groups, Secrets and the connections between them.
baseUrl, client, JSON, keywhizKeyStore, mapper| Constructor and Description |
|---|
KeywhizClient(String baseUrl,
KeywhizKeyStore keywhizKeyStore)
Create a keywhiz client for the given baseurl.
|
| Modifier and Type | Method and Description |
|---|---|
List<Client> |
allClients() |
List<Group> |
allGroups() |
List<SanitizedSecret> |
allSecrets() |
List<SanitizedSecret> |
allSecretsBatched(int idx,
int num,
boolean newestFirst) |
ClientDetailResponse |
clientDetailsForId(long clientId) |
ClientDetailResponse |
createClient(String name) |
GroupDetailResponse |
createGroup(String name,
String description,
com.google.common.collect.ImmutableMap<String,String> metadata) |
SecretDetailResponse |
createSecret(String name,
String description,
byte[] content,
com.google.common.collect.ImmutableMap<String,String> metadata,
long expiry) |
void |
deleteClientWithId(long clientId) |
void |
deleteGroupWithId(long groupId) |
void |
deleteSecretWithId(long secretId) |
void |
enrollClientInGroupByIds(long clientId,
long groupId) |
void |
evictClientFromGroupByIds(long clientId,
long groupId) |
Client |
getClientByName(String name) |
Group |
getGroupByName(String name) |
SanitizedSecret |
getSanitizedSecretByName(String name) |
void |
grantSecretToGroupByIds(long secretId,
long groupId) |
GroupDetailResponse |
groupDetailsForId(long groupId) |
boolean |
isClientAuthEnabled()
Check if client auth is enabled (mTLS) instead of session cookie.
|
boolean |
isLoggedIn() |
List<SanitizedSecret> |
listSecretVersions(String name,
int idx,
int numVersions) |
void |
login(String username,
char[] password)
Login to the Keywhiz server.
|
void |
revokeSecretFromGroupByIds(long secretId,
long groupId) |
SecretDetailResponse |
rollbackSecret(String name,
long version) |
SecretDetailResponse |
secretDetailsForId(long secretId) |
SecretDetailResponse |
updateSecret(String name,
boolean descriptionPresent,
String description,
boolean contentPresent,
byte[] content,
boolean metadataPresent,
com.google.common.collect.ImmutableMap<String,String> metadata,
boolean expiryPresent,
long expiry) |
clearCookies, createHttpsClient, createObjectMapper, httpDelete, httpGet, httpPost, httpPut, makeCall, throwOnCommonErrorpublic KeywhizClient(String baseUrl, KeywhizKeyStore keywhizKeyStore) throws GeneralSecurityException
baseUrl - keywhiz server base urlkeywhizKeyStore - keywhiz keystore.GeneralSecurityException - throws if any error creating the https client.public boolean isClientAuthEnabled()
HttpClientisClientAuthEnabled in class HttpClienttrue if client auth is enabledpublic void login(String username, char[] password) throws IOException
Future requests made using this client instance will be authenticated.
username - login usernamepassword - login passwordIOException - if a network IO error occurspublic List<Group> allGroups() throws IOException
IOExceptionpublic GroupDetailResponse createGroup(String name, String description, com.google.common.collect.ImmutableMap<String,String> metadata) throws IOException
IOExceptionpublic GroupDetailResponse groupDetailsForId(long groupId) throws IOException
IOExceptionpublic void deleteGroupWithId(long groupId)
throws IOException
IOExceptionpublic List<SanitizedSecret> allSecrets() throws IOException
IOExceptionpublic List<SanitizedSecret> allSecretsBatched(int idx, int num, boolean newestFirst) throws IOException
IOExceptionpublic SecretDetailResponse createSecret(String name, String description, byte[] content, com.google.common.collect.ImmutableMap<String,String> metadata, long expiry) throws IOException
IOExceptionpublic SecretDetailResponse updateSecret(String name, boolean descriptionPresent, String description, boolean contentPresent, byte[] content, boolean metadataPresent, com.google.common.collect.ImmutableMap<String,String> metadata, boolean expiryPresent, long expiry) throws IOException
IOExceptionpublic SecretDetailResponse secretDetailsForId(long secretId) throws IOException
IOExceptionpublic List<SanitizedSecret> listSecretVersions(String name, int idx, int numVersions) throws IOException
IOExceptionpublic SecretDetailResponse rollbackSecret(String name, long version) throws IOException
IOExceptionpublic void deleteSecretWithId(long secretId)
throws IOException
IOExceptionpublic List<Client> allClients() throws IOException
IOExceptionpublic ClientDetailResponse createClient(String name) throws IOException
IOExceptionpublic ClientDetailResponse clientDetailsForId(long clientId) throws IOException
IOExceptionpublic void deleteClientWithId(long clientId)
throws IOException
IOExceptionpublic void enrollClientInGroupByIds(long clientId,
long groupId)
throws IOException
IOExceptionpublic void evictClientFromGroupByIds(long clientId,
long groupId)
throws IOException
IOExceptionpublic void grantSecretToGroupByIds(long secretId,
long groupId)
throws IOException
IOExceptionpublic void revokeSecretFromGroupByIds(long secretId,
long groupId)
throws IOException
IOExceptionpublic Client getClientByName(String name) throws IOException
IOExceptionpublic Group getGroupByName(String name) throws IOException
IOExceptionpublic SanitizedSecret getSanitizedSecretByName(String name) throws IOException
IOExceptionpublic boolean isLoggedIn()
throws IOException
IOExceptionCopyright © 2018 Walmart, Inc.. All rights reserved.