-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkibanaAlertingRule.ts
More file actions
332 lines (324 loc) · 15.9 KB
/
kibanaAlertingRule.ts
File metadata and controls
332 lines (324 loc) · 15.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as utilities from "./utilities";
export class KibanaAlertingRule extends pulumi.CustomResource {
/**
* Get an existing KibanaAlertingRule resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: KibanaAlertingRuleState, opts?: pulumi.CustomResourceOptions): KibanaAlertingRule {
return new KibanaAlertingRule(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'elasticstack:index/kibanaAlertingRule:KibanaAlertingRule';
/**
* Returns true if the given object is an instance of KibanaAlertingRule. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is KibanaAlertingRule {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === KibanaAlertingRule.__pulumiType;
}
/**
* An action that runs under defined conditions.
*/
declare public readonly actions: pulumi.Output<outputs.KibanaAlertingRuleAction[] | undefined>;
/**
* A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur.
*/
declare public readonly alertDelay: pulumi.Output<number>;
/**
* The name of the application or feature that owns the rule.
*/
declare public readonly consumer: pulumi.Output<string>;
/**
* Indicates if you want to run the rule on an interval basis.
*/
declare public readonly enabled: pulumi.Output<boolean>;
/**
* The check interval, which specifies how frequently the rule conditions are checked. The interval must be specified in
* seconds, minutes, hours or days.
*/
declare public readonly interval: pulumi.Output<string>;
/**
* Date of the last execution of this rule.
*/
declare public /*out*/ readonly lastExecutionDate: pulumi.Output<string>;
/**
* Status of the last execution of this rule.
*/
declare public /*out*/ readonly lastExecutionStatus: pulumi.Output<string>;
/**
* The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule.
*/
declare public readonly name: pulumi.Output<string>;
/**
* Required until v8.6.0. Deprecated in v8.13.0. Use the `notify_when` property in the action `frequency` object instead.
* Defines 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: This is a rule level property; if you update the rule in
* Kibana, it is automatically changed to use action-specific `notify_when` values.
*/
declare public readonly notifyWhen: pulumi.Output<string>;
/**
* The rule parameters, which differ for each rule type.
*/
declare public readonly params: pulumi.Output<string>;
/**
* The identifier for the rule. Until Kibana version 8.17.0 this should be a UUID v1 or v4, for later versions any format
* can be used. If it is omitted, an ID is randomly generated.
*/
declare public readonly ruleId: pulumi.Output<string>;
/**
* The ID of the rule type that you want to call when the rule is scheduled to run. For more information about the valid
* values, list the rule types using [Get rule types
* API](https://www.elastic.co/guide/en/kibana/master/list-rule-types-api.html) or refer to the [Rule types
* documentation](https://www.elastic.co/guide/en/kibana/master/rule-types.html).
*/
declare public readonly ruleTypeId: pulumi.Output<string>;
/**
* ID of the scheduled task that will execute the alert.
*/
declare public /*out*/ readonly scheduledTaskId: pulumi.Output<string>;
/**
* An identifier for the space. If space_id is not provided, the default space is used.
*/
declare public readonly spaceId: pulumi.Output<string>;
/**
* A list of tag names that are applied to the rule.
*/
declare public readonly tags: pulumi.Output<string[] | undefined>;
/**
* Deprecated in 8.13.0. Defines how often an alert generates repeated actions. This custom action interval must be
* specified in seconds, minutes, hours, or days. For example, 10m or 1h. This property is applicable only if `notify_when`
* is `onThrottleInterval`. NOTE: This is a rule level property; if you update the rule in Kibana, it is automatically
* changed to use action-specific `throttle` values.
*/
declare public readonly throttle: pulumi.Output<string | undefined>;
/**
* Create a KibanaAlertingRule resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: KibanaAlertingRuleArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: KibanaAlertingRuleArgs | KibanaAlertingRuleState, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as KibanaAlertingRuleState | undefined;
resourceInputs["actions"] = state?.actions;
resourceInputs["alertDelay"] = state?.alertDelay;
resourceInputs["consumer"] = state?.consumer;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["interval"] = state?.interval;
resourceInputs["lastExecutionDate"] = state?.lastExecutionDate;
resourceInputs["lastExecutionStatus"] = state?.lastExecutionStatus;
resourceInputs["name"] = state?.name;
resourceInputs["notifyWhen"] = state?.notifyWhen;
resourceInputs["params"] = state?.params;
resourceInputs["ruleId"] = state?.ruleId;
resourceInputs["ruleTypeId"] = state?.ruleTypeId;
resourceInputs["scheduledTaskId"] = state?.scheduledTaskId;
resourceInputs["spaceId"] = state?.spaceId;
resourceInputs["tags"] = state?.tags;
resourceInputs["throttle"] = state?.throttle;
} else {
const args = argsOrState as KibanaAlertingRuleArgs | undefined;
if (args?.consumer === undefined && !opts.urn) {
throw new Error("Missing required property 'consumer'");
}
if (args?.interval === undefined && !opts.urn) {
throw new Error("Missing required property 'interval'");
}
if (args?.params === undefined && !opts.urn) {
throw new Error("Missing required property 'params'");
}
if (args?.ruleTypeId === undefined && !opts.urn) {
throw new Error("Missing required property 'ruleTypeId'");
}
resourceInputs["actions"] = args?.actions;
resourceInputs["alertDelay"] = args?.alertDelay;
resourceInputs["consumer"] = args?.consumer;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["interval"] = args?.interval;
resourceInputs["name"] = args?.name;
resourceInputs["notifyWhen"] = args?.notifyWhen;
resourceInputs["params"] = args?.params;
resourceInputs["ruleId"] = args?.ruleId;
resourceInputs["ruleTypeId"] = args?.ruleTypeId;
resourceInputs["spaceId"] = args?.spaceId;
resourceInputs["tags"] = args?.tags;
resourceInputs["throttle"] = args?.throttle;
resourceInputs["lastExecutionDate"] = undefined /*out*/;
resourceInputs["lastExecutionStatus"] = undefined /*out*/;
resourceInputs["scheduledTaskId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(KibanaAlertingRule.__pulumiType, name, resourceInputs, opts, false /*dependency*/, utilities.getPackage());
}
}
/**
* Input properties used for looking up and filtering KibanaAlertingRule resources.
*/
export interface KibanaAlertingRuleState {
/**
* An action that runs under defined conditions.
*/
actions?: pulumi.Input<pulumi.Input<inputs.KibanaAlertingRuleAction>[]>;
/**
* A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur.
*/
alertDelay?: pulumi.Input<number>;
/**
* The name of the application or feature that owns the rule.
*/
consumer?: pulumi.Input<string>;
/**
* Indicates if you want to run the rule on an interval basis.
*/
enabled?: pulumi.Input<boolean>;
/**
* The check interval, which specifies how frequently the rule conditions are checked. The interval must be specified in
* seconds, minutes, hours or days.
*/
interval?: pulumi.Input<string>;
/**
* Date of the last execution of this rule.
*/
lastExecutionDate?: pulumi.Input<string>;
/**
* Status of the last execution of this rule.
*/
lastExecutionStatus?: pulumi.Input<string>;
/**
* The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule.
*/
name?: pulumi.Input<string>;
/**
* Required until v8.6.0. Deprecated in v8.13.0. Use the `notify_when` property in the action `frequency` object instead.
* Defines 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: This is a rule level property; if you update the rule in
* Kibana, it is automatically changed to use action-specific `notify_when` values.
*/
notifyWhen?: pulumi.Input<string>;
/**
* The rule parameters, which differ for each rule type.
*/
params?: pulumi.Input<string>;
/**
* The identifier for the rule. Until Kibana version 8.17.0 this should be a UUID v1 or v4, for later versions any format
* can be used. If it is omitted, an ID is randomly generated.
*/
ruleId?: pulumi.Input<string>;
/**
* The ID of the rule type that you want to call when the rule is scheduled to run. For more information about the valid
* values, list the rule types using [Get rule types
* API](https://www.elastic.co/guide/en/kibana/master/list-rule-types-api.html) or refer to the [Rule types
* documentation](https://www.elastic.co/guide/en/kibana/master/rule-types.html).
*/
ruleTypeId?: pulumi.Input<string>;
/**
* ID of the scheduled task that will execute the alert.
*/
scheduledTaskId?: pulumi.Input<string>;
/**
* An identifier for the space. If space_id is not provided, the default space is used.
*/
spaceId?: pulumi.Input<string>;
/**
* A list of tag names that are applied to the rule.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Deprecated in 8.13.0. Defines how often an alert generates repeated actions. This custom action interval must be
* specified in seconds, minutes, hours, or days. For example, 10m or 1h. This property is applicable only if `notify_when`
* is `onThrottleInterval`. NOTE: This is a rule level property; if you update the rule in Kibana, it is automatically
* changed to use action-specific `throttle` values.
*/
throttle?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a KibanaAlertingRule resource.
*/
export interface KibanaAlertingRuleArgs {
/**
* An action that runs under defined conditions.
*/
actions?: pulumi.Input<pulumi.Input<inputs.KibanaAlertingRuleAction>[]>;
/**
* A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur.
*/
alertDelay?: pulumi.Input<number>;
/**
* The name of the application or feature that owns the rule.
*/
consumer: pulumi.Input<string>;
/**
* Indicates if you want to run the rule on an interval basis.
*/
enabled?: pulumi.Input<boolean>;
/**
* The check interval, which specifies how frequently the rule conditions are checked. The interval must be specified in
* seconds, minutes, hours or days.
*/
interval: pulumi.Input<string>;
/**
* The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule.
*/
name?: pulumi.Input<string>;
/**
* Required until v8.6.0. Deprecated in v8.13.0. Use the `notify_when` property in the action `frequency` object instead.
* Defines 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: This is a rule level property; if you update the rule in
* Kibana, it is automatically changed to use action-specific `notify_when` values.
*/
notifyWhen?: pulumi.Input<string>;
/**
* The rule parameters, which differ for each rule type.
*/
params: pulumi.Input<string>;
/**
* The identifier for the rule. Until Kibana version 8.17.0 this should be a UUID v1 or v4, for later versions any format
* can be used. If it is omitted, an ID is randomly generated.
*/
ruleId?: pulumi.Input<string>;
/**
* The ID of the rule type that you want to call when the rule is scheduled to run. For more information about the valid
* values, list the rule types using [Get rule types
* API](https://www.elastic.co/guide/en/kibana/master/list-rule-types-api.html) or refer to the [Rule types
* documentation](https://www.elastic.co/guide/en/kibana/master/rule-types.html).
*/
ruleTypeId: pulumi.Input<string>;
/**
* An identifier for the space. If space_id is not provided, the default space is used.
*/
spaceId?: pulumi.Input<string>;
/**
* A list of tag names that are applied to the rule.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Deprecated in 8.13.0. Defines how often an alert generates repeated actions. This custom action interval must be
* specified in seconds, minutes, hours, or days. For example, 10m or 1h. This property is applicable only if `notify_when`
* is `onThrottleInterval`. NOTE: This is a rule level property; if you update the rule in Kibana, it is automatically
* changed to use action-specific `throttle` values.
*/
throttle?: pulumi.Input<string>;
}