use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class RequestResource method getCrashLoopsForRequest.
@GET
@Path("/request/{requestId}/crashloops")
@Operation(summary = "Retrieve a map of all open crash loop details for all requests")
public List<CrashLoopInfo> getCrashLoopsForRequest(@Parameter(hidden = true) @Auth SingularityUser user, @Parameter(required = true, description = "The Request ID to fetch crash loops for") @PathParam("requestId") String requestId) {
final SingularityRequestWithState requestWithState = fetchRequestWithState(requestId, user);
authorizationHelper.checkForAuthorization(requestWithState.getRequest(), user, SingularityAuthorizationScope.READ);
return requestManager.getCrashLoopsForRequest(requestId);
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class SingularityOpenApiResource method getOpenApi.
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Operation(hidden = true)
public Response getOpenApi(@Context HttpHeaders headers, @Context UriInfo uriInfo) throws Exception {
if (cachedApiJson.get() == null) {
Response openApi = super.getOpenApi(headers, config, app, uriInfo, "json");
cachedApiJson.set(openApi);
return openApi;
} else {
return cachedApiJson.get();
}
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class HistoryResource method getTaskHistoryWithMetadata.
@GET
@Path("/tasks/withmetadata")
@Operation(summary = "Retrieve the history sorted by startedAt for all inactive tasks")
public SingularityPaginatedResponse<SingularityTaskIdHistory> getTaskHistoryWithMetadata(@Parameter(hidden = true) @Auth SingularityUser user, @Parameter(description = "Optional Request ID to match") @QueryParam("requestId") Optional<String> requestId, @Parameter(description = "Optional deploy ID to match") @QueryParam("deployId") Optional<String> deployId, @Parameter(description = "Optional runId to match") @QueryParam("runId") Optional<String> runId, @Parameter(description = "Optional host to match") @QueryParam("host") Optional<String> host, @Parameter(description = "Optional last task status to match") @QueryParam("lastTaskStatus") Optional<ExtendedTaskState> lastTaskStatus, @Parameter(description = "Optionally match only tasks started before") @QueryParam("startedBefore") Optional<Long> startedBefore, @Parameter(description = "Optionally match only tasks started after") @QueryParam("startedAfter") Optional<Long> startedAfter, @Parameter(description = "Optionally match tasks last updated before") @QueryParam("updatedBefore") Optional<Long> updatedBefore, @Parameter(description = "Optionally match tasks last updated after") @QueryParam("updatedAfter") Optional<Long> updatedAfter, @Parameter(description = "Sort direction") @QueryParam("orderDirection") Optional<OrderDirection> orderDirection, @Parameter(description = "Maximum number of items to return") @QueryParam("count") Integer count, @Parameter(description = "Which page of items to view") @QueryParam("page") Integer page, @Parameter(description = "Skip checking zookeeper, items that have not been persisted yet may not appear") @QueryParam("skipZk") @DefaultValue("true") boolean skipZk) {
if (requestId.isPresent()) {
authorizationHelper.checkForAuthorizationByRequestId(requestId.get(), user, SingularityAuthorizationScope.READ);
} else {
authorizationHelper.checkGlobalReadAuthorization(user);
}
final Optional<Integer> dataCount = taskHistoryHelper.getBlendedHistoryCount(new SingularityTaskHistoryQuery(requestId, deployId, runId, host, lastTaskStatus, startedBefore, startedAfter, updatedBefore, updatedAfter, orderDirection), skipZk);
final int limitCount = getLimitCount(count);
final List<SingularityTaskIdHistory> data = this.getTaskHistory(user, requestId, deployId, runId, host, lastTaskStatus, startedBefore, startedAfter, updatedBefore, updatedAfter, orderDirection, count, page, skipZk);
final Optional<Integer> pageCount = getPageCount(dataCount, limitCount);
return new SingularityPaginatedResponse<>(dataCount, pageCount, Optional.ofNullable(page), data);
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class HistoryResource method getRequestHistoryForRequest.
@GET
@Path("/request/{requestId}/requests")
@Operation(summary = "Get request history for a single request")
public List<SingularityRequestHistory> getRequestHistoryForRequest(@Parameter(hidden = true) @Auth SingularityUser user, @Parameter(required = true, description = "Request ID to look up") @PathParam("requestId") String requestId, @Parameter(description = "Optionally match request histories created before") @QueryParam("createdBefore") Optional<Long> createdBefore, @Parameter(description = "Optionally match request histories created after") @QueryParam("createdAfter") Optional<Long> createdAfter, @Parameter(description = "Sort direction") @QueryParam("orderDirection") Optional<OrderDirection> orderDirection, @Parameter(description = "Maximum number of items to return") @QueryParam("count") Integer count, @Parameter(description = "Which page of items to view") @QueryParam("page") Integer page, @Parameter(description = "Skip checking zookeeper, items that have not been persisted yet may not appear") @QueryParam("skipZk") @DefaultValue("false") boolean skipZk) {
authorizationHelper.checkForAuthorizationByRequestId(requestId, user, SingularityAuthorizationScope.READ);
final Integer limitCount = getLimitCount(count);
final Integer limitStart = getLimitStart(limitCount, page);
SingularityRequestHistoryQuery requestHistoryQuery = new SingularityRequestHistoryQuery(requestId, createdBefore, createdAfter, orderDirection);
return requestHistoryHelper.getBlendedHistory(requestHistoryQuery, limitStart, limitCount, skipZk);
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class HistoryResource method getInactiveDeployTasksWithMetadata.
@GET
@Path("/request/{requestId}/deploy/{deployId}/tasks/inactive/withmetadata")
@Operation(summary = "Retrieve the task history for a specific deploy")
public SingularityPaginatedResponse<SingularityTaskIdHistory> getInactiveDeployTasksWithMetadata(@Parameter(hidden = true) @Auth SingularityUser user, @Parameter(required = true, description = "Request ID for deploy") @PathParam("requestId") String requestId, @Parameter(required = true, description = "Deploy ID") @PathParam("deployId") String deployId, @Parameter(description = "Maximum number of items to return") @QueryParam("count") Integer count, @Parameter(description = "Which page of items to view") @QueryParam("page") Integer page, @Parameter(description = "Skip checking zookeeper, items that have not been persisted yet may not appear") @QueryParam("skipZk") @DefaultValue("true") boolean skipZk) {
authorizationHelper.checkForAuthorizationByRequestId(requestId, user, SingularityAuthorizationScope.READ);
SingularityDeployKey key = new SingularityDeployKey(requestId, deployId);
Optional<Integer> dataCount = deployTaskHistoryHelper.getBlendedHistoryCount(key, skipZk);
final Integer limitCount = getLimitCount(count);
final Integer limitStart = getLimitStart(limitCount, page);
final List<SingularityTaskIdHistory> data = deployTaskHistoryHelper.getBlendedHistory(key, limitStart, limitCount, skipZk);
Optional<Integer> pageCount = getPageCount(dataCount, limitCount);
return new SingularityPaginatedResponse<>(dataCount, pageCount, Optional.ofNullable(page), data);
}
Aggregations