@POST
@Path("/{id}/project")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(
value = "Adds a new project to the workspace",
notes = "This operation can be performed only by the workspace owner")
@ApiResponses({
@ApiResponse(code = 200, message = "The project successfully added to the workspace"),
@ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
@ApiResponse(code = 403, message = "The user does not have access to add the project"),
@ApiResponse(code = 404, message = "The workspace not found"),
@ApiResponse(code = 409, message = "Any conflict error occurs"),
@ApiResponse(code = 500, message = "Internal server error occurred")
})
public WorkspaceDto addProject(
@ApiParam("The workspace id") @PathParam("id") String id,
@ApiParam(value = "The new project", required = true) ProjectConfigDto newProject)
throws ServerException, BadRequestException, NotFoundException, ConflictException,
ForbiddenException {
requiredNotNull(newProject, "New project config");
final WorkspaceImpl workspace = workspaceManager.getWorkspace(id);
workspace.getConfig().getProjects().add(new ProjectConfigImpl(newProject));
return asDtoWithLinksAndToken(doUpdate(id, workspace));
}