use of io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired in project hopsworks by logicalclocks.
the class FeatureGroupDetailsResource method getDetails.
@ApiOperation(value = "Get feature group details", response = DetailsDTO.class)
@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" })
public Response getDetails(@ApiParam(value = "Storage for which to retrieve the details") @QueryParam("storage") @DefaultValue("OFFLINE") Storage storage, @Context UriInfo uriInfo, @Context SecurityContext sc) throws FeaturestoreException, HopsSecurityException {
Users user = jwtHelper.getUserPrincipal(sc);
if (!featuregroup.getFeaturegroupType().equals(FeaturegroupType.CACHED_FEATURE_GROUP)) {
throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.CANNOT_FETCH_HIVE_SCHEMA_FOR_ON_DEMAND_FEATUREGROUPS, Level.FINE, "Hive schema is available only for Cached feature groups, " + featuregroup.getName() + " is on demand");
}
DetailsDTO detailsDTO = detailsBuilder.build(uriInfo, user, project, featuregroup, storage);
return Response.ok().entity(detailsDTO).build();
}
use of io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired in project hopsworks by logicalclocks.
the class FeaturestoreStorageConnectorService method getStorageConnectors.
/**
* Endpoint for getting all storage connectors in a featurestore
*
* @return a JSON representation of all the storage connectors in the feature store
*/
@GET
@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 all storage connectors of a feature store", response = FeaturestoreStorageConnectorDTO.class, responseContainer = "List")
public Response getStorageConnectors(@Context SecurityContext sc) throws FeaturestoreException {
Users user = jWTHelper.getUserPrincipal(sc);
List<FeaturestoreStorageConnectorDTO> featurestoreStorageConnectorDTOS = storageConnectorController.getConnectorsForFeaturestore(user, project, featurestore);
GenericEntity<List<FeaturestoreStorageConnectorDTO>> featurestoreStorageConnectorsGeneric = new GenericEntity<List<FeaturestoreStorageConnectorDTO>>(featurestoreStorageConnectorDTOS) {
};
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(featurestoreStorageConnectorsGeneric).build();
}
use of io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired in project hopsworks by logicalclocks.
the class RulesResource method get.
@ApiOperation(value = "Get a specific data validation rule that can be applied to a feature group", response = RuleDTO.class)
@GET
@Path("/{name}")
@Produces(MediaType.APPLICATION_JSON)
@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 rule", required = true) @PathParam("name") Name name, @Context UriInfo uriInfo, @Context SecurityContext sc) throws FeaturestoreException {
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.RULES);
RuleDTO dto = rulesBuilder.build(uriInfo, resourceRequest, name);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired in project hopsworks by logicalclocks.
the class KafkaResource method getSubjectVersions.
@ApiOperation(value = "Get list of versions of a registered subject.")
@GET
@Path("/subjects/{subject}/versions")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.KAFKA }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getSubjectVersions(@PathParam("subject") String subject, @Context SecurityContext sc) {
try {
List<Integer> versions = subjectsController.getSubjectVersions(project, subject);
String array = Arrays.toString(versions.toArray());
GenericEntity<String> entity = new GenericEntity<String>(array) {
};
return Response.ok().entity(entity).build();
} catch (SchemaException e) {
SchemaRegistryError error = new SchemaRegistryError(e.getErrorCode().getCode(), e.getErrorCode().getMessage());
return Response.status(e.getErrorCode().getRespStatus()).entity(error).build();
}
}
use of io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired in project hopsworks by logicalclocks.
the class KafkaResource method deleteSubject.
@ApiOperation(value = "Delete a subject with all its versions and its compatibility if exists.")
@DELETE
@Path("/subjects/{subject}")
@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.KAFKA }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response deleteSubject(@PathParam("subject") String subject, @Context SecurityContext sc) throws KafkaException {
try {
List<Integer> versions = subjectsController.deleteSubject(project, subject);
String array = Arrays.toString(versions.toArray());
GenericEntity<String> entity = new GenericEntity<String>(array) {
};
return Response.ok().entity(entity).build();
} catch (SchemaException e) {
SchemaRegistryError error = new SchemaRegistryError(e.getErrorCode().getCode(), e.getErrorCode().getMessage());
return Response.status(e.getErrorCode().getRespStatus()).entity(error).build();
}
}
Aggregations