@DELETE
@Path("/{id}/command/{name}")
@ApiOperation(
value = "Remove the command from the workspace",
notes = "This operation can be performed only by the workspace owner")
@ApiResponses({
@ApiResponse(code = 204, message = "The command successfully removed"),
@ApiResponse(code = 403, message = "The user does not have access delete the command"),
@ApiResponse(code = 404, message = "The workspace not found"),
@ApiResponse(code = 500, message = "Internal server error occurred")
})
public void deleteCommand(
@ApiParam("The id of the workspace") @PathParam("id") String id,
@ApiParam("The name of the command to remove") @PathParam("name") String commandName)
throws ServerException, BadRequestException, NotFoundException, ConflictException,
ForbiddenException {
WorkspaceImpl workspace = workspaceManager.getWorkspace(id);
if (workspace
.getConfig()
.getCommands()
.removeIf(command -> command.getName().equals(commandName))) {
doUpdate(id, workspace);
}
}