public class KeywhizAutomationClient extends HttpClient
KeywhizClient
.baseUrl, client, JSON, keywhizKeyStore, mapper
Constructor and Description |
---|
KeywhizAutomationClient(String baseUrl,
KeywhizKeyStore keywhizKeyStore)
Create a keywhiz automation client for the given baseurl.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
allClients()
Retrieve listing of all keywhiz client names.
|
String |
createClient(String name,
String description,
String... groups)
Creates a client and assigns to given groups.
|
String |
createGroup(String name,
String description,
com.google.common.collect.ImmutableMap<String,String> metadata)
Creates a group
|
void |
createOrUpdateSecret(String name,
CreateOrUpdateSecretRequestV2 secret)
Creates or updates (if it exists) a secret.
|
void |
createSecret(CreateSecretRequestV2 secret)
Creates a secret and assigns to given groups
|
void |
deleteClient(String client)
Delete a client.
|
void |
deleteGroup(String group)
Delete a group.
|
void |
deleteSecret(String name)
Delete a secret series
|
List<String> |
getAllGroups()
Retrieve listing of application group names.
|
ClientDetailResponseV2 |
getClientDetails(String client)
Retrieve information on a client
|
List<ClientDetailResponseV2> |
getClients(String group)
Retrieve metadata for clients in a particular group.
|
GroupDetailResponseV2 |
getGroupDetails(String group)
Retrieve information on a group.
|
List<String> |
getGroupsForSecret(String secret)
Listing of groups a secret is assigned to.
|
SecretDetailResponseV2 |
getSecretDetails(String secret)
Retrieve information on a secret series.
|
List<SecretDetailResponseV2> |
getSecrets(String group)
Retrieve metadata for secrets in a particular group
|
SecretContentsResponseV2 |
getSecretsContent(String... secrets)
Retrieve contents for a set of secret series.
|
List<String> |
getSecretsExpiring(String group,
long time)
Retrieve listing of secrets expiring soon in a group.
|
List<SecretDetailResponseV2> |
getSecretVersions(String secret,
int versionIdx,
int numVersions)
Retrieve the given range of versions of this secret, sorted from newest to oldest update time.
|
Map<String,Object> |
getStatus()
Returns current status of the keywhiz server.
|
boolean |
isClientAuthEnabled()
Automation client is using mTLS (client auth)
|
void |
modifyClientGroups(String client,
ModifyGroupsRequestV2 groupsRequest)
Modify groups a client has membership in.
|
void |
partialUpdateSecret(String name,
PartialUpdateSecretRequestV2 secret)
Updates a subset of the fields of an existing secret.
|
void |
setSecretVersion(String secret,
long versionId)
Reset the current version of the given secret to the given version index.
|
clearCookies, createHttpsClient, createObjectMapper, httpDelete, httpGet, httpPost, httpPut, makeCall, throwOnCommonError
public KeywhizAutomationClient(String baseUrl, KeywhizKeyStore keywhizKeyStore) throws GeneralSecurityException
baseUrl
- Keywhiz server base urlkeywhizKeyStore
- Keywhiz keystore.GeneralSecurityException
- Throws if any error creating the https client.public Map<String,Object> getStatus() throws IOException
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<String> allClients() throws IOException
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<String> getAllGroups() throws IOException
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public GroupDetailResponseV2 getGroupDetails(String group) throws IOException
group
- Keywhiz group nameGroupDetailResponseV2
) retrievedIOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void deleteGroup(String group) throws IOException
group
- Keywhiz group name.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<ClientDetailResponseV2> getClients(String group) throws IOException
group
- Keywhiz Group name.ClientDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public ClientDetailResponseV2 getClientDetails(String client) throws IOException
client
- Client name.ClientDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void deleteClient(String client) throws IOException
client
- Client name.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void modifyClientGroups(String client, ModifyGroupsRequestV2 groupsRequest) throws IOException
client
- Client name.groupsRequest
- JSON request specifying which groups to add or remove.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<SecretDetailResponseV2> getSecrets(String group) throws IOException
group
- Keywhiz group name.SecretDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void createOrUpdateSecret(String name, CreateOrUpdateSecretRequestV2 secret) throws IOException
name
- Secret name.secret
- Secret details, $CreateOrUpdateSecretRequestV2
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void partialUpdateSecret(String name, PartialUpdateSecretRequestV2 secret) throws IOException
name
- Secret name.secret
- Secret details, $PartialUpdateSecretRequestV2
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void createSecret(CreateSecretRequestV2 secret) throws IOException
secret
- Secret details, $CreateSecretRequestV2
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void deleteSecret(String name) throws IOException
name
- Secret series name to be deleted.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<String> getGroupsForSecret(String secret) throws IOException
secret
- Secret nameIOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<SecretDetailResponseV2> getSecretVersions(String secret, int versionIdx, int numVersions) throws IOException
secret
- Secret name.versionIdx
- The index in the list of versions of the first version to retrieve.numVersions
- The number of versions to retrieveIOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public void setSecretVersion(String secret, long versionId) throws IOException
secret
- Secret name.versionId
- The version id of the secret to set.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public SecretDetailResponseV2 getSecretDetails(String secret) throws IOException
secret
- Secret name.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public List<String> getSecretsExpiring(String group, long time) throws IOException
group
- Keywhiz group name.time
- Timestamp for farthest expiry to include.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public SecretContentsResponseV2 getSecretsContent(String... secrets) throws IOException
secrets
- List of secrets.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public String createClient(String name, String description, String... groups) throws IOException
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public String createGroup(String name, String description, com.google.common.collect.ImmutableMap<String,String> metadata) throws IOException
name
- Group namedescription
- Group description.metadata
- Group metadata.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.public boolean isClientAuthEnabled()
isClientAuthEnabled
in class HttpClient
true
if client auth is enabledCopyright © 2018 Walmart, Inc.. All rights reserved.