use of bio.terra.workspace.generated.model.ApiResourceList in project terra-workspace-manager by DataBiosphere.
the class ResourceController method enumerateResources.
@Override
public ResponseEntity<ApiResourceList> enumerateResources(UUID workspaceId, @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, @Valid @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit, @Valid ApiResourceType resource, @Valid ApiStewardshipType stewardship) {
AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
ControllerValidationUtils.validatePaginationParams(offset, limit);
workspaceService.validateWorkspaceAndAction(userRequest, workspaceId, SamConstants.SamWorkspaceAction.READ);
List<WsmResource> wsmResources = resourceService.enumerateResources(workspaceId, WsmResourceFamily.fromApiOptional(resource), StewardshipType.fromApiOptional(stewardship), offset, limit, userRequest);
List<ApiResourceDescription> apiResourceDescriptionList = wsmResources.stream().map(r -> makeApiResourceDescription(r)).collect(Collectors.toList());
var apiResourceList = new ApiResourceList().resources(apiResourceDescriptionList);
return new ResponseEntity<>(apiResourceList, HttpStatus.OK);
}
Aggregations