[RAM] remove schedule_snooze from public api (#136142) (#136311)

* remove schedule_snooze form public api

* went too fast

* fix api integration test II

* fix test to remove all snoozeSchdule III

* fix legacy api integration for find

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit dec18895eb)

Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
This commit is contained in:
Kibana Machine 2022-07-13 12:56:02 -04:00 committed by GitHub
parent 2efa79a40b
commit 915dd28c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 11 additions and 39 deletions

View file

@ -2617,7 +2617,7 @@ export class RulesClient {
...(s.rRule.until ? { until: new Date(s.rRule.until) } : {}),
},
}));
const includeSnoozeSchedule = snoozeSchedule !== undefined;
const includeSnoozeSchedule = snoozeSchedule !== undefined && !excludeFromPublicApi;
const rule = {
id,
notifyWhen,

View file

@ -376,7 +376,6 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
@ -1645,7 +1644,6 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
@ -1779,7 +1777,6 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
@ -1913,7 +1910,6 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
@ -2079,7 +2075,6 @@ describe('create()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],

View file

@ -115,7 +115,6 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
created_by: user.username,
schedule: { interval: '1m' },
scheduled_task_id: response.body.scheduled_task_id,
snooze_schedule: response.body.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
throttle: '1m',

View file

@ -73,7 +73,6 @@ const findTestUtils = (
params: {},
created_by: 'elastic',
scheduled_task_id: match.scheduled_task_id,
snooze_schedule: match.snooze_schedule,
created_at: match.created_at,
updated_at: match.updated_at,
throttle: '1m',
@ -83,7 +82,9 @@ const findTestUtils = (
mute_all: false,
muted_alert_ids: [],
execution_status: match.execution_status,
...(describeType === 'internal' ? { monitoring: match.monitoring } : {}),
...(describeType === 'internal'
? { monitoring: match.monitoring, snooze_schedule: match.snooze_schedule }
: {}),
});
expect(Date.parse(match.created_at)).to.be.greaterThan(0);
expect(Date.parse(match.updated_at)).to.be.greaterThan(0);
@ -282,8 +283,9 @@ const findTestUtils = (
created_at: match.created_at,
updated_at: match.updated_at,
execution_status: match.execution_status,
snooze_schedule: match.snooze_schedule,
...(describeType === 'internal' ? { monitoring: match.monitoring } : {}),
...(describeType === 'internal'
? { monitoring: match.monitoring, snooze_schedule: match.snooze_schedule }
: {}),
});
expect(Date.parse(match.created_at)).to.be.greaterThan(0);
expect(Date.parse(match.updated_at)).to.be.greaterThan(0);

View file

@ -72,7 +72,6 @@ const getTestUtils = (
params: {},
created_by: 'elastic',
scheduled_task_id: response.body.scheduled_task_id,
snooze_schedule: response.body.snooze_schedule,
updated_at: response.body.updated_at,
created_at: response.body.created_at,
throttle: '1m',
@ -85,6 +84,7 @@ const getTestUtils = (
...(describeType === 'internal'
? {
monitoring: response.body.monitoring,
snooze_schedule: response.body.snooze_schedule,
}
: {}),
});

View file

@ -99,7 +99,6 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext)
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -156,7 +155,6 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext)
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -224,7 +222,6 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext)
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -292,7 +289,6 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext)
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,

View file

@ -104,7 +104,6 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -166,7 +165,6 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -239,7 +237,6 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,
@ -312,7 +309,6 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex
.auth(user.username, user.password)
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest,

View file

@ -129,7 +129,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
},
],
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,
@ -214,7 +213,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
mute_all: false,
muted_alert_ids: [],
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,
@ -310,7 +308,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
mute_all: false,
muted_alert_ids: [],
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,
@ -406,7 +403,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
mute_all: false,
muted_alert_ids: [],
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,
@ -500,7 +496,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
mute_all: false,
muted_alert_ids: [],
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,

View file

@ -85,7 +85,6 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
created_by: null,
schedule: { interval: '1m' },
scheduled_task_id: response.body.scheduled_task_id,
snooze_schedule: response.body.snooze_schedule,
updated_by: null,
api_key_owner: null,
throttle: '1m',
@ -181,7 +180,6 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
created_by: null,
schedule: { interval: '1m' },
scheduled_task_id: response.body.scheduled_task_id,
snooze_schedule: response.body.snooze_schedule,
updated_by: null,
api_key_owner: null,
throttle: '1m',
@ -477,7 +475,6 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
createdBy: null,
schedule: { interval: '1m' },
scheduledTaskId: response.body.scheduledTaskId,
snoozeSchedule: response.body.snoozeSchedule,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',

View file

@ -64,7 +64,6 @@ const findTestUtils = (
created_by: null,
api_key_owner: null,
scheduled_task_id: match.scheduled_task_id,
snooze_schedule: match.snooze_schedule,
updated_by: null,
throttle: '1m',
notify_when: 'onThrottleInterval',
@ -73,7 +72,9 @@ const findTestUtils = (
created_at: match.created_at,
updated_at: match.updated_at,
execution_status: match.execution_status,
...(describeType === 'internal' ? { monitoring: match.monitoring } : {}),
...(describeType === 'internal'
? { monitoring: match.monitoring, snooze_schedule: match.snooze_schedule }
: {}),
});
expect(Date.parse(match.created_at)).to.be.greaterThan(0);
expect(Date.parse(match.updated_at)).to.be.greaterThan(0);
@ -295,7 +296,6 @@ export default function createFindTests({ getService }: FtrProviderContext) {
createdBy: null,
apiKeyOwner: null,
scheduledTaskId: match.scheduledTaskId,
snoozeSchedule: match.snoozeSchedule,
updatedBy: null,
throttle: '1m',
notifyWhen: 'onThrottleInterval',

View file

@ -45,7 +45,6 @@ const getTestUtils = (
params: {},
created_by: null,
scheduled_task_id: response.body.scheduled_task_id,
snooze_schedule: response.body.snooze_schedule,
updated_by: null,
api_key_owner: null,
throttle: '1m',
@ -137,7 +136,6 @@ export default function createGetTests({ getService }: FtrProviderContext) {
params: {},
createdBy: null,
scheduledTaskId: response.body.scheduledTaskId,
snoozeSchedule: response.body.snoozeSchedule,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',

View file

@ -41,7 +41,6 @@ export default function createMuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
supertest: supertestWithoutAuth,
@ -70,7 +69,6 @@ export default function createMuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.expect(200);
expect(updatedAlert.mute_all).to.eql(true);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({

View file

@ -42,7 +42,6 @@ export default function createUnmuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({
@ -76,7 +75,6 @@ export default function createUnmuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.expect(200);
expect(updatedAlert.mute_all).to.eql(false);
expect(updatedAlert.snooze_schedule.length).to.eql(0);
// Ensure AAD isn't broken
await checkAAD({

View file

@ -60,7 +60,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
muted_alert_ids: [],
notify_when: 'onThrottleInterval',
scheduled_task_id: createdAlert.scheduled_task_id,
snooze_schedule: createdAlert.snooze_schedule,
created_at: response.body.created_at,
updated_at: response.body.updated_at,
execution_status: response.body.execution_status,
@ -161,7 +160,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
mutedInstanceIds: [],
notifyWhen: 'onThrottleInterval',
scheduledTaskId: createdAlert.scheduled_task_id,
snoozeSchedule: createdAlert.snooze_schedule,
createdAt: response.body.createdAt,
updatedAt: response.body.updatedAt,
executionStatus: response.body.executionStatus,