-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MW scoped query API and schema changes
- Loading branch information
Showing
41 changed files
with
711 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/alerting/common/routes/alerts_filter_query/constants/latest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { filterStateStore } from './v1'; | ||
export type { FilterStateStore } from './v1'; |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/common/routes/alerts_filter_query/constants/v1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export const filterStateStore = { | ||
APP_STATE: 'appState', | ||
GLOBAL_STATE: 'globalState', | ||
} as const; | ||
|
||
export type FilterStateStore = typeof filterStateStore[keyof typeof filterStateStore]; |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/alerting/common/routes/alerts_filter_query/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { filterStateStore } from './constants/latest'; | ||
export type { FilterStateStore } from './constants/latest'; | ||
export { alertsFilterQuerySchema } from './schemas/latest'; | ||
|
||
export { filterStateStore as filterStateStoreV1 } from './constants/v1'; | ||
export type { FilterStateStore as FilterStateStoreV1 } from './constants/v1'; | ||
export { alertsFilterQuerySchema as alertsFilterQuerySchemaV1 } from './schemas/v1'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/alerts_filter_query/schemas/latest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { alertsFilterQuerySchema } from './v1'; |
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/alerting/common/routes/alerts_filter_query/schemas/v1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { schema } from '@kbn/config-schema'; | ||
import { filterStateStore } from '..'; | ||
|
||
export const alertsFilterQuerySchema = schema.object({ | ||
kql: schema.string(), | ||
filters: schema.arrayOf( | ||
schema.object({ | ||
query: schema.maybe(schema.recordOf(schema.string(), schema.any())), | ||
meta: schema.recordOf(schema.string(), schema.any()), | ||
$state: schema.maybe( | ||
schema.object({ | ||
store: schema.oneOf([ | ||
schema.literal(filterStateStore.APP_STATE), | ||
schema.literal(filterStateStore.GLOBAL_STATE), | ||
]), | ||
}) | ||
), | ||
}) | ||
), | ||
dsl: schema.maybe(schema.string()), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/server/application/alerts_filter_query/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export const filterStateStore = { | ||
APP_STATE: 'appState', | ||
GLOBAL_STATE: 'globalState', | ||
} as const; | ||
|
||
export type FilterStateStore = typeof filterStateStore[keyof typeof filterStateStore]; |
28 changes: 28 additions & 0 deletions
28
...ns/alerting/server/application/alerts_filter_query/schemas/alerts_filter_query_schemas.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { schema } from '@kbn/config-schema'; | ||
import { filterStateStore } from '../constants'; | ||
|
||
export const alertsFilterQuerySchema = schema.object({ | ||
kql: schema.string(), | ||
filters: schema.arrayOf( | ||
schema.object({ | ||
query: schema.maybe(schema.recordOf(schema.string(), schema.any())), | ||
meta: schema.recordOf(schema.string(), schema.any()), | ||
$state: schema.maybe( | ||
schema.object({ | ||
store: schema.oneOf([ | ||
schema.literal(filterStateStore.APP_STATE), | ||
schema.literal(filterStateStore.GLOBAL_STATE), | ||
]), | ||
}) | ||
), | ||
}) | ||
), | ||
dsl: schema.maybe(schema.string()), | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/server/application/alerts_filter_query/schemas/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { alertsFilterQuerySchema } from './alerts_filter_query_schemas'; |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/alerting/server/application/alerts_filter_query/types/alerts_filter_query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { TypeOf } from '@kbn/config-schema'; | ||
import { alertsFilterQuerySchema } from '../schemas/alerts_filter_query_schemas'; | ||
|
||
export type AlertsFilterQuery = TypeOf<typeof alertsFilterQuerySchema>; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/server/application/alerts_filter_query/types/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export type { AlertsFilterQuery } from './alerts_filter_query'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.