org.jboss.pnc.rest.api.endpoints.GroupConfigurationEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-api Show documentation
Show all versions of rest-api Show documentation
Module with REST API bidings.
The newest version!
/**
* JBoss, Home of Professional Open Source.
* Copyright 2014-2022 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.pnc.rest.api.endpoints;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.jboss.pnc.dto.Build;
import org.jboss.pnc.dto.BuildConfiguration;
import org.jboss.pnc.dto.BuildConfigurationRef;
import org.jboss.pnc.dto.GroupBuild;
import org.jboss.pnc.dto.GroupConfiguration;
import org.jboss.pnc.dto.requests.GroupBuildRequest;
import org.jboss.pnc.dto.response.ErrorResponse;
import org.jboss.pnc.dto.response.Page;
import org.jboss.pnc.processor.annotation.Client;
import org.jboss.pnc.rest.annotation.RespondWithStatus;
import org.jboss.pnc.rest.api.parameters.BuildsFilterParameters;
import org.jboss.pnc.rest.api.parameters.GroupBuildParameters;
import org.jboss.pnc.rest.api.parameters.GroupBuildsFilterParameters;
import org.jboss.pnc.rest.api.parameters.PageParameters;
import org.jboss.pnc.rest.api.swagger.response.SwaggerPages.BuildConfigPage;
import org.jboss.pnc.rest.api.swagger.response.SwaggerPages.BuildPage;
import org.jboss.pnc.rest.api.swagger.response.SwaggerPages.GroupBuildPage;
import org.jboss.pnc.rest.api.swagger.response.SwaggerPages.GroupConfigPage;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.ws.rs.BeanParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PATCH;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ACCEPTED_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ACCEPTED_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.CONFLICTED_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.CONFLICTED_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ENTITY_CREATED_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ENTITY_CREATED_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ENTITY_UPDATED_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.ENTITY_UPDATED_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.INVALID_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.INVALID_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.NOT_FOUND_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.NOT_FOUND_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.NO_CONTENT_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.NO_CONTENT_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.SERVER_ERROR_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.SERVER_ERROR_DESCRIPTION;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.SUCCESS_CODE;
import static org.jboss.pnc.rest.configuration.SwaggerConstants.SUCCESS_DESCRIPTION;
@Tag(name = "Group Configs")
@Path("/group-configs")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Client
public interface GroupConfigurationEndpoint {
static final String GC_ID = "ID of the group config";
static final String GET_ALL_DESC = "Gets all group configs.";
/**
* {@value GET_ALL_DESC}
*
* @param pageParams
* @return
*/
@Operation(
summary = GET_ALL_DESC,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupConfigPage.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
Page getAll(@Valid @BeanParam PageParameters pageParams);
static final String CREATE_NEW_DESC = "Creates a new group config.";
/**
* {@value CREATE_NEW_DESC}
*
* @param groupConfig
* @return
*/
@Operation(
summary = CREATE_NEW_DESC,
responses = {
@ApiResponse(
responseCode = ENTITY_CREATED_CODE,
description = ENTITY_CREATED_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupConfiguration.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = CONFLICTED_CODE,
description = CONFLICTED_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@POST
@RespondWithStatus(Response.Status.CREATED)
GroupConfiguration createNew(@NotNull GroupConfiguration groupConfig);
static final String GET_SPECIFIC_DESC = "Gets a specific group config.";
/**
* {@value GET_SPECIFIC_DESC}
*
* @param id {@value GC_ID}
* @return
*/
@Operation(
summary = GET_SPECIFIC_DESC,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupConfiguration.class))),
@ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) // workaround for PATCH support
GroupConfiguration getSpecific(@Parameter(description = GC_ID) @PathParam("id") String id);
static final String UPDATE_DESC = "Updates an existing group config.";
/**
* {@value UPDATE_DESC}
*
* @param id {@value GC_ID}
* @param groupConfig
*/
@Operation(
summary = UPDATE_DESC,
responses = { @ApiResponse(responseCode = ENTITY_UPDATED_CODE, description = ENTITY_UPDATED_DESCRIPTION),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = CONFLICTED_CODE,
description = CONFLICTED_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PUT
@Path("/{id}")
void update(@Parameter(description = GC_ID) @PathParam("id") String id, @NotNull GroupConfiguration groupConfig);
static final String PATCH_SPECIFIC_DESC = "Patch a specific group config.";
/**
* {@value PATCH_SPECIFIC_DESC}
*
* @param id {@value GC_ID}
* @param groupConfig
* @return
*/
@Operation(
summary = PATCH_SPECIFIC_DESC,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupConfiguration.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
GroupConfiguration patchSpecific(
@Parameter(description = GC_ID) @PathParam("id") String id,
@NotNull GroupConfiguration groupConfig);
static final String GROUP_BUILD_REQUEST = "List of build config revision to build instead of latest revision.";
static final String TRIGGER_DESC = "Builds the build configs in the group config.";
/**
* {@value TRIGGER_DESC}
*
* @param id {@value GC_ID}
* @param buildParams
* @param request {@value GROUP_BUILD_REQUEST}
* @return
*/
@Operation(
summary = TRIGGER_DESC,
responses = {
@ApiResponse(
responseCode = ACCEPTED_CODE,
description = ACCEPTED_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupBuild.class))),
@ApiResponse(
responseCode = CONFLICTED_CODE,
description = CONFLICTED_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@POST
@RespondWithStatus(Response.Status.ACCEPTED)
@Path("/{id}/build")
@Consumes(MediaType.APPLICATION_JSON)
GroupBuild trigger(
@Parameter(description = GC_ID) @PathParam("id") String id,
@Valid @BeanParam GroupBuildParameters buildParams,
@Parameter(description = GROUP_BUILD_REQUEST) GroupBuildRequest request);
static final String GET_BUILD_CONFIGS_DESC = "Gets the build configs for the group config.";
/**
* {@value GET_BUILD_CONFIGS_DESC}
*
* @param id {@value GC_ID}
* @param pageParams
* @return
*/
@Operation(
summary = GET_BUILD_CONFIGS_DESC,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = BuildConfigPage.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/build-configs")
Page getBuildConfigs(
@Parameter(description = GC_ID) @PathParam("id") String id,
@Valid @BeanParam PageParameters pageParams);
static final String ADD_BUILD_CONFIG_DESC = "Adds a build config to the group config.";
/**
* {@value ADD_BUILD_CONFIG_DESC}
*
* @param id {@value GC_ID}
* @param buildConfig
*/
@Operation(
summary = ADD_BUILD_CONFIG_DESC,
responses = { @ApiResponse(responseCode = NO_CONTENT_CODE, description = NO_CONTENT_DESCRIPTION),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@POST
@Path("/{id}/build-configs")
void addBuildConfig(@Parameter(description = GC_ID) @PathParam("id") String id, BuildConfigurationRef buildConfig);
static final String REMOVE_BUILD_CONFIG_DESC = "Removes a build config from the specified group config.";
/**
* {@value REMOVE_BUILD_CONFIG_DESC}
*
* @param id {@value GC_ID}
* @param configId {@value BuildConfigurationEndpoint#BC_ID}
*/
@Operation(
summary = REMOVE_BUILD_CONFIG_DESC,
responses = { @ApiResponse(responseCode = NO_CONTENT_CODE, description = NO_CONTENT_DESCRIPTION),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@DELETE
@Path("/{id}/build-configs/{configId}")
void removeBuildConfig(
@Parameter(description = GC_ID) @PathParam("id") String id,
@Parameter(description = BuildConfigurationEndpoint.BC_ID) @PathParam("configId") String configId);
static final String GET_BUILDS_DESC = "Gets all builds associated with the contained build configs.";
/**
* {@value GET_BUILDS_DESC}
*
* @param id {@value GC_ID}
* @param pageParams
* @param filterParams
* @return
*/
@Operation(
summary = GET_BUILDS_DESC,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = BuildPage.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/builds")
Page getBuilds(
@Parameter(description = GC_ID) @PathParam("id") String id,
@Valid @BeanParam PageParameters pageParams,
@BeanParam BuildsFilterParameters filterParams);
static final String GET_ALL_GROUP_BUILDS = "Get all group builds associated with this group config.";
/**
* {@value GET_ALL_GROUP_BUILDS}
*
* @param id {@value GC_ID}
* @param pageParams
* @return
*/
@Operation(
summary = GET_ALL_GROUP_BUILDS,
responses = {
@ApiResponse(
responseCode = SUCCESS_CODE,
description = SUCCESS_DESCRIPTION,
content = @Content(schema = @Schema(implementation = GroupBuildPage.class))),
@ApiResponse(
responseCode = INVALID_CODE,
description = INVALID_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(
responseCode = SERVER_ERROR_CODE,
description = SERVER_ERROR_DESCRIPTION,
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/group-builds")
Page getAllGroupBuilds(
@Parameter(description = GC_ID) @PathParam("id") String id,
@Valid @BeanParam PageParameters pageParams,
@BeanParam GroupBuildsFilterParameters filterParams);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy