class AutomationSecretResource {

  @Path("{secretName}")
  @Timed @ExceptionMetered
  @DELETE
  public Response deleteSecretSeries(
      @Auth AutomationClient automationClient,
      @PathParam("secretName") String secretName) {

    Secret secret = secretController.getSecretByName(secretName).orElseThrow(() -> new NotFoundException("Secret series not found."));
    Set<String> groups = aclDAO.getGroupsFor(secret).stream().map(Group::getName).collect(toSet());
    secretDAO.deleteSecretsByName(secretName);

    // Record all groups to which this secret belongs, so they can be restored manually if necessary
    Map<String, String> extraInfo = new HashMap<>();
    extraInfo.put("deprecated", "true");
    extraInfo.put("groups", groups.toString());
    extraInfo.put("current version", secret.getVersion().toString());
    auditLog.recordEvent(new Event(Instant.now(), EventTag.SECRET_DELETE, automationClient.getName(), secretName, extraInfo));

    return Response.ok().build();
  }

  @Inject public  AutomationSecretResource(SecretController secretController,
                                          SecretDAOFactory secretDAOFactory, AclDAOFactory aclDAOFactory, AuditLog auditLog);
  @VisibleForTesting  AutomationSecretResource(SecretController secretController,
                                              SecretDAO secretDAO, AclDAO aclDAO, AuditLog auditLog);

}