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.
Adding model versions for all remaining so types without model versio…
…ns (elastic#195500) Resolves elastic#184618 ## Summary Adds v1 schemas for all remaining Response Ops owned saved object types: * `connector_token` * `api_key_pending_invalidation` * `maintenance-window` * `rules-settings` ## To Verify 1. Run ES and Kibana on `main` and create saved objects for each of the above types: a. Create an OAuth ServiceNow ITOM connector to create a `connector_token` saved object b. Create a rule, let it run, and then delete the rule. This will create an `api_key_pending_invalidation` SO and 2 `rules-settings` SOs c. Create some maintenance windows, both with and without filters 2. Keep ES running and switch to this branch and restart Kibana. Then verify you can read and modify the existing SOs with no errors a. Test the ServiceNow ITOM connector, which should read the `connector_token` SO b. Modify the rules settings and then run a rule to ensure they're loaded with no errors c. Load the maintenance window UI and edit a MW Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit d9cd17b) # Conflicts: # src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts
- Loading branch information
Showing
17 changed files
with
283 additions
and
7 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
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/actions/server/saved_objects/model_versions/connector_token_model_versions.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 { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; | ||
import { rawConnectorTokenSchemaV1 } from '../schemas/raw_connector_token'; | ||
|
||
export const connectorTokenModelVersions: SavedObjectsModelVersionMap = { | ||
'1': { | ||
changes: [], | ||
schemas: { | ||
forwardCompatibility: rawConnectorTokenSchemaV1.extends({}, { unknowns: 'ignore' }), | ||
create: rawConnectorTokenSchemaV1, | ||
}, | ||
}, | ||
}; |
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/actions/server/saved_objects/schemas/raw_connector_token/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 { rawConnectorTokenSchema as rawConnectorTokenSchemaV1 } from './v1'; |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/actions/server/saved_objects/schemas/raw_connector_token/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'; | ||
|
||
export const rawConnectorTokenSchema = schema.object({ | ||
createdAt: schema.string(), | ||
connectorId: schema.string(), | ||
expiresAt: schema.string(), | ||
token: schema.string(), | ||
tokenType: schema.string(), | ||
updatedAt: 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
22 changes: 22 additions & 0 deletions
22
...erting/server/saved_objects/model_versions/api_key_pending_invalidation_model_versions.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,22 @@ | ||
/* | ||
* 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 { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; | ||
import { rawApiKeyPendingInvalidationSchemaV1 } from '../schemas/raw_api_key_pending_invalidation'; | ||
|
||
export const apiKeyPendingInvalidationModelVersions: SavedObjectsModelVersionMap = { | ||
'1': { | ||
changes: [], | ||
schemas: { | ||
forwardCompatibility: rawApiKeyPendingInvalidationSchemaV1.extends( | ||
{}, | ||
{ unknowns: 'ignore' } | ||
), | ||
create: rawApiKeyPendingInvalidationSchemaV1, | ||
}, | ||
}, | ||
}; |
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
19 changes: 19 additions & 0 deletions
19
...plugins/alerting/server/saved_objects/model_versions/maintenance_window_model_versions.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 { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; | ||
import { rawMaintenanceWindowSchemaV1 } from '../schemas/raw_maintenance_window'; | ||
|
||
export const maintenanceWindowModelVersions: SavedObjectsModelVersionMap = { | ||
'1': { | ||
changes: [], | ||
schemas: { | ||
forwardCompatibility: rawMaintenanceWindowSchemaV1.extends({}, { unknowns: 'ignore' }), | ||
create: rawMaintenanceWindowSchemaV1, | ||
}, | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/alerting/server/saved_objects/model_versions/rules_settings_model_versions.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 { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; | ||
import { rawRulesSettingsSchemaV1 } from '../schemas/raw_rules_settings'; | ||
|
||
export const rulesSettingsModelVersions: SavedObjectsModelVersionMap = { | ||
'1': { | ||
changes: [], | ||
schemas: { | ||
forwardCompatibility: rawRulesSettingsSchemaV1.extends({}, { unknowns: 'ignore' }), | ||
create: rawRulesSettingsSchemaV1, | ||
}, | ||
}, | ||
}; |
8 changes: 8 additions & 0 deletions
8
...k/plugins/alerting/server/saved_objects/schemas/raw_api_key_pending_invalidation/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 { rawApiKeyPendingInvalidationSchema as rawApiKeyPendingInvalidationSchemaV1 } from './v1'; |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/server/saved_objects/schemas/raw_api_key_pending_invalidation/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. | ||
*/ | ||
|
||
import { schema } from '@kbn/config-schema'; | ||
|
||
export const rawApiKeyPendingInvalidationSchema = schema.object({ | ||
apiKeyId: schema.string(), | ||
createdAt: schema.string(), | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/server/saved_objects/schemas/raw_maintenance_window/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 { rawMaintenanceWindowSchema as rawMaintenanceWindowSchemaV1 } from './v1'; |
87 changes: 87 additions & 0 deletions
87
x-pack/plugins/alerting/server/saved_objects/schemas/raw_maintenance_window/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,87 @@ | ||
/* | ||
* 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'; | ||
|
||
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()), | ||
}); | ||
|
||
const rRuleSchema = schema.object({ | ||
dtstart: schema.string(), | ||
tzid: schema.string(), | ||
freq: schema.maybe( | ||
schema.oneOf([ | ||
schema.literal(0), | ||
schema.literal(1), | ||
schema.literal(2), | ||
schema.literal(3), | ||
schema.literal(4), | ||
schema.literal(5), | ||
schema.literal(6), | ||
]) | ||
), | ||
until: schema.maybe(schema.string()), | ||
count: schema.maybe(schema.number()), | ||
interval: schema.maybe(schema.number()), | ||
wkst: schema.maybe( | ||
schema.oneOf([ | ||
schema.literal('MO'), | ||
schema.literal('TU'), | ||
schema.literal('WE'), | ||
schema.literal('TH'), | ||
schema.literal('FR'), | ||
schema.literal('SA'), | ||
schema.literal('SU'), | ||
]) | ||
), | ||
byweekday: schema.maybe(schema.arrayOf(schema.oneOf([schema.string(), schema.number()]))), | ||
bymonth: schema.maybe(schema.number()), | ||
bysetpos: schema.maybe(schema.number()), | ||
bymonthday: schema.maybe(schema.number()), | ||
byyearday: schema.maybe(schema.number()), | ||
byweekno: schema.maybe(schema.number()), | ||
byhour: schema.maybe(schema.number()), | ||
byminute: schema.maybe(schema.number()), | ||
bysecond: schema.maybe(schema.number()), | ||
}); | ||
|
||
const rawMaintenanceWindowEventsSchema = schema.object({ | ||
gte: schema.string(), | ||
lte: schema.string(), | ||
}); | ||
|
||
export const rawMaintenanceWindowSchema = schema.object({ | ||
categoryIds: schema.maybe(schema.nullable(schema.arrayOf(schema.string()))), | ||
createdAt: schema.string(), | ||
createdBy: schema.nullable(schema.string()), | ||
duration: schema.number(), | ||
enabled: schema.boolean(), | ||
events: schema.arrayOf(rawMaintenanceWindowEventsSchema), | ||
expirationDate: schema.string(), | ||
rRule: rRuleSchema, | ||
scopedQuery: schema.maybe(schema.nullable(alertsFilterQuerySchema)), | ||
title: schema.string(), | ||
updatedAt: schema.string(), | ||
updatedBy: schema.nullable(schema.string()), | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/server/saved_objects/schemas/raw_rules_settings/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 { rawRulesSettingsSchema as rawRulesSettingsSchemaV1 } from './v1'; |
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/alerting/server/saved_objects/schemas/raw_rules_settings/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,31 @@ | ||
/* | ||
* 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 rawRulesSettingsSchema = schema.object({ | ||
flapping: schema.maybe( | ||
schema.object({ | ||
createdAt: schema.string(), | ||
createdBy: schema.nullable(schema.string()), | ||
enabled: schema.boolean(), | ||
lookBackWindow: schema.number(), | ||
statusChangeThreshold: schema.number(), | ||
updatedAt: schema.string(), | ||
updatedBy: schema.nullable(schema.string()), | ||
}) | ||
), | ||
queryDelay: schema.maybe( | ||
schema.object({ | ||
createdAt: schema.string(), | ||
createdBy: schema.nullable(schema.string()), | ||
delay: schema.number(), | ||
updatedAt: schema.string(), | ||
updatedBy: schema.nullable(schema.string()), | ||
}) | ||
), | ||
}); |