Search in sources :

Example 1 with GitRepositoryRemoteDTO

use of io.hops.hopsworks.api.git.remote.GitRepositoryRemoteDTO in project hopsworks by logicalclocks.

the class GitResource method getRepositoryRemotes.

@ApiOperation(value = "Get repository configured remotes: git remotes -v", response = GitRepositoryRemoteDTO.class)
@GET
@Path("/repository/{repositoryId}/remote")
@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 getRepositoryRemotes(@Context UriInfo uriInfo, @Context SecurityContext sc, @PathParam("repositoryId") Integer repositoryId) throws GitOpException {
    GitRepository repository = commandConfigurationValidator.verifyRepository(project, repositoryId);
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.REMOTE);
    GitRepositoryRemoteDTO dto = gitRepositoryRemoteBuilder.build(uriInfo, resourceRequest, project, repository);
    return Response.ok().entity(dto).build();
}
Also used : GitRepository(io.hops.hopsworks.persistence.entity.git.GitRepository) GitRepositoryRemoteDTO(io.hops.hopsworks.api.git.remote.GitRepositoryRemoteDTO) 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)

Example 2 with GitRepositoryRemoteDTO

use of io.hops.hopsworks.api.git.remote.GitRepositoryRemoteDTO in project hopsworks by logicalclocks.

the class GitResource method getRepositoryRemote.

@ApiOperation(value = "Get repository remote of a particular name", response = GitRepositoryRemoteDTO.class)
@GET
@Path("/repository/{repositoryId}/remote/{remoteName}")
@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 getRepositoryRemote(@Context UriInfo uriInfo, @Context SecurityContext sc, @PathParam("repositoryId") Integer repositoryId, @PathParam("remoteName") String remoteName) throws GitOpException {
    if (Strings.isNullOrEmpty(remoteName)) {
        throw new IllegalArgumentException("Remote name is empty");
    }
    GitRepository repository = commandConfigurationValidator.verifyRepository(project, repositoryId);
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.REMOTE);
    GitRepositoryRemoteDTO dto = gitRepositoryRemoteBuilder.build(uriInfo, resourceRequest, project, repository, remoteName);
    return Response.ok().entity(dto).build();
}
Also used : GitRepository(io.hops.hopsworks.persistence.entity.git.GitRepository) GitRepositoryRemoteDTO(io.hops.hopsworks.api.git.remote.GitRepositoryRemoteDTO) 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 GitRepositoryRemoteDTO (io.hops.hopsworks.api.git.remote.GitRepositoryRemoteDTO)2 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)2 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)2 GitRepository (io.hops.hopsworks.persistence.entity.git.GitRepository)2 ApiOperation (io.swagger.annotations.ApiOperation)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2