Search in sources :

Example 16 with ResourceRequest

use of io.hops.hopsworks.common.api.ResourceRequest in project hopsworks by logicalclocks.

the class FeaturestoreKeywordResource method deleteKeywords.

@DELETE
@ApiOperation(value = "Delete a keyword")
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response deleteKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo, @QueryParam("keyword") String keyword) throws FeaturestoreException, MetadataException {
    Users user = jwtHelper.getUserPrincipal(sc);
    List<String> updatedKeywords = keywordControllerIface.deleteKeywords(project, user, featuregroup, trainingDataset, Arrays.asList(keyword));
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
    KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, updatedKeywords);
    return Response.ok().entity(dto).build();
}
Also used : KeywordDTO(io.hops.hopsworks.common.featurestore.keyword.KeywordDTO) Users(io.hops.hopsworks.persistence.entity.user.Users) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) DELETE(javax.ws.rs.DELETE) 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 17 with ResourceRequest

use of io.hops.hopsworks.common.api.ResourceRequest in project hopsworks by logicalclocks.

the class FeaturestoreKeywordResource method replaceKeywords.

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create keywords or replace existing ones")
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response replaceKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo, KeywordDTO keywordDTO) throws FeaturestoreException, MetadataException {
    Users user = jwtHelper.getUserPrincipal(sc);
    List<String> updatedKeywords = keywordControllerIface.replaceKeywords(project, user, featuregroup, trainingDataset, keywordDTO.getKeywords());
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
    KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, updatedKeywords);
    return Response.ok().entity(dto).build();
}
Also used : KeywordDTO(io.hops.hopsworks.common.featurestore.keyword.KeywordDTO) Users(io.hops.hopsworks.persistence.entity.user.Users) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) 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 18 with ResourceRequest

use of io.hops.hopsworks.common.api.ResourceRequest in project hopsworks by logicalclocks.

the class CodeResource method get.

@GET
@Path("/{codeId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get specific available code")
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.DATASET_VIEW, ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response get(@BeanParam Pagination pagination, @BeanParam CodeBeanParam codeBeanParam, @PathParam("codeId") Integer codeId, @Context UriInfo uriInfo, @Context SecurityContext sc) throws FeaturestoreException, ServiceException {
    Users user = jWTHelper.getUserPrincipal(sc);
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.CODE);
    resourceRequest.setOffset(pagination.getOffset());
    resourceRequest.setLimit(pagination.getLimit());
    resourceRequest.setSort(codeBeanParam.getSortBySet());
    resourceRequest.setFilter(codeBeanParam.getFilterSet());
    resourceRequest.setField(codeBeanParam.getFieldSet());
    CodeDTO dto;
    if (featuregroup != null) {
        dto = codeBuilder.build(uriInfo, resourceRequest, project, user, featuregroup, codeId, codeBeanParam.getFormat());
    } else {
        dto = codeBuilder.build(uriInfo, resourceRequest, project, user, trainingDataset, codeId, codeBeanParam.getFormat());
    }
    return Response.ok().entity(dto).build();
}
Also used : Users(io.hops.hopsworks.persistence.entity.user.Users) 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 19 with ResourceRequest

use of io.hops.hopsworks.common.api.ResourceRequest in project hopsworks by logicalclocks.

the class CommitResource method getFeatureGroupCommit.

@GET
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiOperation(value = "Get Feature Group Commit", response = CommitDTO.class)
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getFeatureGroupCommit(@Context UriInfo uriInfo, @BeanParam Pagination pagination, @BeanParam CommitBeanParam commitBeanParam, @Context SecurityContext sc) {
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.COMMITS);
    resourceRequest.setOffset(pagination.getOffset());
    resourceRequest.setLimit(pagination.getLimit());
    resourceRequest.setSort(commitBeanParam.getSortBySet());
    resourceRequest.setFilter(commitBeanParam.getFilter());
    CommitDTO builtCommitDTO = commitBuilder.build(uriInfo, resourceRequest, project, featuregroup);
    return Response.ok().entity(builtCommitDTO).build();
}
Also used : 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 20 with ResourceRequest

use of io.hops.hopsworks.common.api.ResourceRequest in project hopsworks by logicalclocks.

the class CommitResource method commitFeatureGroup.

@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiOperation(value = "Commit to Feature Group", response = CommitDTO.class)
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response commitFeatureGroup(@Context UriInfo uriInfo, CommitDTO commitDTO, @Context SecurityContext sc) throws FeaturestoreException {
    Users user = jwtHelper.getUserPrincipal(sc);
    FeatureGroupCommit featureGroupCommit = featureGroupCommitController.createHudiFeatureGroupCommit(user, featuregroup, commitDTO.getCommitDateString(), commitDTO.getCommitTime(), commitDTO.getRowsUpdated(), commitDTO.getRowsInserted(), commitDTO.getRowsDeleted(), commitDTO.getValidationId());
    CommitDTO builtCommitDTO = commitBuilder.build(uriInfo, new ResourceRequest(ResourceRequest.Name.COMMITS), project, featuregroup, featureGroupCommit);
    return Response.ok().entity(builtCommitDTO).build();
}
Also used : Users(io.hops.hopsworks.persistence.entity.user.Users) FeatureGroupCommit(io.hops.hopsworks.persistence.entity.featurestore.featuregroup.cached.FeatureGroupCommit) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes) 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

ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)171 ApiOperation (io.swagger.annotations.ApiOperation)163 Produces (javax.ws.rs.Produces)157 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)151 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)127 GET (javax.ws.rs.GET)107 Path (javax.ws.rs.Path)99 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)94 Users (io.hops.hopsworks.persistence.entity.user.Users)75 Consumes (javax.ws.rs.Consumes)37 POST (javax.ws.rs.POST)30 PUT (javax.ws.rs.PUT)27 DatasetPath (io.hops.hopsworks.common.dataset.util.DatasetPath)20 TagsDTO (io.hops.hopsworks.common.tags.TagsDTO)17 AlertException (io.hops.hopsworks.exceptions.AlertException)14 Project (io.hops.hopsworks.persistence.entity.project.Project)14 UriBuilder (javax.ws.rs.core.UriBuilder)12 AlertManagerUnreachableException (io.hops.hopsworks.alert.exception.AlertManagerUnreachableException)11 AlertManagerClientCreateException (io.hops.hopsworks.alerting.exceptions.AlertManagerClientCreateException)11 HashMap (java.util.HashMap)9