use of io.hops.hopsworks.api.filter.AllowedProjectRoles in project hopsworks by logicalclocks.
the class GitExecutionResource method getExecution.
@ApiOperation(value = "Get execution of particular Id in a repository", response = GitOpExecutionDTO.class)
@GET
@Path("/{executionId}")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.GIT }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getExecution(@PathParam("executionId") Integer executionId, @Context SecurityContext sc, @Context UriInfo uriInfo, @BeanParam ExecutionBeanParam executionBeanParam) throws GitOpException {
GitOpExecution executionObj = executionController.getExecutionInRepository(gitRepository, executionId);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.EXECUTION);
resourceRequest.setExpansions(executionBeanParam.getExpansions().getResources());
GitOpExecutionDTO dto = gitOpExecutionBuilder.build(uriInfo, resourceRequest, executionObj);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.api.filter.AllowedProjectRoles 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", "HOPS_SERVICE_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER" })
public Response getKeywords(@Context SecurityContext sc, @Context HttpServletRequest req, @Context UriInfo uriInfo) throws FeaturestoreException, MetadataException {
Users user = jwtHelper.getUserPrincipal(sc);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
List<String> keywords = keywordControllerIface.getAll(project, user, featuregroup, trainingDataset, featureView);
KeywordDTO dto;
if (featuregroup != null) {
dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, keywords);
} else if (trainingDataset != null) {
dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, trainingDataset, keywords);
} else if (featureView != null) {
dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featureView, keywords);
} else {
throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.KEYWORD_ERROR, Level.FINE, "Error building keyword object");
}
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.api.filter.AllowedProjectRoles 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", "HOPS_SERVICE_USER" })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER" })
@ApiOperation(value = "Get available keywords for the featurestore", response = KeywordDTO.class)
public Response getUsedKeywords(@Context SecurityContext sc, @Context HttpServletRequest req, @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();
}
use of io.hops.hopsworks.api.filter.AllowedProjectRoles 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", "HOPS_SERVICE_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_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 HttpServletRequest req, @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();
}
use of io.hops.hopsworks.api.filter.AllowedProjectRoles in project hopsworks by logicalclocks.
the class FeaturestoreService method getFeaturestoreSettings.
/**
* Endpoint for getting a featurestore's settings
**
* @return JSON representation of the featurestore settings
*/
@GET
@Path("/settings")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER" })
@ApiOperation(value = "Get featurestore settings", response = FeaturestoreClientSettingsDTO.class)
public Response getFeaturestoreSettings(@Context HttpServletRequest req, @Context SecurityContext sc) {
FeaturestoreClientSettingsDTO featurestoreClientSettingsDTO = new FeaturestoreClientSettingsDTO();
featurestoreClientSettingsDTO.setOnlineFeaturestoreEnabled(settings.isOnlineFeaturestore());
GenericEntity<FeaturestoreClientSettingsDTO> featurestoreClientSettingsDTOGeneric = new GenericEntity<FeaturestoreClientSettingsDTO>(featurestoreClientSettingsDTO) {
};
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featurestoreClientSettingsDTOGeneric).build();
}
Aggregations