use of com.netflix.titus.grpc.protogen.Page in project titus-control-plane by Netflix.
the class JobManagementSpringResource method findTasks.
@ApiOperation("Find tasks")
@GetMapping(path = "/tasks")
public TaskQueryResult findTasks(@RequestParam MultiValueMap<String, String> queryParameters, CallMetadataAuthentication authentication) {
TaskQuery.Builder queryBuilder = TaskQuery.newBuilder();
Page page = RestUtil.createPage(queryParameters);
logPageNumberUsage(systemLog, authentication.getCallMetadata(), getClass().getSimpleName(), "findTasks", page);
queryBuilder.setPage(page);
queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters));
queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters));
return Responses.fromSingleValueObservable(jobServiceGateway.findTasks(queryBuilder.build(), authentication.getCallMetadata()));
}
use of com.netflix.titus.grpc.protogen.Page in project titus-control-plane by Netflix.
the class LoadBalancerResource method getAllLoadBalancers.
@GET
@ApiOperation("Get all load balancers")
public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) {
Page page = RestUtil.createPage(info.getQueryParameters());
CallMetadata callMetadata = resolveCallMetadata();
logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page);
return Responses.fromSingleValueObservable(loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata));
}
use of com.netflix.titus.grpc.protogen.Page in project titus-control-plane by Netflix.
the class LoadBalancerSpringResource method getAllLoadBalancers.
@ApiOperation("Get all load balancers")
@GetMapping
public GetAllLoadBalancersResult getAllLoadBalancers(@RequestParam MultiValueMap<String, String> queryParameters, CallMetadataAuthentication authentication) {
Page page = RestUtil.createPage(queryParameters);
logPageNumberUsage(systemLog, authentication.getCallMetadata(), getClass().getSimpleName(), "getAllLoadBalancers", page);
return Responses.fromSingleValueObservable(loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), authentication.getCallMetadata()));
}
use of com.netflix.titus.grpc.protogen.Page in project titus-control-plane by Netflix.
the class LocalCacheQueryProcessorTest method testFindJobs.
@Test
public void testFindJobs() {
Job<?> job1 = addToJobDataReplicator(newJobAndTasks("job1", 2)).getLeft();
Job<?> job2 = addToJobDataReplicator(newJobAndTasks("job2", 4)).getLeft();
Job<?> job3 = addToJobDataReplicator(newJobAndTasks("job3", 0)).getLeft();
// Expect two pages
JobQueryResult page1Result = processor.findJobs(JOB_QUERY_ALL_WITH_PAGE_SIZE_2);
assertThat(page1Result.getItemsList()).hasSize(2);
Page page2 = Page.newBuilder().setPageSize(2).setCursor(page1Result.getPagination().getCursor()).build();
JobQueryResult page2Result = processor.findJobs(JobQuery.newBuilder().setPage(page2).build());
assertThat(page2Result.getItemsList()).hasSize(1);
assertThat(page2Result.getPagination().getHasMore()).isFalse();
List<String> jobIds = CollectionsExt.merge(page1Result.getItemsList().stream().map(com.netflix.titus.grpc.protogen.Job::getId).collect(Collectors.toList()), page2Result.getItemsList().stream().map(com.netflix.titus.grpc.protogen.Job::getId).collect(Collectors.toList()));
assertThat(jobIds).contains(job1.getId(), job2.getId(), job3.getId());
}
use of com.netflix.titus.grpc.protogen.Page in project titus-control-plane by Netflix.
the class JobManagementResource method findJobs.
@GET
@ApiOperation("Find jobs")
@Path("/jobs")
public JobQueryResult findJobs(@Context UriInfo info) {
MultivaluedMap<String, String> queryParameters = info.getQueryParameters(true);
JobQuery.Builder queryBuilder = JobQuery.newBuilder();
Page page = RestUtil.createPage(queryParameters);
CallMetadata callMetadata = resolveCallMetadata();
logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "findJobs", page);
queryBuilder.setPage(page);
queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters));
queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters));
return Responses.fromSingleValueObservable(jobServiceGateway.findJobs(queryBuilder.build(), callMetadata));
}
Aggregations