Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] New Platform server shim: update datafeed routes #57739

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions x-pack/legacy/plugins/ml/server/new_platform/datafeeds_schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { schema } from '@kbn/config-schema';

export const startDatafeedSchema = schema.object({
start: schema.maybe(schema.oneOf([schema.number(), schema.string()])),
end: schema.maybe(schema.oneOf([schema.number(), schema.string()])),
timeout: schema.maybe(schema.any()),
});

export const datafeedConfigSchema = schema.object({
datafeed_id: schema.maybe(schema.string()),
feed_id: schema.maybe(schema.string()),
aggregations: schema.maybe(schema.any()),
aggs: schema.maybe(schema.any()),
chunking_config: schema.maybe(schema.any()),
frequency: schema.maybe(schema.string()),
indices: schema.arrayOf(schema.string()),
indexes: schema.maybe(schema.arrayOf(schema.string())),
job_id: schema.maybe(schema.string()),
query: schema.maybe(schema.any()),
max_empty_searches: schema.maybe(schema.number()),
query_delay: schema.maybe(schema.string()),
script_fields: schema.maybe(schema.any()),
scroll_size: schema.maybe(schema.number()),
delayed_data_check_config: schema.maybe(schema.any()),
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { schema } from '@kbn/config-schema';
import { anomalyDetectionJobSchema } from './anomaly_detectors_schema';
import { datafeedConfigSchema } from './datafeeds_schema';

export const estimateBucketSpanSchema = schema.object({
aggTypes: schema.arrayOf(schema.nullable(schema.string())),
Expand Down Expand Up @@ -38,22 +39,6 @@ export const validateJobSchema = schema.object({
job: schema.object(anomalyDetectionJobSchema),
});

const datafeedConfigSchema = schema.object({
datafeed_id: schema.string(),
aggregations: schema.maybe(schema.any()),
aggs: schema.maybe(schema.any()),
chunking_config: schema.maybe(schema.any()),
frequency: schema.maybe(schema.string()),
indices: schema.arrayOf(schema.string()),
indexes: schema.maybe(schema.arrayOf(schema.string())),
job_id: schema.string(),
query: schema.any(),
query_delay: schema.maybe(schema.string()),
script_fields: schema.maybe(schema.any()),
scroll_size: schema.maybe(schema.number()),
delayed_data_check_config: schema.maybe(schema.any()),
});

export const validateCardinalitySchema = {
...anomalyDetectionJobSchema,
datafeed_config: datafeedConfigSchema,
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/ml/server/new_platform/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { mirrorPluginStatus } from '../../../../server/lib/mirror_plugin_status'
import { LICENSE_TYPE } from '../../common/constants/license';
import { annotationRoutes } from '../routes/annotations';
import { jobRoutes } from '../routes/anomaly_detectors';
// @ts-ignore: could not find declaration file for module
import { dataFeedRoutes } from '../routes/datafeeds';
// @ts-ignore: could not find declaration file for module
import { indicesRoutes } from '../routes/indices';
Expand Down
13 changes: 12 additions & 1 deletion x-pack/legacy/plugins/ml/server/routes/apidoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@
"ValidateCardinality",
"ValidateJob",
"NotificationSettings",
"GetNotificationSettings"
"GetNotificationSettings",
"DatafeedService",
"GetDatafeeds",
"GetDatafeed",
"GetDatafeedsStats",
"GetDatafeedStats",
"CreateDatafeed",
"UpdateDatafeed",
"DeleteDatafeed",
"StartDatafeed",
"StopDatafeed",
"PreviewDatafeed"
]
}
152 changes: 0 additions & 152 deletions x-pack/legacy/plugins/ml/server/routes/datafeeds.js

This file was deleted.

Loading