-
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.
[Response Ops][Alerting] Backfill actions schema changes for intermed…
…iate release (#203184) ## Summary This PR contains just the schema changes required to support backfill actions. This is meant for an intermediate release and then the full PR: #200784 will follow after that. --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
8d6d5ef
commit b9bac16
Showing
16 changed files
with
194 additions
and
9 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
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/actions/server/saved_objects/schemas/action_task_params/v2.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. | ||
*/ | ||
|
||
import { schema } from '@kbn/config-schema'; | ||
import { actionTaskParamsSchema as actionTaskParamsSchemaV1 } from './v1'; | ||
|
||
export const actionTaskParamsSchema = actionTaskParamsSchemaV1.extends({ | ||
apiKeyId: 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
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/alerting/server/saved_objects/schemas/raw_ad_hoc_run_params/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,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 { rawAdHocRunParamsSchema } from './v2'; | ||
|
||
export type RawAdHocRunParams = TypeOf<typeof rawAdHocRunParamsSchema>; |
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
99 changes: 99 additions & 0 deletions
99
x-pack/plugins/alerting/server/saved_objects/schemas/raw_ad_hoc_run_params/v2.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,99 @@ | ||
/* | ||
* 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 '@kbn/es-query'; | ||
import { | ||
rawAdHocRunParamsSchema as rawAdHocRunParamsSchemaV1, | ||
rawAdHocRunParamsRuleSchema as rawAdHocRunParamsRuleSchemaV1, | ||
} from './v1'; | ||
|
||
const ISOWeekdaysSchema = schema.oneOf([ | ||
schema.literal(1), | ||
schema.literal(2), | ||
schema.literal(3), | ||
schema.literal(4), | ||
schema.literal(5), | ||
schema.literal(6), | ||
schema.literal(7), | ||
]); | ||
|
||
const rawRuleAlertsFilterSchema = schema.object({ | ||
query: schema.maybe( | ||
schema.object({ | ||
kql: schema.string(), | ||
filters: schema.arrayOf( | ||
schema.object({ | ||
query: schema.maybe(schema.recordOf(schema.string(), schema.any())), | ||
meta: schema.object({ | ||
alias: schema.maybe(schema.nullable(schema.string())), | ||
disabled: schema.maybe(schema.boolean()), | ||
negate: schema.maybe(schema.boolean()), | ||
controlledBy: schema.maybe(schema.string()), | ||
group: schema.maybe(schema.string()), | ||
index: schema.maybe(schema.string()), | ||
isMultiIndex: schema.maybe(schema.boolean()), | ||
type: schema.maybe(schema.string()), | ||
key: schema.maybe(schema.string()), | ||
params: schema.maybe(schema.any()), | ||
value: schema.maybe(schema.string()), | ||
field: schema.maybe(schema.string()), | ||
relation: schema.maybe(schema.oneOf([schema.literal('OR'), schema.literal('AND')])), | ||
}), | ||
$state: schema.maybe( | ||
schema.object({ | ||
store: schema.oneOf([ | ||
schema.literal(FilterStateStore.APP_STATE), // change | ||
schema.literal(FilterStateStore.GLOBAL_STATE), // change | ||
]), | ||
}) | ||
), | ||
}) | ||
), | ||
dsl: schema.string(), // change | ||
}) | ||
), | ||
timeframe: schema.maybe( | ||
schema.object({ | ||
days: schema.arrayOf(ISOWeekdaysSchema), | ||
hours: schema.object({ | ||
start: schema.string(), | ||
end: schema.string(), | ||
}), | ||
timezone: schema.string(), | ||
}) | ||
), | ||
}); | ||
|
||
const rawAdHocRunParamsRuleActionSchema = schema.object({ | ||
uuid: schema.string(), | ||
group: schema.maybe(schema.string()), | ||
actionRef: schema.string(), | ||
actionTypeId: schema.string(), | ||
params: schema.recordOf(schema.string(), schema.any()), | ||
frequency: schema.maybe( | ||
schema.object({ | ||
summary: schema.boolean(), | ||
notifyWhen: schema.oneOf([ | ||
schema.literal('onActionGroupChange'), | ||
schema.literal('onActiveAlert'), | ||
schema.literal('onThrottleInterval'), | ||
]), | ||
throttle: schema.nullable(schema.string()), | ||
}) | ||
), | ||
alertsFilter: schema.maybe(rawRuleAlertsFilterSchema), | ||
useAlertDataForTemplate: schema.maybe(schema.boolean()), | ||
}); | ||
|
||
const rawAdHocRunParamsRuleSchema = rawAdHocRunParamsRuleSchemaV1.extends({ | ||
actions: schema.maybe(schema.arrayOf(rawAdHocRunParamsRuleActionSchema)), | ||
}); | ||
|
||
export const rawAdHocRunParamsSchema = rawAdHocRunParamsSchemaV1.extends({ | ||
rule: rawAdHocRunParamsRuleSchema, | ||
}); |
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