Search in sources :

Example 1 with PagerData

use of jetbrains.buildServer.server.rest.model.PagerData in project teamcity-rest by JetBrains.

the class TestScopesRequest method serveGroupedTestOccurrences.

// Very highly experimental
@GET
@Path("/{scopeName}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(hidden = true, value = "highly experimental")
public TestScopes serveGroupedTestOccurrences(@QueryParam("locator") String locatorText, @PathParam("scopeName") String scopeName, @QueryParam("fields") String fields, @Context UriInfo uriInfo, @Context HttpServletRequest request) {
    Set<String> supportedGroupings = new HashSet<>(Arrays.asList("package", "suite", "class"));
    if (!supportedGroupings.contains(scopeName)) {
        throw new BadRequestException("Invalid scope. Only scopes " + String.join(",", supportedGroupings) + " are supported.");
    }
    Locator patchedLocator = new Locator(locatorText);
    patchedLocator.setDimension(TestScopesCollector.SCOPE_TYPE, scopeName);
    PagedSearchResult<TestScope> items = myTestScopesCollector.getPagedItems(patchedLocator);
    PagerData pager = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), items, locatorText, "locator");
    return new TestScopes(items.myEntries, new Fields(fields), pager, uriInfo, myBeanContext);
}
Also used : ServiceLocator(jetbrains.buildServer.ServiceLocator) Locator(jetbrains.buildServer.server.rest.data.Locator) Fields(jetbrains.buildServer.server.rest.model.Fields) TestScope(jetbrains.buildServer.server.rest.data.problem.scope.TestScope) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) PagerData(jetbrains.buildServer.server.rest.model.PagerData) TestScopes(jetbrains.buildServer.server.rest.model.problem.scope.TestScopes) HashSet(java.util.HashSet) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with PagerData

use of jetbrains.buildServer.server.rest.model.PagerData in project teamcity-rest by JetBrains.

the class CloudRequest method serveInstances.

/**
 * Returns list of currently known cloud instances
 * @param locator
 */
@GET
@Path("/instances")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get all cloud instances.", nickname = "getAllCloudInstances")
public CloudInstances serveInstances(@QueryParam("locator") String locator, @QueryParam("fields") String fields, @Context UriInfo uriInfo, @Context HttpServletRequest request) {
    final PagedSearchResult<CloudInstanceData> result = myCloudInstanceFinder.getItems(locator);
    final PagerData pager = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), result, locator, "locator");
    return new CloudInstances(CachingValue.simple(() -> result.myEntries), pager, new Fields(fields), myBeanContext);
}
Also used : Fields(jetbrains.buildServer.server.rest.model.Fields) PagerData(jetbrains.buildServer.server.rest.model.PagerData) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with PagerData

use of jetbrains.buildServer.server.rest.model.PagerData in project teamcity-rest by JetBrains.

the class CloudRequest method serveImages.

/**
 * Returns list of currently known cloud images
 * @param locator
 */
@GET
@Path("/images")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get all cloud images.", nickname = "getAllCloudImages")
public CloudImages serveImages(@QueryParam("locator") String locator, @QueryParam("fields") String fields, @Context UriInfo uriInfo, @Context HttpServletRequest request) {
    final PagedSearchResult<jetbrains.buildServer.clouds.CloudImage> result = myCloudImageFinder.getItems(locator);
    final PagerData pager = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), result, locator, "locator");
    return new CloudImages(CachingValue.simple(() -> result.myEntries), pager, new Fields(fields), myBeanContext);
}
Also used : Fields(jetbrains.buildServer.server.rest.model.Fields) PagerData(jetbrains.buildServer.server.rest.model.PagerData) ApiOperation(io.swagger.annotations.ApiOperation)

Example 4 with PagerData

use of jetbrains.buildServer.server.rest.model.PagerData in project teamcity-rest by JetBrains.

the class HealthRequest method getCategories.

@GET
@Path("/category")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HealthCategories getCategories(@QueryParam("locator") @Nullable final String locator, @QueryParam("fields") @Nullable final String fields, @Context @NotNull final UriInfo uriInfo, @Context @NotNull final HttpServletRequest request) {
    final PagedSearchResult<ItemCategory> pagedItems = myHealthItemFinder.getCategories(locator);
    final PagerData pagerData = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), pagedItems, locator, "locator");
    return new HealthCategories(pagedItems.myEntries, pagerData, new Fields(fields), myBeanContext);
}
Also used : HealthCategories(jetbrains.buildServer.server.rest.model.health.HealthCategories) ItemCategory(jetbrains.buildServer.serverSide.healthStatus.ItemCategory) Fields(jetbrains.buildServer.server.rest.model.Fields) PagerData(jetbrains.buildServer.server.rest.model.PagerData)

Example 5 with PagerData

use of jetbrains.buildServer.server.rest.model.PagerData in project teamcity-rest by JetBrains.

the class HealthRequest method getHealthItems.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HealthItems getHealthItems(@QueryParam("locator") @Nullable final String locator, @QueryParam("fields") @Nullable final String fields, @Context @NotNull final UriInfo uriInfo, @Context @NotNull final HttpServletRequest request) {
    final PagedSearchResult<jetbrains.buildServer.serverSide.healthStatus.HealthStatusItem> pagedItems = myHealthItemFinder.getItems(locator);
    final PagerData pagerData = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), pagedItems, locator, "locator");
    return new HealthItems(pagedItems.myEntries, pagerData, new Fields(fields), myBeanContext);
}
Also used : Fields(jetbrains.buildServer.server.rest.model.Fields) HealthItems(jetbrains.buildServer.server.rest.model.health.HealthItems) PagerData(jetbrains.buildServer.server.rest.model.PagerData)

Aggregations

PagerData (jetbrains.buildServer.server.rest.model.PagerData)15 Fields (jetbrains.buildServer.server.rest.model.Fields)14 ApiOperation (io.swagger.annotations.ApiOperation)11 ServiceLocator (jetbrains.buildServer.ServiceLocator)5 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)3 Locator (jetbrains.buildServer.server.rest.data.Locator)2 HashSet (java.util.HashSet)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 XmlElement (javax.xml.bind.annotation.XmlElement)1 SVcsModificationOrChangeDescriptor (jetbrains.buildServer.server.rest.data.change.SVcsModificationOrChangeDescriptor)1 TestOccurrencesCachedInfo (jetbrains.buildServer.server.rest.data.problem.TestOccurrencesCachedInfo)1 TestScope (jetbrains.buildServer.server.rest.data.problem.scope.TestScope)1 LocatorProcessException (jetbrains.buildServer.server.rest.errors.LocatorProcessException)1 AgentPool (jetbrains.buildServer.server.rest.model.agent.AgentPool)1 AgentPools (jetbrains.buildServer.server.rest.model.agent.AgentPools)1 AuditEvents (jetbrains.buildServer.server.rest.model.audit.AuditEvents)1 HealthCategories (jetbrains.buildServer.server.rest.model.health.HealthCategories)1 HealthItems (jetbrains.buildServer.server.rest.model.health.HealthItems)1 TestOccurrences (jetbrains.buildServer.server.rest.model.problem.TestOccurrences)1 TestScopes (jetbrains.buildServer.server.rest.model.problem.scope.TestScopes)1