@GET
@Path("/namespace/{namespace:.*}")
@Produces(APPLICATION_JSON)
@ApiOperation(
value = "Get workspaces by given namespace",
notes = "This operation can be performed only by authorized user",
response = WorkspaceDto.class,
responseContainer = "List")
@ApiResponses({
@ApiResponse(code = 200, message = "The workspaces successfully fetched"),
@ApiResponse(code = 500, message = "Internal server error occurred during workspaces fetching")
})
public List<WorkspaceDto> getByNamespace(
@ApiParam("Workspace status") @QueryParam("status") String status,
@ApiParam("The namespace") @PathParam("namespace") String namespace)
throws ServerException, BadRequestException {
return withLinks(
Pages.stream(
(maxItems, skipCount) ->
workspaceManager.getByNamespace(namespace, false, maxItems, skipCount))
.filter(ws -> status == null || status.equalsIgnoreCase(ws.getStatus().toString()))
.map(DtoConverter::asDto)
.collect(toList()));
}