@RequestMapping(value="/v1/apps/{appName}") public class GroupController extends Object
appName
is the OneOps environment name with {org}_{assembly}_{env} format,
for which you are managing the secrets.AuthzRestController
Constructor and Description |
---|
GroupController(KeywhizAutomationClient kwClient,
SecretService secretService,
AuditLog auditLog)
GroupController constructor. |
Modifier and Type | Method and Description |
---|---|
void |
createSecret(boolean createGroup,
String appName,
String secretName,
SecretRequest secretRequest,
OneOpsUser user)
Creates new secret.
|
List<String> |
deleteAllSecrets(String appName,
OneOpsUser user)
Delete all secrets in a particular group.
|
void |
deleteClient(String appName,
String name,
OneOpsUser user)
Deletes a client.
|
void |
deleteSecret(String appName,
String secretName,
OneOpsUser user)
Delete a secret series.
|
ClientDetailResponseV2 |
getClientDetails(String appName,
String name,
OneOpsUser user)
Retrieve information on a client.
|
List<ClientDetailResponseV2> |
getClients(String appName,
OneOpsUser user)
Retrieve metadata for clients in a particular group.
|
SecretDetailResponseV2 |
getSecret(String appName,
String secretName,
OneOpsUser user)
Retrieve information on a secret series.
|
SecretContent |
getSecretContent(String appName,
String secretName,
OneOpsUser user)
Retrieve contents for a set of secret series.
|
List<SecretDetailResponseV2> |
getSecrets(String appName,
OneOpsUser user)
Retrieve metadata for secrets in a particular group.
|
List<String> |
getSecretsExpiring(String appName,
long time,
OneOpsUser user)
Retrieve listing of secrets expiring soon in a group.
|
List<SecretDetailResponseV2> |
getSecretVersions(String appName,
String secretName,
OneOpsUser user)
Retrieve all versions of this secret, sorted from newest to oldest update time.
|
GroupDetailResponseV2 |
info(String appName,
OneOpsUser user)
Retrieve information on a group.
|
void |
setSecretVersion(String appName,
String secretName,
SecretVersionRequest secretVersion,
OneOpsUser user)
Retrieve all versions of this secret, sorted from newest to oldest update time.
|
void |
updateSecret(String appName,
String secretName,
SecretRequest secretRequest,
OneOpsUser user)
Updates the secret.
|
public GroupController(KeywhizAutomationClient kwClient, SecretService secretService, AuditLog auditLog)
GroupController
constructor.kwClient
- Keywhiz automation client.secretService
- Service containing utility functions to validate the secrets.auditLog
- Audit logger.@GetMapping public GroupDetailResponseV2 info(@PathVariable(value="appName") String appName, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.user
- Authorized OneOpsUser
GroupDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@GetMapping(value="/clients") public List<ClientDetailResponseV2> getClients(@PathVariable(value="appName") String appName, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.user
- Authorized OneOpsUser
ClientDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@GetMapping(value="/clients/{clientName}") public ClientDetailResponseV2 getClientDetails(@PathVariable(value="appName") String appName, @PathVariable(value="clientName") String name, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.name
- Client name.user
- Authorized OneOpsUser
ClientDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@DeleteMapping(value="/clients/{clientName}") @ResponseStatus(value=NO_CONTENT) public void deleteClient(@PathVariable(value="appName") String appName, @PathVariable(value="clientName") String name, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.name
- Client name to be deleted.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@GetMapping(value="/secrets") public List<SecretDetailResponseV2> getSecrets(@PathVariable(value="appName") String appName, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.user
- Authorized OneOpsUser
SecretDetailResponseV2
) retrieved.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@DeleteMapping(value="/secrets") public List<String> deleteAllSecrets(@PathVariable(value="appName") String appName, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@GetMapping(value="/secrets/expiring/{time}") public List<String> getSecretsExpiring(@PathVariable(value="appName") String appName, @PathVariable(value="time") long time, @CurrentUser OneOpsUser user) throws IOException
appName
- OneOps application name.time
- Timestamp for farthest expiry to include.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.@PostMapping(value="/secrets/{secretName}") @ResponseStatus(value=CREATED) public void createSecret(@RequestParam(value="createGroup",required=false,defaultValue="false") boolean createGroup, @PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @RequestBody SecretRequest secretRequest, @CurrentUser OneOpsUser user) throws IOException
createGroup
- true
to create non existing application group. Default is
false
.appName
- Application name.secretName
- secret name.secretRequest
- Secret request SecretRequest
user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if application group doesn't exist or the secret with the same
name already exists.@PutMapping(value="/secrets/{secretName}") @ResponseStatus(value=CREATED) public void updateSecret(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @RequestBody SecretRequest secretRequest, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.secretRequest
- Secret request SecretRequest
user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret is not part of given application group.@GetMapping(value="/secrets/{secretName}") public SecretDetailResponseV2 getSecret(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret is not part of given application group.@GetMapping(value="/secrets/{secretName}/versions") public List<SecretDetailResponseV2> getSecretVersions(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret not exists or is not part of given application
group.@PostMapping(value="/secrets/{secretName}/setversion") @ResponseStatus(value=CREATED) public void setSecretVersion(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @RequestBody SecretVersionRequest secretVersion, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret not exists or is not part of given application
group.@DeleteMapping(value="/secrets/{secretName}") @ResponseStatus(value=NO_CONTENT) public void deleteSecret(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret not exists or not part of given application
group.@PostMapping(value="/secrets/{secretName}/contents") public SecretContent getSecretContent(@PathVariable(value="appName") String appName, @PathVariable(value="secretName") String secretName, @CurrentUser OneOpsUser user) throws IOException
appName
- Application name.secretName
- secret name.user
- Authorized OneOpsUser
IOException
- Throws if the request could not be executed due to cancellation, a
connectivity problem or timeout.KeywhizException
- Throws if the secret is not part of given application group.Copyright © 2018 Walmart, Inc.. All rights reserved.