Search in sources :

Example 6 with KeywordDTO

use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.

the class FeaturestoreKeywordBuilder method build.

public KeywordDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Featuregroup featureGroup, TrainingDataset trainingDataset, List<String> keywords) {
    KeywordDTO dto = new KeywordDTO();
    if (featureGroup != null) {
        dto.setHref(uri(uriInfo, project, featureGroup.getFeaturestore(), featureGroup));
    } else {
        dto.setHref(uri(uriInfo, project, trainingDataset.getFeaturestore(), trainingDataset));
    }
    dto.setExpand(expand(resourceRequest));
    if (dto.isExpand()) {
        dto.setKeywords(keywords);
    }
    return dto;
}
Also used : KeywordDTO(io.hops.hopsworks.common.featurestore.keyword.KeywordDTO)

Example 7 with KeywordDTO

use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.

the class FeaturestoreKeywordResource method getKeywords.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get keywords")
@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 getKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException, MetadataException {
    Users user = jwtHelper.getUserPrincipal(sc);
    List<String> keywords = keywordControllerIface.getAll(project, user, featuregroup, trainingDataset);
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
    KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, keywords);
    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) 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 8 with KeywordDTO

use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.

the class FeaturestoreService method getUsedKeywords.

@Path("keywords")
@GET
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiOperation(value = "Get available keywords for the featurestore", response = KeywordDTO.class)
public Response getUsedKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException {
    List<String> keywords = keywordControllerIface.getUsedKeywords();
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
    KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, keywords);
    return Response.ok().entity(dto).build();
}
Also used : KeywordDTO(io.hops.hopsworks.common.featurestore.keyword.KeywordDTO) 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

KeywordDTO (io.hops.hopsworks.common.featurestore.keyword.KeywordDTO)8 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)5 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)4 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)4 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)4 ApiOperation (io.swagger.annotations.ApiOperation)4 Users (io.hops.hopsworks.persistence.entity.user.Users)3 Produces (javax.ws.rs.Produces)3 GET (javax.ws.rs.GET)2 FeatureViewDTO (io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO)1 TagsDTO (io.hops.hopsworks.common.tags.TagsDTO)1 Consumes (javax.ws.rs.Consumes)1 DELETE (javax.ws.rs.DELETE)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1