use of io.hops.hopsworks.api.featurestore.datavalidation.expectations.ExpectationDTO in project hopsworks by logicalclocks.
the class FeatureGroupExpectationsResource method getAll.
@ApiOperation(value = "Fetch expectations of the feature group", response = ExpectationDTO.class)
@GET
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_SCIENTIST, AllowedProjectRoles.DATA_OWNER })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getAll(@BeanParam Pagination pagination, @BeanParam FeatureGroupExpectationsBeanParam featureGroupExpectationsBeanParam, @Context SecurityContext sc, @Context UriInfo uriInfo) {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.EXPECTATIONS);
resourceRequest.setOffset(pagination.getOffset());
resourceRequest.setLimit(pagination.getLimit());
resourceRequest.setSort(featureGroupExpectationsBeanParam.getSortBySet());
resourceRequest.setExpansions(featureGroupExpectationsBeanParam.getExpansions().getResources());
resourceRequest.setField(featureGroupExpectationsBeanParam.getFieldSet());
ExpectationDTO dto = featureStoreExpectationsBuilder.build(uriInfo, resourceRequest, project, featuregroup);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.api.featurestore.datavalidation.expectations.ExpectationDTO in project hopsworks by logicalclocks.
the class FeatureStoreExpectationsBuilder method build.
public ExpectationDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Featuregroup featuregroup, FeatureGroupExpectation featureGroupExpectation) {
ExpectationDTO dto = new ExpectationDTO();
uri(dto, uriInfo, project, featuregroup, featureGroupExpectation.getFeatureStoreExpectation());
expand(dto, resourceRequest);
if (dto.isExpand()) {
setDtoFields(resourceRequest, dto, featureGroupExpectation.getFeatureStoreExpectation());
}
return dto;
}
use of io.hops.hopsworks.api.featurestore.datavalidation.expectations.ExpectationDTO in project hopsworks by logicalclocks.
the class FeatureStoreExpectationsBuilder method build.
public ExpectationDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Featurestore featureStore, FeatureStoreExpectation featureStoreExpectation) {
ExpectationDTO dto = new ExpectationDTO();
uri(dto, uriInfo, project, featureStore, featureStoreExpectation);
expand(dto, resourceRequest);
if (dto.isExpand()) {
setDtoFields(resourceRequest, dto, featureStoreExpectation);
}
return dto;
}
use of io.hops.hopsworks.api.featurestore.datavalidation.expectations.ExpectationDTO in project hopsworks by logicalclocks.
the class FeatureGroupExpectationsResource method attachExpectation.
@ApiOperation(value = "Attach an expectation to a feature group.", response = ExpectationDTO.class)
@PUT
@Path("/{name}")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_SCIENTIST, AllowedProjectRoles.DATA_OWNER })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response attachExpectation(@ApiParam(value = "name of the expectation", required = true) @PathParam("name") String name, @Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException {
Users user = jWTHelper.getUserPrincipal(sc);
FeatureGroupExpectation expectation = featureGroupValidationsController.attachExpectation(featuregroup, name, project, user);
ExpectationDTO dto = featureStoreExpectationsBuilder.build(uriInfo, new ResourceRequest(ResourceRequest.Name.EXPECTATIONS), project, featurestore, expectation.getFeatureStoreExpectation());
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.api.featurestore.datavalidation.expectations.ExpectationDTO in project hopsworks by logicalclocks.
the class FeatureGroupExpectationsResource method get.
@ApiOperation(value = "Fetch a specific data validation rule", response = ExpectationDTO.class)
@GET
@Path("/{name}")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_SCIENTIST, AllowedProjectRoles.DATA_OWNER })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response get(@ApiParam(value = "name of the expectation", required = true) @PathParam("name") String name, @BeanParam FeatureGroupExpectationsBeanParam featureGroupExpectationsBeanParam, @Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException {
FeatureGroupExpectation expectation = featureGroupValidationsController.getFeatureGroupExpectation(featuregroup, name);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.EXPECTATIONS);
resourceRequest.setField(featureGroupExpectationsBeanParam.getFieldSet());
ExpectationDTO dto = featureStoreExpectationsBuilder.build(uriInfo, resourceRequest, project, featuregroup, expectation);
return Response.ok().entity(dto).build();
}
Aggregations