Search in sources :

Example 1 with FeaturestoreDTO

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

the class FeaturestoreService method getFeaturestoreByName.

/**
 * Endpoint for getting a featurestore by name.
 *
 * @param name
 *   the name of the featurestore
 * @return JSON representation of the featurestore
 */
@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 featurestore with a specific name", response = FeaturestoreDTO.class)
public Response getFeaturestoreByName(@ApiParam(value = "Id of the featurestore", required = true) @PathParam("name") String name, @Context SecurityContext sc) throws FeaturestoreException {
    verifyNameProvided(name);
    FeaturestoreDTO featurestoreDTO = featurestoreController.getFeaturestoreForProjectWithName(project, name);
    GenericEntity<FeaturestoreDTO> featurestoreDTOGeneric = new GenericEntity<FeaturestoreDTO>(featurestoreDTO) {
    };
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featurestoreDTOGeneric).build();
}
Also used : FeaturestoreDTO(io.hops.hopsworks.common.featurestore.FeaturestoreDTO) GenericEntity(javax.ws.rs.core.GenericEntity) 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 FeaturestoreDTO

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

the class FeaturestoreService method getFeaturestore.

/**
 * Endpoint for getting a featurestore with a particular Id
 *
 * @param featurestoreId the id of the featurestore
 * @return JSON representation of the featurestore
 */
@GET
@Path("/{featurestoreId: [0-9]+}")
@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 featurestore with specific Id", response = FeaturestoreDTO.class)
public Response getFeaturestore(@ApiParam(value = "Id of the featurestore", required = true) @PathParam("featurestoreId") Integer featurestoreId, @Context SecurityContext sc) throws FeaturestoreException {
    if (featurestoreId == null) {
        throw new IllegalArgumentException(RESTCodes.FeaturestoreErrorCode.FEATURESTORE_ID_NOT_PROVIDED.getMessage());
    }
    FeaturestoreDTO featurestoreDTO = featurestoreController.getFeaturestoreForProjectWithId(project, featurestoreId);
    GenericEntity<FeaturestoreDTO> featurestoreDTOGeneric = new GenericEntity<FeaturestoreDTO>(featurestoreDTO) {
    };
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featurestoreDTOGeneric).build();
}
Also used : FeaturestoreDTO(io.hops.hopsworks.common.featurestore.FeaturestoreDTO) GenericEntity(javax.ws.rs.core.GenericEntity) 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 3 with FeaturestoreDTO

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

the class FeatureStoreExpectationsResource method setFeaturestoreId.

/**
 * Sets the featurestore of the featuregroups (provided by parent resource)
 *
 * @param featurestoreId id of the featurestore
 * @throws FeaturestoreException FeaturestoreException
 */
public void setFeaturestoreId(Integer featurestoreId) throws FeaturestoreException {
    // This call verifies that the project have access to the featurestoreId provided
    FeaturestoreDTO featurestoreDTO = featurestoreController.getFeaturestoreForProjectWithId(project, featurestoreId);
    this.featurestore = featurestoreController.getFeaturestoreWithId(featurestoreDTO.getFeaturestoreId());
}
Also used : FeaturestoreDTO(io.hops.hopsworks.common.featurestore.FeaturestoreDTO)

Example 4 with FeaturestoreDTO

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

the class FeaturestoreStorageConnectorService method setFeaturestoreId.

/**
 * Sets the featurestore of the featuregroups (provided by parent resource)
 *
 * @param featurestoreId
 *   id of the featurestore
 * @throws FeaturestoreException
 */
public void setFeaturestoreId(Integer featurestoreId) throws FeaturestoreException {
    // This call verifies that the project have access to the featurestoreId provided
    FeaturestoreDTO featurestoreDTO = featurestoreController.getFeaturestoreForProjectWithId(project, featurestoreId);
    this.featurestore = featurestoreController.getFeaturestoreWithId(featurestoreDTO.getFeaturestoreId());
}
Also used : FeaturestoreDTO(io.hops.hopsworks.common.featurestore.FeaturestoreDTO)

Example 5 with FeaturestoreDTO

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

the class TrainingDatasetService method setFeaturestoreId.

/**
 * Sets the featurestore of the training datasets (provided by parent resource)
 *
 * @param featurestoreId id of the featurestore
 * @throws FeaturestoreException
 */
public void setFeaturestoreId(Integer featurestoreId) throws FeaturestoreException {
    // This call verifies that the project have access to the featurestoreId provided
    FeaturestoreDTO featurestoreDTO = featurestoreController.getFeaturestoreForProjectWithId(project, featurestoreId);
    this.featurestore = featurestoreController.getFeaturestoreWithId(featurestoreDTO.getFeaturestoreId());
}
Also used : FeaturestoreDTO(io.hops.hopsworks.common.featurestore.FeaturestoreDTO)

Aggregations

FeaturestoreDTO (io.hops.hopsworks.common.featurestore.FeaturestoreDTO)7 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)2 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)2 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)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 GenericEntity (javax.ws.rs.core.GenericEntity)2