Search in sources :

Example 1 with BranchDTO

use of io.hops.hopsworks.api.git.branch.BranchDTO in project hopsworks by logicalclocks.

the class GitResource method getRepositoryBranches.

@ApiOperation(value = "Get branches for the given repository", response = BranchDTO.class)
@GET
@Path("/repository/{repositoryId}/branch")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.GIT }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getRepositoryBranches(@Context UriInfo uriInfo, @Context SecurityContext sc, @BeanParam Pagination pagination, @PathParam("repositoryId") Integer repositoryId) throws GitOpException {
    GitRepository repository = commandConfigurationValidator.verifyRepository(project, repositoryId);
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.BRANCH);
    resourceRequest.setOffset(pagination.getOffset());
    resourceRequest.setLimit(pagination.getLimit());
    BranchDTO repositoryBranches = branchBuilder.build(uriInfo, resourceRequest, project, repository);
    return Response.ok().entity(repositoryBranches).build();
}
Also used : GitRepository(io.hops.hopsworks.persistence.entity.git.GitRepository) BranchDTO(io.hops.hopsworks.api.git.branch.BranchDTO) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) JWTRequired(io.hops.hopsworks.jwt.annotation.JWTRequired) ApiOperation(io.swagger.annotations.ApiOperation) ApiKeyRequired(io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired) AllowedProjectRoles(io.hops.hopsworks.api.filter.AllowedProjectRoles)

Aggregations

AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)1 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)1 BranchDTO (io.hops.hopsworks.api.git.branch.BranchDTO)1 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)1 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)1 GitRepository (io.hops.hopsworks.persistence.entity.git.GitRepository)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1