Search in sources :

Example 1 with GitRepositoryDTO

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();
}
Also used : GitRepositoryDTO(io.hops.hopsworks.api.git.repository.GitRepositoryDTO) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) 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)

Example 2 with GitRepositoryDTO

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();
}
Also used : GitRepository(io.hops.hopsworks.persistence.entity.git.GitRepository) GitRepositoryDTO(io.hops.hopsworks.api.git.repository.GitRepositoryDTO) 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)2 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)2 GitRepositoryDTO (io.hops.hopsworks.api.git.repository.GitRepositoryDTO)2 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)2 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)2 ApiOperation (io.swagger.annotations.ApiOperation)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 GitRepository (io.hops.hopsworks.persistence.entity.git.GitRepository)1 Path (javax.ws.rs.Path)1