Skip to content

Commit

Permalink
Merge branch '8.9' into backport/8.9/pr-160526
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Jun 26, 2023
2 parents dda21fe + 4365d08 commit a19eef7
Show file tree
Hide file tree
Showing 53 changed files with 1,450 additions and 586 deletions.
108 changes: 54 additions & 54 deletions docs/api-generated/rules/rule-apis-passthru.asciidoc

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions x-pack/plugins/actions/server/lib/action_executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ test('successfully executes when http_request source is specified', async () =>
},
params: { foo: true },
logger: loggerMock,
source: {
source: expect.anything(),
type: 'HTTP_REQUEST',
},
});

expect(loggerMock.debug).toBeCalledWith('executing action test:1: 1');
Expand Down Expand Up @@ -435,6 +439,13 @@ test('successfully executes when saved_object source is specified', async () =>
},
params: { foo: true },
logger: loggerMock,
source: {
source: {
id: '573891ae-8c48-49cb-a197-0cd5ec34a88b',
type: 'alert',
},
type: 'SAVED_OBJECT',
},
});

expect(loggerMock.debug).toBeCalledWith('executing action test:1: 1');
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/actions/server/lib/action_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export class ActionExecutor {
taskInfo,
configurationUtilities,
logger,
source,
});
} catch (err) {
if (err.reason === ActionExecutionErrorReason.Validation) {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/actions/server/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export {
isHttpRequestExecutionSource,
asNotificationExecutionSource,
isNotificationExecutionSource,
ActionExecutionSourceType,
} from './action_execution_source';
export { validateEmptyStrings } from './validate_empty_strings';
export { parseDate } from './parse_date';
6 changes: 6 additions & 0 deletions x-pack/plugins/actions/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export type ActionTypeSecrets = Record<string, unknown>;
export type ActionTypeParams = Record<string, unknown>;
export type ConnectorTokenClientContract = PublicMethodsOf<ConnectorTokenClient>;

import type { ActionExecutionSource } from './lib';
export type { ActionExecutionSource } from './lib';

export { ActionExecutionSourceType } from './lib';

export interface Services {
savedObjectsClient: SavedObjectsClientContract;
scopedClusterClient: ElasticsearchClient;
Expand Down Expand Up @@ -65,6 +70,7 @@ export interface ActionTypeExecutorOptions<Config, Secrets, Params> {
isEphemeral?: boolean;
taskInfo?: TaskInfo;
configurationUtilities: ActionsConfigurationUtilities;
source?: ActionExecutionSource<unknown>;
}

export interface ActionResult<Config extends ActionTypeConfig = ActionTypeConfig> {
Expand Down
29 changes: 21 additions & 8 deletions x-pack/plugins/alerting/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@
"schemas": {
"notify_when": {
"type": "string",
"description": "Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.\n",
"description": "Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. NOTE: You cannot specify `notify_when` at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.\n",
"enum": [
"onActionGroupChange",
"onActiveAlert",
Expand All @@ -2542,7 +2542,7 @@
},
"throttle": {
"type": "string",
"description": "The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days.",
"description": "The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.\n",
"nullable": true,
"default": null,
"example": "10m"
Expand Down Expand Up @@ -6139,7 +6139,9 @@
"example": "2022-12-06T00:14:43.818Z"
},
"notify_when": {
"$ref": "#/components/schemas/notify_when"
"type": "string",
"description": "Indicates how often alerts generate actions.",
"nullable": true
},
"params": {
"type": "object",
Expand Down Expand Up @@ -6233,7 +6235,7 @@
},
"update_rule_request": {
"title": "Update rule request",
"description": "The update rule API request body varies depending on the type of rule and actions.",
"description": "The update rule API request body varies depending on the type of rule and actions.\n",
"type": "object",
"required": [
"name",
Expand Down Expand Up @@ -6387,7 +6389,7 @@
"value": {
"actions": [
{
"id": "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2",
"id": "48de3460-f401-11ed-9f8e-399c75a2deeb",
"frequency": {
"notify_when": "onActionGroupChange",
"summary": false
Expand Down Expand Up @@ -6435,6 +6437,7 @@
"group": "threshold met",
"id": "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2",
"uuid": "07aef2a0-9eed-4ef9-94ec-39ba58eb609d",
"connector_type_id": ".server-log",
"frequency": {
"notify_when": "onActionGroupChange",
"summary": false,
Expand All @@ -6460,7 +6463,7 @@
"muted_alert_ids": [],
"mute_all": false,
"name": "my rule",
"notify_when": "onActionGroupChange",
"notify_when": null,
"params": {
"aggType": "avg",
"termSize": 6,
Expand Down Expand Up @@ -6531,7 +6534,7 @@
"created_at": "2022-12-13T22:33:41.163Z",
"updated_at": "2022-12-13T22:33:41.163Z",
"api_key_owner": "elastic",
"notify_when": "onActionGroupChange",
"notify_when": null,
"muted_alert_ids": [],
"mute_all": false,
"scheduled_task_id": "31697a40-7b36-11ed-aa79-f742c05329b2",
Expand All @@ -6549,6 +6552,12 @@
"level": "info",
"message": "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}",
"connector_type_id": ".server-log"
},
"connector_type_id": ".server-log",
"frequency": {
"throttle": null,
"summary": false,
"notify_when": "onActionGroupChange"
}
}
],
Expand Down Expand Up @@ -6729,7 +6738,6 @@
"created_at": "2022-12-05T23:40:33.132Z",
"updated_at": "2022-12-05T23:40:33.132Z",
"api_key_owner": "elastic",
"notify_when": "onActionGroupChange",
"mute_all": false,
"muted_alert_ids": [],
"scheduled_task_id": "3583a470-74f6-11ed-9801-35303b735aef",
Expand All @@ -6747,6 +6755,11 @@
"level": "info",
"message": "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}}",
"connector_type_id": ".server-log"
},
"frequency": {
"summary": false,
"notify_when": "onActionGroupChange",
"throttle": null
}
}
],
Expand Down
29 changes: 21 additions & 8 deletions x-pack/plugins/alerting/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1596,15 +1596,16 @@ components:
notify_when:
type: string
description: |
Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.
Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. NOTE: You cannot specify `notify_when` at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.
enum:
- onActionGroupChange
- onActiveAlert
- onThrottleInterval
example: onActiveAlert
throttle:
type: string
description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days.
description: |
The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.
nullable: true
default: null
example: 10m
Expand Down Expand Up @@ -4167,7 +4168,9 @@ components:
nullable: true
example: '2022-12-06T00:14:43.818Z'
notify_when:
$ref: '#/components/schemas/notify_when'
type: string
description: Indicates how often alerts generate actions.
nullable: true
params:
type: object
description: The parameters for the rule.
Expand Down Expand Up @@ -4235,7 +4238,8 @@ components:
- 404
update_rule_request:
title: Update rule request
description: The update rule API request body varies depending on the type of rule and actions.
description: |
The update rule API request body varies depending on the type of rule and actions.
type: object
required:
- name
Expand Down Expand Up @@ -4348,7 +4352,7 @@ components:
summary: Create an index threshold rule.
value:
actions:
- id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2
- id: 48de3460-f401-11ed-9f8e-399c75a2deeb
frequency:
notify_when: onActionGroupChange
summary: false
Expand Down Expand Up @@ -4389,6 +4393,7 @@ components:
- group: threshold met
id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2
uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d
connector_type_id: .server-log
frequency:
notify_when: onActionGroupChange
summary: false
Expand All @@ -4414,7 +4419,7 @@ components:
muted_alert_ids: []
mute_all: false
name: my rule
notify_when: onActionGroupChange
notify_when: null
params:
aggType: avg
termSize: 6
Expand Down Expand Up @@ -4473,7 +4478,7 @@ components:
created_at: '2022-12-13T22:33:41.163Z'
updated_at: '2022-12-13T22:33:41.163Z'
api_key_owner: elastic
notify_when: onActionGroupChange
notify_when: null
muted_alert_ids: []
mute_all: false
scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2
Expand All @@ -4494,6 +4499,11 @@ components:
- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}
- Timestamp: {{context.date}
connector_type_id: .server-log
connector_type_id: .server-log
frequency:
throttle: null
summary: false
notify_when: onActionGroupChange
last_run:
alerts_count:
new: 0
Expand Down Expand Up @@ -4646,7 +4656,6 @@ components:
created_at: '2022-12-05T23:40:33.132Z'
updated_at: '2022-12-05T23:40:33.132Z'
api_key_owner: elastic
notify_when: onActionGroupChange
mute_all: false
muted_alert_ids: []
scheduled_task_id: 3583a470-74f6-11ed-9801-35303b735aef
Expand All @@ -4667,6 +4676,10 @@ components:
- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}
- Timestamp: {{context.date}}
connector_type_id: .server-log
frequency:
summary: false
notify_when: onActionGroupChange
throttle: null
last_run:
alerts_count:
new: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Create an index threshold rule.
value:
actions:
- id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2
- id: 48de3460-f401-11ed-9f8e-399c75a2deeb
frequency:
notify_when: onActionGroupChange
summary: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ value:
- group: threshold met
id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2
uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d
connector_type_id: .server-log
frequency:
notify_when: onActionGroupChange
summary: false
Expand All @@ -24,7 +25,7 @@ value:
muted_alert_ids: []
mute_all: false
name: my rule
notify_when: onActionGroupChange
notify_when: null
params:
aggType: avg
termSize: 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ value:
created_at: '2022-12-05T23:40:33.132Z'
updated_at: '2022-12-05T23:40:33.132Z'
api_key_owner: elastic
notify_when: onActionGroupChange
mute_all: false
muted_alert_ids: []
scheduled_task_id: 3583a470-74f6-11ed-9801-35303b735aef
Expand All @@ -50,6 +49,10 @@ value:
level: info
message: "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}}"
connector_type_id: .server-log
frequency:
summary: false
notify_when: onActionGroupChange
throttle: null
last_run:
alerts_count:
new: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ value:
created_at: '2022-12-13T22:33:41.163Z'
updated_at: '2022-12-13T22:33:41.163Z'
api_key_owner: elastic
notify_when: onActionGroupChange
notify_when: null
muted_alert_ids: []
mute_all: false
scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2
Expand All @@ -46,6 +46,11 @@ value:
level: info
message: "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}"
connector_type_id: .server-log
connector_type_id: .server-log
frequency:
throttle: null
summary: false
notify_when: onActionGroupChange
last_run:
alerts_count:
new: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ oneOf:
- $ref: 'create_uptime_monitor_status_rule_request.yaml'
discriminator:
propertyName: rule_type_id


Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
type: string
description: >
Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.
Indicates how often alerts generate actions.
Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.
NOTE: You cannot specify `notify_when` at both the rule and action level. The recommended method is to set it for each action.
If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.
enum:
- onActionGroupChange
- onActiveAlert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ properties:
nullable: true
example: '2022-12-06T00:14:43.818Z'
notify_when:
$ref: 'notify_when.yaml'
type: string
description: Indicates how often alerts generate actions.
nullable: true
params:
type: object
description: The parameters for the rule.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
type: string
description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days.
description: >
The throttle interval, which defines how often an alert generates repeated actions.
It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`.
NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action.
If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values.
nullable: true
default: null
example: 10m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Update rule request
description: >-
description: >
The update rule API request body varies depending on the type of rule and actions.
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ post:
$ref: '../components/schemas/404_response.yaml'
servers:
- url: https://localhost:5601

servers:
- url: https://localhost:5601

0 comments on commit a19eef7

Please sign in to comment.