use of keywhiz.api.model.AutomationClient in project keywhiz by square.
the class AutomationClientResource method deleteClient.
/**
* Deletes a client
*
* @param clientId the ID of the client to delete
* @excludeParams automationClient
* @description Deletes a single client by id
* @responseMessage 200 Deleted client
* @responseMessage 404 Client not found by id
*/
@Timed
@ExceptionMetered
@DELETE
@Path("{clientId}")
public Response deleteClient(@Auth AutomationClient automationClient, @PathParam("clientId") LongParam clientId) {
Client client = clientDAO.getClientById(clientId.get()).orElseThrow(NotFoundException::new);
clientDAO.deleteClient(client);
Map<String, String> extraInfo = new HashMap<>();
extraInfo.put("deprecated", "true");
auditLog.recordEvent(new Event(Instant.now(), EventTag.CLIENT_CREATE, automationClient.getName(), client.getName(), extraInfo));
return Response.ok().build();
}
use of keywhiz.api.model.AutomationClient in project keywhiz by square.
the class AutomationClientResource method findClientById.
/**
* Retrieve Client by ID
*
* @param clientId the ID of the Client to retrieve
* @excludeParams automationClient
* @description Returns a single Client if found
* @responseMessage 200 Found and retrieved Client with given ID
* @responseMessage 404 Client with given ID not Found
*/
@Timed
@ExceptionMetered
@GET
@Path("{clientId}")
public Response findClientById(@Auth AutomationClient automationClient, @PathParam("clientId") LongParam clientId) {
logger.info("Automation ({}) - Looking up an ID {}", automationClient.getName(), clientId);
Client client = clientDAO.getClientById(clientId.get()).orElseThrow(NotFoundException::new);
ImmutableList<Group> groups = ImmutableList.copyOf(aclDAO.getGroupsFor(client));
return Response.ok().entity(ClientDetailResponse.fromClient(client, groups, ImmutableList.of())).build();
}
Aggregations