Search in sources :

Example 1 with ExtraAuthRequired

use of org.openkilda.northbound.utils.ExtraAuthRequired in project open-kilda by telstra.

the class FlowController method deleteFlows.

/**
 * Delete all flows.
 *
 * @param correlationId correlation ID header value
 * @return list of flows that have been deleted
 */
@ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowPayload.class)
@ApiResponses(value = { @ApiResponse(code = 200, response = FlowPayload.class, message = "Operation is successful"), @ApiResponse(code = 400, response = MessageError.class, message = "Invalid input data"), @ApiResponse(code = 401, response = MessageError.class, message = "Unauthorized"), @ApiResponse(code = 403, response = MessageError.class, message = "Forbidden"), @ApiResponse(code = 404, response = MessageError.class, message = "Not found"), @ApiResponse(code = 500, response = MessageError.class, message = "General error"), @ApiResponse(code = 503, response = MessageError.class, message = "Service unavailable") })
@RequestMapping(value = "/flows", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ExtraAuthRequired
// the error is unchecked
@SuppressWarnings("unchecked")
public ResponseEntity<List<FlowPayload>> deleteFlows(@RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
    logger.debug("Delete flows: {}={}", CORRELATION_ID);
    List<FlowPayload> response = flowService.deleteFlows(correlationId);
    return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) HttpHeaders(org.springframework.http.HttpHeaders) ResponseEntity(org.springframework.http.ResponseEntity) ApiOperation(io.swagger.annotations.ApiOperation) ExtraAuthRequired(org.openkilda.northbound.utils.ExtraAuthRequired) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)1 ExtraAuthRequired (org.openkilda.northbound.utils.ExtraAuthRequired)1 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1