use of io.hops.hopsworks.api.git.repository.GitRepositoryDTO in project hopsworks by logicalclocks.
the class GitResource method gitRepositories.
@ApiOperation(value = "Get all the repositories in a project", response = GitRepositoryDTO.class)
@GET
@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 gitRepositories(@Context UriInfo uriInfo, @Context SecurityContext sc, @BeanParam Pagination pagination, @BeanParam RepositoryBeanParam repositoryBeanParam) {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.REPOSITORY);
resourceRequest.setExpansions(repositoryBeanParam.getExpansions().getResources());
resourceRequest.setOffset(pagination.getOffset());
resourceRequest.setLimit(pagination.getLimit());
GitRepositoryDTO repositories = gitRepositoryBuilder.build(uriInfo, resourceRequest, project);
return Response.ok().entity(repositories).build();
}
use of io.hops.hopsworks.api.git.repository.GitRepositoryDTO in project hopsworks by logicalclocks.
the class GitResource method gitRepository.
@ApiOperation(value = "Get a repository with a particular Id", response = GitRepositoryDTO.class)
@GET
@Path("/repository/{repositoryId}")
@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 gitRepository(@PathParam("repositoryId") Integer repositoryId, @Context SecurityContext sc, @Context UriInfo uriInfo, @BeanParam RepositoryBeanParam repositoryBeanParam) throws GitOpException {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.REPOSITORY);
resourceRequest.setExpansions(repositoryBeanParam.getExpansions().getResources());
GitRepository gitRepository = commandConfigurationValidator.verifyRepository(project, repositoryId);
GitRepositoryDTO dto = gitRepositoryBuilder.build(uriInfo, resourceRequest, project, gitRepository);
return Response.ok().entity(dto).build();
}
Aggregations