-
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.
[ResponseOps][Rules] Move synthetic rule types' params to @kbn/respon…
…se-ops-rule-params (#204582) Connected with #195187 ## Summary - Moved params of synthetic status monitor rule type to `/response-ops/rule_params/synthetics_monitor_status/` - Moved params of TLS rule type to `/response-ops/rule_params/synthetics_tls/` I created a follow-up issue to handle the places where io-ts is used for params validation in `observability/plugins/synthetics`. #205207 --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
9215df9
commit 98cc4b1
Showing
31 changed files
with
204 additions
and
102 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
20 changes: 20 additions & 0 deletions
20
src/platform/packages/shared/response-ops/rule_params/synthetics_monitor_status/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,20 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export { syntheticsMonitorStatusRuleParamsSchema } from './latest'; | ||
export { syntheticsMonitorStatusRuleParamsSchema as syntheticsMonitorStatusRuleParamsSchemaV1 } from './v1'; | ||
|
||
export type { SyntheticsMonitorStatusRuleParams } from './latest'; | ||
export type { SyntheticsMonitorStatusRuleParams as SyntheticsMonitorStatusRuleParamsV1 } from './v1'; | ||
|
||
export type { TimeWindow } from './latest'; | ||
export type { TimeWindow as TimeWindowV1 } from './v1'; | ||
|
||
export type { StatusRuleCondition } from './latest'; | ||
export type { StatusRuleCondition as StatusRuleConditionV1 } from './v1'; |
10 changes: 10 additions & 0 deletions
10
src/platform/packages/shared/response-ops/rule_params/synthetics_monitor_status/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,10 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export * from './v1'; |
76 changes: 76 additions & 0 deletions
76
src/platform/packages/shared/response-ops/rule_params/synthetics_monitor_status/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,76 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { TypeOf, schema } from '@kbn/config-schema'; | ||
|
||
const TimeWindowSchema = schema.object({ | ||
unit: schema.oneOf( | ||
[schema.literal('s'), schema.literal('m'), schema.literal('h'), schema.literal('d')], | ||
{ | ||
defaultValue: 'm', | ||
} | ||
), | ||
size: schema.number({ | ||
defaultValue: 5, | ||
}), | ||
}); | ||
|
||
const NumberOfChecksSchema = schema.object({ | ||
numberOfChecks: schema.number({ | ||
defaultValue: 5, | ||
min: 1, | ||
max: 100, | ||
}), | ||
}); | ||
|
||
const StatusRuleConditionSchema = schema.object({ | ||
groupBy: schema.maybe( | ||
schema.string({ | ||
defaultValue: 'locationId', | ||
}) | ||
), | ||
downThreshold: schema.maybe( | ||
schema.number({ | ||
defaultValue: 3, | ||
}) | ||
), | ||
locationsThreshold: schema.maybe( | ||
schema.number({ | ||
defaultValue: 1, | ||
}) | ||
), | ||
window: schema.oneOf([ | ||
schema.object({ | ||
time: TimeWindowSchema, | ||
}), | ||
NumberOfChecksSchema, | ||
]), | ||
includeRetests: schema.maybe(schema.boolean()), | ||
}); | ||
|
||
export const syntheticsMonitorStatusRuleParamsSchema = schema.object( | ||
{ | ||
condition: schema.maybe(StatusRuleConditionSchema), | ||
monitorIds: schema.maybe(schema.arrayOf(schema.string())), | ||
locations: schema.maybe(schema.arrayOf(schema.string())), | ||
tags: schema.maybe(schema.arrayOf(schema.string())), | ||
monitorTypes: schema.maybe(schema.arrayOf(schema.string())), | ||
projects: schema.maybe(schema.arrayOf(schema.string())), | ||
kqlQuery: schema.maybe(schema.string()), | ||
}, | ||
{ | ||
meta: { description: 'The parameters for the rule.' }, | ||
} | ||
); | ||
|
||
export type SyntheticsMonitorStatusRuleParams = TypeOf< | ||
typeof syntheticsMonitorStatusRuleParamsSchema | ||
>; | ||
export type TimeWindow = TypeOf<typeof TimeWindowSchema>; | ||
export type StatusRuleCondition = TypeOf<typeof StatusRuleConditionSchema>; |
14 changes: 14 additions & 0 deletions
14
src/platform/packages/shared/response-ops/rule_params/synthetics_tls/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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export { tlsRuleParamsSchema } from './latest'; | ||
export { tlsRuleParamsSchema as tlsRuleParamsSchemaV1 } from './v1'; | ||
|
||
export type { TLSRuleParams } from './latest'; | ||
export type { TLSRuleParams as TLSRuleParamsV1 } from './v1'; |
10 changes: 10 additions & 0 deletions
10
src/platform/packages/shared/response-ops/rule_params/synthetics_tls/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,10 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export * from './v1'; |
23 changes: 23 additions & 0 deletions
23
src/platform/packages/shared/response-ops/rule_params/synthetics_tls/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,23 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { TypeOf, schema } from '@kbn/config-schema'; | ||
|
||
export const tlsRuleParamsSchema = schema.object( | ||
{ | ||
search: schema.maybe(schema.string()), | ||
certExpirationThreshold: schema.maybe(schema.number()), | ||
certAgeThreshold: schema.maybe(schema.number()), | ||
}, | ||
{ | ||
meta: { description: 'The parameters for the rule.' }, | ||
} | ||
); | ||
|
||
export type TLSRuleParams = TypeOf<typeof tlsRuleParamsSchema>; |
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
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
Oops, something went wrong.