Search in sources :

Example 1 with DeletedConsumer

use of org.candlepin.model.DeletedConsumer in project candlepin by candlepin.

the class ConsumerResource method removeDeletionRecord.

@ApiOperation(notes = "Removes the Deletion Record for a Consumer Allowed for a superadmin." + " The main use case for this would be if a user accidently deleted a " + "non-RHEL hypervisor, causing it to no longer be auto-detected via virt-who.", value = "removeDeletionRecord")
@ApiResponses({ @ApiResponse(code = 404, message = "") })
@DELETE
@Path("{consumer_uuid}/deletionrecord")
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public void removeDeletionRecord(@PathParam("consumer_uuid") String uuid) {
    DeletedConsumer dc = deletedConsumerCurator.findByConsumerUuid(uuid);
    if (dc == null) {
        throw new NotFoundException(i18n.tr("Deletion record for hypervisor \"{0}\" not found.", uuid));
    }
    deletedConsumerCurator.delete(dc);
}
Also used : DeletedConsumer(org.candlepin.model.DeletedConsumer) NotFoundException(org.candlepin.common.exceptions.NotFoundException) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) Transactional(com.google.inject.persist.Transactional)

Aggregations

Transactional (com.google.inject.persist.Transactional)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 NotFoundException (org.candlepin.common.exceptions.NotFoundException)1 DeletedConsumer (org.candlepin.model.DeletedConsumer)1