use of io.hops.hopsworks.common.featurestore.featuregroup.FeaturegroupDTO in project hopsworks by logicalclocks.
the class TestFeatureStoreInputValidation method testVerifyDescription.
@Test
public void testVerifyDescription() throws Exception {
FeaturegroupDTO featuregroupDTO = new FeaturegroupDTO(1, "featurestore", 1, "wrong_name", 1, "online_topic_name");
// description is too long
featuregroupDTO.setDescription(StringUtils.repeat("a", 260));
thrown.expect(FeaturestoreException.class);
featurestoreInputValidation.verifyUserInput(featuregroupDTO);
}
use of io.hops.hopsworks.common.featurestore.featuregroup.FeaturegroupDTO in project hopsworks by logicalclocks.
the class FeaturegroupService method getFeatureGroup.
/**
* Retrieve a specific feature group based name. Allow filtering on version.
*
* @param name name of the featuregroup
* @param version queryParam with the desired version
* @return JSON representation of the featuregroup
*/
@GET
// Anything else that is not just number should use this endpoint
@Path("/{name: [a-z0-9_]*(?=[a-z])[a-z0-9_]+}")
@Produces(MediaType.APPLICATION_JSON)
@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" })
@ApiOperation(value = "Get a list of feature groups with a specific name, filter by version", response = FeaturegroupDTO.class)
public Response getFeatureGroup(@ApiParam(value = "Name of the feature group", required = true) @PathParam("name") String name, @ApiParam(value = "Filter by a specific version") @QueryParam("version") Integer version, @Context SecurityContext sc) throws FeaturestoreException, ServiceException {
Users user = jWTHelper.getUserPrincipal(sc);
verifyNameProvided(name);
List<FeaturegroupDTO> featuregroupDTO;
if (version == null) {
featuregroupDTO = featuregroupController.getFeaturegroupWithNameAndFeaturestore(featurestore, name, project, user);
} else {
featuregroupDTO = Arrays.asList(featuregroupController.getFeaturegroupWithNameVersionAndFeaturestore(featurestore, name, version, project, user));
}
GenericEntity<List<FeaturegroupDTO>> featuregroupGeneric = new GenericEntity<List<FeaturegroupDTO>>(featuregroupDTO) {
};
return Response.ok().entity(featuregroupGeneric).build();
}
use of io.hops.hopsworks.common.featurestore.featuregroup.FeaturegroupDTO in project hopsworks by logicalclocks.
the class FeaturegroupService method getFeaturegroupsForFeaturestore.
/**
* Endpoint for getting all featuregroups of a featurestore
*
* @return list of JSON featuregroups
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiOperation(value = "Get the list of feature groups for a featurestore", response = FeaturegroupDTO.class, responseContainer = "List")
public Response getFeaturegroupsForFeaturestore(@BeanParam FeatureGroupBeanParam featureGroupBeanParam, @Context SecurityContext sc) throws FeaturestoreException, ServiceException {
Users user = jWTHelper.getUserPrincipal(sc);
List<FeaturegroupDTO> featuregroups = featuregroupController.getFeaturegroupsForFeaturestore(featurestore, project, user, featureGroupBeanParam.getFilterValues());
GenericEntity<List<FeaturegroupDTO>> featuregroupsGeneric = new GenericEntity<List<FeaturegroupDTO>>(featuregroups) {
};
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featuregroupsGeneric).build();
}
use of io.hops.hopsworks.common.featurestore.featuregroup.FeaturegroupDTO in project hopsworks by logicalclocks.
the class FeaturegroupService method getFeatureGroup.
/**
* Endpoint for retrieving a featuregroup with a specified id in a specified featurestore
*
* @param featuregroupId id of the featuregroup
* @return JSON representation of the featuregroup
*/
@Deprecated
@GET
@Path("/{featuregroupId: [0-9]+}")
@Produces(MediaType.APPLICATION_JSON)
@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" })
@ApiOperation(value = "Get specific featuregroup from a specific featurestore", response = FeaturegroupDTO.class)
public Response getFeatureGroup(@ApiParam(value = "Id of the featuregroup", required = true) @PathParam("featuregroupId") Integer featuregroupId, @Context SecurityContext sc) throws FeaturestoreException, ServiceException {
Users user = jWTHelper.getUserPrincipal(sc);
verifyIdProvided(featuregroupId);
FeaturegroupDTO featuregroupDTO = featuregroupController.getFeaturegroupWithIdAndFeaturestore(featurestore, featuregroupId, project, user);
GenericEntity<FeaturegroupDTO> featuregroupGeneric = new GenericEntity<FeaturegroupDTO>(featuregroupDTO) {
};
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featuregroupGeneric).build();
}
Aggregations