forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAM] Add HTTP versioning to resolve, snooze, and unsnooze APIs (elas…
…tic#168886) ## Summary **REOPENED version of elastic#163359, git history got too complicated and triggered too many codeowners** Part of elastic#157883 Converts `_resolve`, `_snooze`, `_unsnooze` to new HTTP versioned model ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
3cf19b2
commit ce430e5
Showing
89 changed files
with
1,059 additions
and
561 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
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/alerting/common/routes/rule/apis/resolve/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 { resolveParamsSchema } from './schemas/latest'; | ||
|
||
export { resolveParamsSchema as resolveParamsSchemaV1 } from './schemas/v1'; | ||
|
||
export type { ResolveRuleResponse } from './types/latest'; | ||
|
||
export type { ResolveRuleResponse as ResolveRuleResponseV1 } from './types/v1'; |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
x-pack/plugins/alerting/common/routes/rule/apis/resolve/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,12 @@ | ||
/* | ||
* 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'; | ||
|
||
export const resolveParamsSchema = schema.object({ | ||
id: schema.string(), | ||
}); |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/alerting/common/routes/rule/apis/resolve/types/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,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 { RuleParamsV1, RuleResponseV1 } from '../../../response'; | ||
|
||
export interface ResolveRuleResponse<Params extends RuleParamsV1 = never> { | ||
body: RuleResponseV1<Params>; | ||
} |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/common/routes/rule/apis/snooze/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,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 { snoozeParamsSchema, snoozeBodySchema } from './schemas/latest'; | ||
|
||
export { | ||
snoozeParamsSchema as snoozeParamsSchemaV1, | ||
snoozeBodySchema as snoozeBodySchemaV1, | ||
} from './schemas/v1'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/rule/apis/snooze/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 * from './v1'; |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/alerting/common/routes/rule/apis/snooze/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,17 @@ | ||
/* | ||
* 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 { ruleSnoozeScheduleSchemaV1 } from '../../../request'; | ||
|
||
export const snoozeParamsSchema = schema.object({ | ||
id: schema.string(), | ||
}); | ||
|
||
export const snoozeBodySchema = schema.object({ | ||
snooze_schedule: ruleSnoozeScheduleSchemaV1, | ||
}); |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/common/routes/rule/apis/unsnooze/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,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 { unsnoozeParamsSchema, unsnoozeBodySchema } from './schemas/latest'; | ||
|
||
export { | ||
unsnoozeParamsSchema as unsnoozeParamsSchemaV1, | ||
unsnoozeBodySchema as unsnoozeBodySchemaV1, | ||
} from './schemas/v1'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/rule/apis/unsnooze/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 * from './v1'; |
18 changes: 18 additions & 0 deletions
18
x-pack/plugins/alerting/common/routes/rule/apis/unsnooze/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,18 @@ | ||
/* | ||
* 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'; | ||
|
||
export const unsnoozeParamsSchema = schema.object({ | ||
id: schema.string(), | ||
}); | ||
|
||
const scheduleIdsSchema = schema.maybe(schema.arrayOf(schema.string())); | ||
|
||
export const unsnoozeBodySchema = schema.object({ | ||
schedule_ids: scheduleIdsSchema, | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/rule/common/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,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 * from './v1'; |
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/alerting/common/routes/rule/common/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,38 @@ | ||
/* | ||
* 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 { | ||
ruleNotifyWhen, | ||
ruleLastRunOutcomeValues, | ||
ruleExecutionStatusValues, | ||
ruleExecutionStatusErrorReason, | ||
ruleExecutionStatusWarningReason, | ||
} from './constants/latest'; | ||
|
||
export type { | ||
RuleNotifyWhen, | ||
RuleLastRunOutcomeValues, | ||
RuleExecutionStatusValues, | ||
RuleExecutionStatusErrorReason, | ||
RuleExecutionStatusWarningReason, | ||
} from './constants/latest'; | ||
|
||
export { | ||
ruleNotifyWhen as ruleNotifyWhenV1, | ||
ruleLastRunOutcomeValues as ruleLastRunOutcomeValuesV1, | ||
ruleExecutionStatusValues as ruleExecutionStatusValuesV1, | ||
ruleExecutionStatusErrorReason as ruleExecutionStatusErrorReasonV1, | ||
ruleExecutionStatusWarningReason as ruleExecutionStatusWarningReasonV1, | ||
} from './constants/v1'; | ||
|
||
export type { | ||
RuleNotifyWhen as RuleNotifyWhenV1, | ||
RuleLastRunOutcomeValues as RuleLastRunOutcomeValuesV1, | ||
RuleExecutionStatusValues as RuleExecutionStatusValuesV1, | ||
RuleExecutionStatusErrorReason as RuleExecutionStatusErrorReasonV1, | ||
RuleExecutionStatusWarningReason as RuleExecutionStatusWarningReasonV1, | ||
} from './constants/v1'; |
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
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/rule/request/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 * from './v1'; |
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/alerting/common/routes/rule/request/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,19 @@ | ||
/* | ||
* 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 { rRuleRequestSchemaV1 } from '../../../r_rule'; | ||
import { validateSnoozeScheduleV1 } from '../../validation'; | ||
|
||
export const ruleSnoozeScheduleSchema = schema.object( | ||
{ | ||
id: schema.maybe(schema.string()), | ||
duration: schema.number(), | ||
rRule: rRuleRequestSchemaV1, | ||
}, | ||
{ validate: validateSnoozeScheduleV1 } | ||
); |
Oops, something went wrong.