class SecretsResource {

  @Path("rollback/{secretName}/{versionId}")
  @Timed @ExceptionMetered
  @POST
  public Response resetSecretVersion(@Auth User user, @PathParam("secretName") String secretName,
      @PathParam("versionId") LongParam versionId) {

    logger.info("User '{}' rolling back secret '{}' to version with ID '{}'.", user, secretName,
        versionId);

    secretDAOReadWrite.setCurrentSecretVersionByName(secretName, versionId.get(), user.getName());

    // If the secret wasn't found or the request was misformed, setCurrentSecretVersionByName
    // already threw an exception
    Map<String, String> extraInfo = new HashMap<>();
    extraInfo.put("new version", versionId.toString());
    auditLog.recordEvent(
        new Event(Instant.now(), EventTag.SECRET_CHANGEVERSION, user.getName(), secretName,
            extraInfo));

    // Send the new secret in response
    URI uri = UriBuilder.fromResource(SecretsResource.class)
        .path("rollback/{secretName}/{versionID}")
        .build(secretName, versionId);
    return Response.created(uri).entity(secretDetailResponseFromName(secretName)).build();
  }

  @SuppressWarnings("unused") @Inject public  SecretsResource(SecretController secretController, AclDAOFactory aclDAOFactory,
      SecretDAOFactory secretDAOFactory, AuditLog auditLog);
  @VisibleForTesting  SecretsResource(SecretController secretController, AclDAO aclDAOReadOnly,
      SecretDAO secretDAOReadWrite, AuditLog auditLog);

}