Search in sources :

Example 6 with Hidden

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);
}
Also used : SingularityRequestWithState(com.hubspot.singularity.SingularityRequestWithState) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) Operation(io.swagger.v3.oas.annotations.Operation)

Example 7 with Hidden

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();
    }
}
Also used : Response(javax.ws.rs.core.Response) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Operation(io.swagger.v3.oas.annotations.Operation)

Example 8 with Hidden

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);
}
Also used : SingularityTaskHistoryQuery(com.hubspot.singularity.SingularityTaskHistoryQuery) SingularityTaskIdHistory(com.hubspot.singularity.SingularityTaskIdHistory) SingularityPaginatedResponse(com.hubspot.singularity.SingularityPaginatedResponse) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) Operation(io.swagger.v3.oas.annotations.Operation)

Example 9 with Hidden

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);
}
Also used : SingularityRequestHistoryQuery(com.hubspot.singularity.SingularityRequestHistoryQuery) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) Operation(io.swagger.v3.oas.annotations.Operation)

Example 10 with Hidden

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);
}
Also used : SingularityDeployKey(com.hubspot.singularity.SingularityDeployKey) SingularityTaskIdHistory(com.hubspot.singularity.SingularityTaskIdHistory) SingularityPaginatedResponse(com.hubspot.singularity.SingularityPaginatedResponse) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) Operation(io.swagger.v3.oas.annotations.Operation)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)29 Path (javax.ws.rs.Path)25 GET (javax.ws.rs.GET)21 POST (javax.ws.rs.POST)6 SingularityTaskHistoryQuery (com.hubspot.singularity.SingularityTaskHistoryQuery)5 SingularityTaskId (com.hubspot.singularity.SingularityTaskId)5 List (java.util.List)4 Consumes (javax.ws.rs.Consumes)4 Produces (javax.ws.rs.Produces)4 SingularityPaginatedResponse (com.hubspot.singularity.SingularityPaginatedResponse)3 SingularityRequestWithState (com.hubspot.singularity.SingularityRequestWithState)3 SingularityTaskIdHistory (com.hubspot.singularity.SingularityTaskIdHistory)3 Schema (io.swagger.v3.oas.models.media.Schema)3 BeanDescription (com.fasterxml.jackson.databind.BeanDescription)2 AnnotatedMethod (com.fasterxml.jackson.databind.introspect.AnnotatedMethod)2 SingularityTaskHistory (com.hubspot.singularity.SingularityTaskHistory)2 Hidden (io.swagger.v3.oas.annotations.Hidden)2 GenericOpenApiContext (io.swagger.v3.oas.integration.GenericOpenApiContext)2 OpenAPIConfiguration (io.swagger.v3.oas.integration.api.OpenAPIConfiguration)2 OpenApiContext (io.swagger.v3.oas.integration.api.OpenApiContext)2