@GET @Path("ml/models") @Produces(MediaType.APPLICATION_JSON) @Timed public Response listModelInfos() { return WSUtils.respondEntities(modelRegistryService.listModelInfos(), OK); }
@GET @Path("/schemas") @ApiOperation(value = "Get list of schemas by filtering with the given query parameters", response = SchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response listSchemas(@Context UriInfo uriInfo) { try { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); Map<String, String> filters = new HashMap<>(); for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) { List<String> value = entry.getValue(); filters.put(entry.getKey(), value != null && !value.isEmpty() ? value.get(0) : null); } Collection<SchemaMetadataInfo> schemaMetadatas = schemaRegistry.findSchemaMetadata(filters); return WSUtils.respondEntities(schemaMetadatas, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas") @ApiOperation(value = "Get list of schemas by filtering with the given query parameters", response = SchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response listSchemas(@Context UriInfo uriInfo) { try { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); Map<String, String> filters = new HashMap<>(); for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) { List<String> value = entry.getValue(); filters.put(entry.getKey(), value != null && !value.isEmpty() ? value.get(0) : null); } Collection<SchemaMetadataInfo> schemaMetadatas = schemaRegistry.findSchemaMetadata(filters); return WSUtils.respondEntities(schemaMetadatas, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemaproviders") @ApiOperation(value = "Get list of registered Schema Providers", notes = "The Schema Registry supports different types of schemas, such as Avro, JSON etc. " + "" + "A Schema Provider is needed for each type of schema supported by the Schema Registry. " + "Schema Provider supports defining schema, serializing and deserializing data using the schema, " + " and checking compatibility between different versions of the schema.", response = SchemaProviderInfo.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed public Response getRegisteredSchemaProviderInfos(@Context UriInfo uriInfo) { try { Collection<SchemaProviderInfo> schemaProviderInfos = schemaRegistry.getSupportedSchemaProviders(); return WSUtils.respondEntities(schemaProviderInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/search/schemas") @ApiOperation(value = "Search for schemas containing the given name and description", notes = "Search the schemas for given name and description, return a list of schemas that contain the field.", response = SchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response findSchemas(@Context UriInfo uriInfo) { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); try { Collection<SchemaMetadataInfo> schemaMetadataInfos = findSchemaMetadataInfos(queryParameters); return WSUtils.respondEntities(schemaMetadataInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while finding schemas for given fields [{}]", queryParameters, ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemaproviders") @ApiOperation(value = "Get list of registered Schema Providers", notes = "The Schema Registry supports different types of schemas, such as Avro, JSON etc. " + "" + "A Schema Provider is needed for each type of schema supported by the Schema Registry. " + "Schema Provider supports defining schema, serializing and deserializing data using the schema, " + " and checking compatibility between different versions of the schema.", response = SchemaProviderInfo.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed public Response getRegisteredSchemaProviderInfos(@Context UriInfo uriInfo) { try { Collection<SchemaProviderInfo> schemaProviderInfos = schemaRegistry.getSupportedSchemaProviders(); return WSUtils.respondEntities(schemaProviderInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/search/schemas") @ApiOperation(value = "Search for schemas containing the given name and description", notes = "Search the schemas for given name and description, return a list of schemas that contain the field.", response = SchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response findSchemas(@Context UriInfo uriInfo) { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); try { Collection<SchemaMetadataInfo> schemaMetadataInfos = findSchemaMetadataInfos(queryParameters); return WSUtils.respondEntities(schemaMetadataInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while finding schemas for given fields [{}]", queryParameters, ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/search/schemas/fields") @ApiOperation(value = "Search for schemas containing the given field names", notes = "Search the schemas for given field names and return a list of schemas that contain the field.", response = SchemaVersionKey.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response findSchemasByFields(@Context UriInfo uriInfo) { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); try { Collection<SchemaVersionKey> schemaVersionKeys = schemaRegistry.findSchemasByFields(buildSchemaFieldQuery(queryParameters)); return WSUtils.respondEntities(schemaVersionKeys, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while finding schemas for given fields [{}]", queryParameters, ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/search/schemas/fields") @ApiOperation(value = "Search for schemas containing the given field names", notes = "Search the schemas for given field names and return a list of schemas that contain the field.", response = SchemaVersionKey.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response findSchemasByFields(@Context UriInfo uriInfo) { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); try { Collection<SchemaVersionKey> schemaVersionKeys = schemaRegistry.findSchemasByFields(buildSchemaFieldQuery(queryParameters)); return WSUtils.respondEntities(schemaVersionKeys, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while finding schemas for given fields [{}]", queryParameters, ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas/{name}/branches") @ApiOperation(value = "Get list of registered schema branches", response = SchemaBranch.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed @UnitOfWork public Response getAllBranches(@ApiParam(value = "Details about schema name",required = true) @PathParam("name") String schemaName, @Context UriInfo uriInfo) { try { Collection<SchemaBranch> schemaBranches = schemaRegistry.getSchemaBranches(schemaName); return WSUtils.respondEntities(schemaBranches, Response.Status.OK); } catch(SchemaNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } catch (Exception ex) { LOG.error("Encountered error while listing schema branches", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas/aggregated") @ApiOperation(value = "Get list of schemas by filtering with the given query parameters", response = AggregatedSchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response listAggregatedSchemas(@Context UriInfo uriInfo) { try { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); Map<String, String> filters = new HashMap<>(); for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) { List<String> value = entry.getValue(); filters.put(entry.getKey(), value != null && !value.isEmpty() ? value.get(0) : null); } Collection<AggregatedSchemaMetadataInfo> schemaMetadatas = schemaRegistry.findAggregatedSchemaMetadata(filters); return WSUtils.respondEntities(schemaMetadatas, Response.Status.OK); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas/aggregated") @ApiOperation(value = "Get list of schemas by filtering with the given query parameters", response = AggregatedSchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response listAggregatedSchemas(@Context UriInfo uriInfo) { try { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); Map<String, String> filters = new HashMap<>(); for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) { List<String> value = entry.getValue(); filters.put(entry.getKey(), value != null && !value.isEmpty() ? value.get(0) : null); } Collection<AggregatedSchemaMetadataInfo> schemaMetadatas = schemaRegistry.findAggregatedSchemaMetadata(filters); return WSUtils.respondEntities(schemaMetadatas, Response.Status.OK); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas/{name}/branches") @ApiOperation(value = "Get list of registered schema branches", response = SchemaBranch.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed @UnitOfWork public Response getAllBranches(@ApiParam(value = "Details about schema name",required = true) @PathParam("name") String schemaName, @Context UriInfo uriInfo) { try { Collection<SchemaBranch> schemaBranches = schemaRegistry.getSchemaBranches(schemaName); return WSUtils.respondEntities(schemaBranches, Response.Status.OK); } catch(SchemaNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } catch (Exception ex) { LOG.error("Encountered error while listing schema branches", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Path("/schemas/{name}/versions") @ApiOperation(value = "Get all the versions of the schema for the given schema name)", response = SchemaVersionInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response getAllSchemaVersions(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @QueryParam("branch") @DefaultValue(MASTER_BRANCH) String schemaBranchName, @QueryParam("states") List<Byte> stateIds) { Response response; try { Collection<SchemaVersionInfo> schemaVersionInfos = schemaRegistry.getAllVersions(schemaBranchName, schemaName, stateIds); if (schemaVersionInfos != null) { response = WSUtils.respondEntities(schemaVersionInfos, Response.Status.OK); } else { LOG.info("No schemas found with schemakey: [{}]", schemaName); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while getting all schema versions for schemakey [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Path("/schemas/{name}/versions") @ApiOperation(value = "Get all the versions of the schema for the given schema name)", response = SchemaVersionInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response getAllSchemaVersions(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @QueryParam("branch") @DefaultValue(MASTER_BRANCH) String schemaBranchName, @QueryParam("states") List<Byte> stateIds) { Response response; try { Collection<SchemaVersionInfo> schemaVersionInfos = schemaRegistry.getAllVersions(schemaBranchName, schemaName, stateIds); if (schemaVersionInfos != null) { response = WSUtils.respondEntities(schemaVersionInfos, Response.Status.OK); } else { LOG.info("No schemas found with schemakey: [{}]", schemaName); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while getting all schema versions for schemakey [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
/** * <p> * Gets all the entities tagged with the given tag id. This also recursively gets * all the entities belonging to any child tags of the given tag. The child tags itself * are not included in the result. * </p> * <b>GET /api/v1/catalog/tags/1/entities</b> * <pre> * { * "entities":[{ * "id":12, * "namespace":"tag" * }] * } * </pre> * * @param tagId the tag id * @return the response */ @GET @Path("/tags/{id}/entities") @Timed @UnitOfWork public Response getTaggedEntities(@PathParam("id") Long tagId) { List<TaggedEntity> result = tagService.getEntities(tagId, true); if (result != null) { return WSUtils.respondEntities(result, OK); } throw EntityNotFoundException.byId(tagId.toString()); }
@GET @Path("/schemas/{name}/serdes") @ApiOperation(value = "Get list of Serializers registered for the given schema name", response = SerDesInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SERDE) @Timed @UnitOfWork public Response getSerializers(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName) { Response response; try { SchemaMetadataInfo schemaMetadataInfoStorable = schemaRegistry.getSchemaMetadataInfo(schemaName); if (schemaMetadataInfoStorable != null) { Collection<SerDesInfo> schemaSerializers = schemaRegistry.getSerDes(schemaMetadataInfoStorable.getSchemaMetadata().getName()); response = WSUtils.respondEntities(schemaSerializers, Response.Status.OK); } else { LOG.info("No schemas found with schemakey: [{}]", schemaName); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (Exception ex) { LOG.error("Encountered error while getting serializers for schemaKey [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Path("/schemas/{name}/serdes") @ApiOperation(value = "Get list of Serializers registered for the given schema name", response = SerDesInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SERDE) @Timed @UnitOfWork public Response getSerializers(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName) { Response response; try { SchemaMetadataInfo schemaMetadataInfoStorable = schemaRegistry.getSchemaMetadataInfo(schemaName); if (schemaMetadataInfoStorable != null) { Collection<SerDesInfo> schemaSerializers = schemaRegistry.getSerDes(schemaMetadataInfoStorable.getSchemaMetadata().getName()); response = WSUtils.respondEntities(schemaSerializers, Response.Status.OK); } else { LOG.info("No schemas found with schemakey: [{}]", schemaName); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (Exception ex) { LOG.error("Encountered error while getting serializers for schemaKey [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
return WSUtils.respondEntities(aggregatedSchemaMetadataInfos, Response.Status.OK); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage());
return WSUtils.respondEntities(aggregatedSchemaMetadataInfos, Response.Status.OK); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage());