/
scheduledQueryRulesAlert.go
234 lines (221 loc) · 11.4 KB
/
scheduledQueryRulesAlert.go
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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// nolint: lll
package monitoring
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages an AlertingAction Scheduled Query Rules resource within Azure Monitor.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/monitor_scheduled_query_rules_alert.html.markdown.
type ScheduledQueryRulesAlert struct {
pulumi.CustomResourceState
// An `action` block as defined below.
Action ScheduledQueryRulesAlertActionOutput `pulumi:"action"`
// List of Resource IDs referred into query.
AuthorizedResourceIds pulumi.StringArrayOutput `pulumi:"authorizedResourceIds"`
// The resource URI over which log search query is to be run.
DataSourceId pulumi.StringOutput `pulumi:"dataSourceId"`
// The description of the scheduled query rule.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Whether this scheduled query rule is enabled. Default is `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
Frequency pulumi.IntOutput `pulumi:"frequency"`
Location pulumi.StringOutput `pulumi:"location"`
// The name of the scheduled query rule. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// Log search query.
Query pulumi.StringOutput `pulumi:"query"`
QueryType pulumi.StringPtrOutput `pulumi:"queryType"`
// The name of the resource group in which to create the scheduled query rule instance.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
Severity pulumi.IntPtrOutput `pulumi:"severity"`
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
Throttling pulumi.IntPtrOutput `pulumi:"throttling"`
// Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
TimeWindow pulumi.IntOutput `pulumi:"timeWindow"`
// The condition that results in the alert rule being run.
Trigger ScheduledQueryRulesAlertTriggerOutput `pulumi:"trigger"`
}
// NewScheduledQueryRulesAlert registers a new resource with the given unique name, arguments, and options.
func NewScheduledQueryRulesAlert(ctx *pulumi.Context,
name string, args *ScheduledQueryRulesAlertArgs, opts ...pulumi.ResourceOption) (*ScheduledQueryRulesAlert, error) {
if args == nil || args.Action == nil {
return nil, errors.New("missing required argument 'Action'")
}
if args == nil || args.DataSourceId == nil {
return nil, errors.New("missing required argument 'DataSourceId'")
}
if args == nil || args.Frequency == nil {
return nil, errors.New("missing required argument 'Frequency'")
}
if args == nil || args.Query == nil {
return nil, errors.New("missing required argument 'Query'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil || args.TimeWindow == nil {
return nil, errors.New("missing required argument 'TimeWindow'")
}
if args == nil || args.Trigger == nil {
return nil, errors.New("missing required argument 'Trigger'")
}
if args == nil {
args = &ScheduledQueryRulesAlertArgs{}
}
var resource ScheduledQueryRulesAlert
err := ctx.RegisterResource("azure:monitoring/scheduledQueryRulesAlert:ScheduledQueryRulesAlert", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetScheduledQueryRulesAlert gets an existing ScheduledQueryRulesAlert resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetScheduledQueryRulesAlert(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ScheduledQueryRulesAlertState, opts ...pulumi.ResourceOption) (*ScheduledQueryRulesAlert, error) {
var resource ScheduledQueryRulesAlert
err := ctx.ReadResource("azure:monitoring/scheduledQueryRulesAlert:ScheduledQueryRulesAlert", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ScheduledQueryRulesAlert resources.
type scheduledQueryRulesAlertState struct {
// An `action` block as defined below.
Action *ScheduledQueryRulesAlertAction `pulumi:"action"`
// List of Resource IDs referred into query.
AuthorizedResourceIds []string `pulumi:"authorizedResourceIds"`
// The resource URI over which log search query is to be run.
DataSourceId *string `pulumi:"dataSourceId"`
// The description of the scheduled query rule.
Description *string `pulumi:"description"`
// Whether this scheduled query rule is enabled. Default is `true`.
Enabled *bool `pulumi:"enabled"`
// Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
Frequency *int `pulumi:"frequency"`
Location *string `pulumi:"location"`
// The name of the scheduled query rule. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Log search query.
Query *string `pulumi:"query"`
QueryType *string `pulumi:"queryType"`
// The name of the resource group in which to create the scheduled query rule instance.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
Severity *int `pulumi:"severity"`
Tags map[string]string `pulumi:"tags"`
// Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
Throttling *int `pulumi:"throttling"`
// Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
TimeWindow *int `pulumi:"timeWindow"`
// The condition that results in the alert rule being run.
Trigger *ScheduledQueryRulesAlertTrigger `pulumi:"trigger"`
}
type ScheduledQueryRulesAlertState struct {
// An `action` block as defined below.
Action ScheduledQueryRulesAlertActionPtrInput
// List of Resource IDs referred into query.
AuthorizedResourceIds pulumi.StringArrayInput
// The resource URI over which log search query is to be run.
DataSourceId pulumi.StringPtrInput
// The description of the scheduled query rule.
Description pulumi.StringPtrInput
// Whether this scheduled query rule is enabled. Default is `true`.
Enabled pulumi.BoolPtrInput
// Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
Frequency pulumi.IntPtrInput
Location pulumi.StringPtrInput
// The name of the scheduled query rule. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Log search query.
Query pulumi.StringPtrInput
QueryType pulumi.StringPtrInput
// The name of the resource group in which to create the scheduled query rule instance.
ResourceGroupName pulumi.StringPtrInput
// Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
Severity pulumi.IntPtrInput
Tags pulumi.StringMapInput
// Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
Throttling pulumi.IntPtrInput
// Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
TimeWindow pulumi.IntPtrInput
// The condition that results in the alert rule being run.
Trigger ScheduledQueryRulesAlertTriggerPtrInput
}
func (ScheduledQueryRulesAlertState) ElementType() reflect.Type {
return reflect.TypeOf((*scheduledQueryRulesAlertState)(nil)).Elem()
}
type scheduledQueryRulesAlertArgs struct {
// An `action` block as defined below.
Action ScheduledQueryRulesAlertAction `pulumi:"action"`
// List of Resource IDs referred into query.
AuthorizedResourceIds []string `pulumi:"authorizedResourceIds"`
// The resource URI over which log search query is to be run.
DataSourceId string `pulumi:"dataSourceId"`
// The description of the scheduled query rule.
Description *string `pulumi:"description"`
// Whether this scheduled query rule is enabled. Default is `true`.
Enabled *bool `pulumi:"enabled"`
// Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
Frequency int `pulumi:"frequency"`
Location *string `pulumi:"location"`
// The name of the scheduled query rule. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Log search query.
Query string `pulumi:"query"`
QueryType *string `pulumi:"queryType"`
// The name of the resource group in which to create the scheduled query rule instance.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
Severity *int `pulumi:"severity"`
Tags map[string]string `pulumi:"tags"`
// Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
Throttling *int `pulumi:"throttling"`
// Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
TimeWindow int `pulumi:"timeWindow"`
// The condition that results in the alert rule being run.
Trigger ScheduledQueryRulesAlertTrigger `pulumi:"trigger"`
}
// The set of arguments for constructing a ScheduledQueryRulesAlert resource.
type ScheduledQueryRulesAlertArgs struct {
// An `action` block as defined below.
Action ScheduledQueryRulesAlertActionInput
// List of Resource IDs referred into query.
AuthorizedResourceIds pulumi.StringArrayInput
// The resource URI over which log search query is to be run.
DataSourceId pulumi.StringInput
// The description of the scheduled query rule.
Description pulumi.StringPtrInput
// Whether this scheduled query rule is enabled. Default is `true`.
Enabled pulumi.BoolPtrInput
// Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
Frequency pulumi.IntInput
Location pulumi.StringPtrInput
// The name of the scheduled query rule. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Log search query.
Query pulumi.StringInput
QueryType pulumi.StringPtrInput
// The name of the resource group in which to create the scheduled query rule instance.
ResourceGroupName pulumi.StringInput
// Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
Severity pulumi.IntPtrInput
Tags pulumi.StringMapInput
// Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
Throttling pulumi.IntPtrInput
// Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
TimeWindow pulumi.IntInput
// The condition that results in the alert rule being run.
Trigger ScheduledQueryRulesAlertTriggerInput
}
func (ScheduledQueryRulesAlertArgs) ElementType() reflect.Type {
return reflect.TypeOf((*scheduledQueryRulesAlertArgs)(nil)).Elem()
}