generated from pulumi/pulumi-tf-provider-boilerplate
/
uptimeCheck.go
417 lines (357 loc) · 18 KB
/
uptimeCheck.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
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package statuscake
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type UptimeCheck struct {
pulumi.CustomResourceState
// Number of seconds between checks
CheckInterval pulumi.IntOutput `pulumi:"checkInterval"`
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation pulumi.IntPtrOutput `pulumi:"confirmation"`
// List of contact group IDs
ContactGroups pulumi.StringArrayOutput `pulumi:"contactGroups"`
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
DnsCheck UptimeCheckDnsCheckPtrOutput `pulumi:"dnsCheck"`
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
HttpCheck UptimeCheckHttpCheckPtrOutput `pulumi:"httpCheck"`
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
IcmpCheck UptimeCheckIcmpCheckPtrOutput `pulumi:"icmpCheck"`
// List of assigned monitoring locations on which to run checks
Locations UptimeCheckLocationArrayOutput `pulumi:"locations"`
// Monitored resource configuration block. The describes server under test
MonitoredResource UptimeCheckMonitoredResourceOutput `pulumi:"monitoredResource"`
// Name of the check
Name pulumi.StringOutput `pulumi:"name"`
// Whether the check should be run
Paused pulumi.BoolPtrOutput `pulumi:"paused"`
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
Regions pulumi.StringArrayOutput `pulumi:"regions"`
// List of tags
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
TcpCheck UptimeCheckTcpCheckPtrOutput `pulumi:"tcpCheck"`
// The number of minutes to wait before sending an alert
TriggerRate pulumi.IntPtrOutput `pulumi:"triggerRate"`
}
// NewUptimeCheck registers a new resource with the given unique name, arguments, and options.
func NewUptimeCheck(ctx *pulumi.Context,
name string, args *UptimeCheckArgs, opts ...pulumi.ResourceOption) (*UptimeCheck, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CheckInterval == nil {
return nil, errors.New("invalid value for required argument 'CheckInterval'")
}
if args.MonitoredResource == nil {
return nil, errors.New("invalid value for required argument 'MonitoredResource'")
}
opts = pkgResourceDefaultOpts(opts)
var resource UptimeCheck
err := ctx.RegisterResource("statuscake:index/uptimeCheck:UptimeCheck", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUptimeCheck gets an existing UptimeCheck 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 GetUptimeCheck(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UptimeCheckState, opts ...pulumi.ResourceOption) (*UptimeCheck, error) {
var resource UptimeCheck
err := ctx.ReadResource("statuscake:index/uptimeCheck:UptimeCheck", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UptimeCheck resources.
type uptimeCheckState struct {
// Number of seconds between checks
CheckInterval *int `pulumi:"checkInterval"`
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation *int `pulumi:"confirmation"`
// List of contact group IDs
ContactGroups []string `pulumi:"contactGroups"`
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
DnsCheck *UptimeCheckDnsCheck `pulumi:"dnsCheck"`
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
HttpCheck *UptimeCheckHttpCheck `pulumi:"httpCheck"`
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
IcmpCheck *UptimeCheckIcmpCheck `pulumi:"icmpCheck"`
// List of assigned monitoring locations on which to run checks
Locations []UptimeCheckLocation `pulumi:"locations"`
// Monitored resource configuration block. The describes server under test
MonitoredResource *UptimeCheckMonitoredResource `pulumi:"monitoredResource"`
// Name of the check
Name *string `pulumi:"name"`
// Whether the check should be run
Paused *bool `pulumi:"paused"`
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
Regions []string `pulumi:"regions"`
// List of tags
Tags []string `pulumi:"tags"`
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
TcpCheck *UptimeCheckTcpCheck `pulumi:"tcpCheck"`
// The number of minutes to wait before sending an alert
TriggerRate *int `pulumi:"triggerRate"`
}
type UptimeCheckState struct {
// Number of seconds between checks
CheckInterval pulumi.IntPtrInput
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation pulumi.IntPtrInput
// List of contact group IDs
ContactGroups pulumi.StringArrayInput
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
DnsCheck UptimeCheckDnsCheckPtrInput
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
HttpCheck UptimeCheckHttpCheckPtrInput
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
IcmpCheck UptimeCheckIcmpCheckPtrInput
// List of assigned monitoring locations on which to run checks
Locations UptimeCheckLocationArrayInput
// Monitored resource configuration block. The describes server under test
MonitoredResource UptimeCheckMonitoredResourcePtrInput
// Name of the check
Name pulumi.StringPtrInput
// Whether the check should be run
Paused pulumi.BoolPtrInput
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
Regions pulumi.StringArrayInput
// List of tags
Tags pulumi.StringArrayInput
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
TcpCheck UptimeCheckTcpCheckPtrInput
// The number of minutes to wait before sending an alert
TriggerRate pulumi.IntPtrInput
}
func (UptimeCheckState) ElementType() reflect.Type {
return reflect.TypeOf((*uptimeCheckState)(nil)).Elem()
}
type uptimeCheckArgs struct {
// Number of seconds between checks
CheckInterval int `pulumi:"checkInterval"`
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation *int `pulumi:"confirmation"`
// List of contact group IDs
ContactGroups []string `pulumi:"contactGroups"`
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
DnsCheck *UptimeCheckDnsCheck `pulumi:"dnsCheck"`
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
HttpCheck *UptimeCheckHttpCheck `pulumi:"httpCheck"`
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
IcmpCheck *UptimeCheckIcmpCheck `pulumi:"icmpCheck"`
// Monitored resource configuration block. The describes server under test
MonitoredResource UptimeCheckMonitoredResource `pulumi:"monitoredResource"`
// Name of the check
Name *string `pulumi:"name"`
// Whether the check should be run
Paused *bool `pulumi:"paused"`
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
Regions []string `pulumi:"regions"`
// List of tags
Tags []string `pulumi:"tags"`
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
TcpCheck *UptimeCheckTcpCheck `pulumi:"tcpCheck"`
// The number of minutes to wait before sending an alert
TriggerRate *int `pulumi:"triggerRate"`
}
// The set of arguments for constructing a UptimeCheck resource.
type UptimeCheckArgs struct {
// Number of seconds between checks
CheckInterval pulumi.IntInput
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation pulumi.IntPtrInput
// List of contact group IDs
ContactGroups pulumi.StringArrayInput
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
DnsCheck UptimeCheckDnsCheckPtrInput
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
HttpCheck UptimeCheckHttpCheckPtrInput
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
IcmpCheck UptimeCheckIcmpCheckPtrInput
// Monitored resource configuration block. The describes server under test
MonitoredResource UptimeCheckMonitoredResourceInput
// Name of the check
Name pulumi.StringPtrInput
// Whether the check should be run
Paused pulumi.BoolPtrInput
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
Regions pulumi.StringArrayInput
// List of tags
Tags pulumi.StringArrayInput
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
TcpCheck UptimeCheckTcpCheckPtrInput
// The number of minutes to wait before sending an alert
TriggerRate pulumi.IntPtrInput
}
func (UptimeCheckArgs) ElementType() reflect.Type {
return reflect.TypeOf((*uptimeCheckArgs)(nil)).Elem()
}
type UptimeCheckInput interface {
pulumi.Input
ToUptimeCheckOutput() UptimeCheckOutput
ToUptimeCheckOutputWithContext(ctx context.Context) UptimeCheckOutput
}
func (*UptimeCheck) ElementType() reflect.Type {
return reflect.TypeOf((**UptimeCheck)(nil)).Elem()
}
func (i *UptimeCheck) ToUptimeCheckOutput() UptimeCheckOutput {
return i.ToUptimeCheckOutputWithContext(context.Background())
}
func (i *UptimeCheck) ToUptimeCheckOutputWithContext(ctx context.Context) UptimeCheckOutput {
return pulumi.ToOutputWithContext(ctx, i).(UptimeCheckOutput)
}
// UptimeCheckArrayInput is an input type that accepts UptimeCheckArray and UptimeCheckArrayOutput values.
// You can construct a concrete instance of `UptimeCheckArrayInput` via:
//
// UptimeCheckArray{ UptimeCheckArgs{...} }
type UptimeCheckArrayInput interface {
pulumi.Input
ToUptimeCheckArrayOutput() UptimeCheckArrayOutput
ToUptimeCheckArrayOutputWithContext(context.Context) UptimeCheckArrayOutput
}
type UptimeCheckArray []UptimeCheckInput
func (UptimeCheckArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UptimeCheck)(nil)).Elem()
}
func (i UptimeCheckArray) ToUptimeCheckArrayOutput() UptimeCheckArrayOutput {
return i.ToUptimeCheckArrayOutputWithContext(context.Background())
}
func (i UptimeCheckArray) ToUptimeCheckArrayOutputWithContext(ctx context.Context) UptimeCheckArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UptimeCheckArrayOutput)
}
// UptimeCheckMapInput is an input type that accepts UptimeCheckMap and UptimeCheckMapOutput values.
// You can construct a concrete instance of `UptimeCheckMapInput` via:
//
// UptimeCheckMap{ "key": UptimeCheckArgs{...} }
type UptimeCheckMapInput interface {
pulumi.Input
ToUptimeCheckMapOutput() UptimeCheckMapOutput
ToUptimeCheckMapOutputWithContext(context.Context) UptimeCheckMapOutput
}
type UptimeCheckMap map[string]UptimeCheckInput
func (UptimeCheckMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UptimeCheck)(nil)).Elem()
}
func (i UptimeCheckMap) ToUptimeCheckMapOutput() UptimeCheckMapOutput {
return i.ToUptimeCheckMapOutputWithContext(context.Background())
}
func (i UptimeCheckMap) ToUptimeCheckMapOutputWithContext(ctx context.Context) UptimeCheckMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UptimeCheckMapOutput)
}
type UptimeCheckOutput struct{ *pulumi.OutputState }
func (UptimeCheckOutput) ElementType() reflect.Type {
return reflect.TypeOf((**UptimeCheck)(nil)).Elem()
}
func (o UptimeCheckOutput) ToUptimeCheckOutput() UptimeCheckOutput {
return o
}
func (o UptimeCheckOutput) ToUptimeCheckOutputWithContext(ctx context.Context) UptimeCheckOutput {
return o
}
// Number of seconds between checks
func (o UptimeCheckOutput) CheckInterval() pulumi.IntOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.IntOutput { return v.CheckInterval }).(pulumi.IntOutput)
}
// Number of confirmation servers to confirm downtime before an alert is triggered
func (o UptimeCheckOutput) Confirmation() pulumi.IntPtrOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.IntPtrOutput { return v.Confirmation }).(pulumi.IntPtrOutput)
}
// List of contact group IDs
func (o UptimeCheckOutput) ContactGroups() pulumi.StringArrayOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.StringArrayOutput { return v.ContactGroups }).(pulumi.StringArrayOutput)
}
// DNS check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
func (o UptimeCheckOutput) DnsCheck() UptimeCheckDnsCheckPtrOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckDnsCheckPtrOutput { return v.DnsCheck }).(UptimeCheckDnsCheckPtrOutput)
}
// HTTP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
func (o UptimeCheckOutput) HttpCheck() UptimeCheckHttpCheckPtrOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckHttpCheckPtrOutput { return v.HttpCheck }).(UptimeCheckHttpCheckPtrOutput)
}
// ICMP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
func (o UptimeCheckOutput) IcmpCheck() UptimeCheckIcmpCheckPtrOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckIcmpCheckPtrOutput { return v.IcmpCheck }).(UptimeCheckIcmpCheckPtrOutput)
}
// List of assigned monitoring locations on which to run checks
func (o UptimeCheckOutput) Locations() UptimeCheckLocationArrayOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckLocationArrayOutput { return v.Locations }).(UptimeCheckLocationArrayOutput)
}
// Monitored resource configuration block. The describes server under test
func (o UptimeCheckOutput) MonitoredResource() UptimeCheckMonitoredResourceOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckMonitoredResourceOutput { return v.MonitoredResource }).(UptimeCheckMonitoredResourceOutput)
}
// Name of the check
func (o UptimeCheckOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Whether the check should be run
func (o UptimeCheckOutput) Paused() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.BoolPtrOutput { return v.Paused }).(pulumi.BoolPtrOutput)
}
// List of regions on which to run checks. The values required for this parameter can be retrieved from the `GET
// /v1/uptime-locations` endpoint
func (o UptimeCheckOutput) Regions() pulumi.StringArrayOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.StringArrayOutput { return v.Regions }).(pulumi.StringArrayOutput)
}
// List of tags
func (o UptimeCheckOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.StringArrayOutput { return v.Tags }).(pulumi.StringArrayOutput)
}
// TCP check configuration block. Only one of `dns_check`, `http_check`, `icmp_check`, and `tcp_check` may be specified
func (o UptimeCheckOutput) TcpCheck() UptimeCheckTcpCheckPtrOutput {
return o.ApplyT(func(v *UptimeCheck) UptimeCheckTcpCheckPtrOutput { return v.TcpCheck }).(UptimeCheckTcpCheckPtrOutput)
}
// The number of minutes to wait before sending an alert
func (o UptimeCheckOutput) TriggerRate() pulumi.IntPtrOutput {
return o.ApplyT(func(v *UptimeCheck) pulumi.IntPtrOutput { return v.TriggerRate }).(pulumi.IntPtrOutput)
}
type UptimeCheckArrayOutput struct{ *pulumi.OutputState }
func (UptimeCheckArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UptimeCheck)(nil)).Elem()
}
func (o UptimeCheckArrayOutput) ToUptimeCheckArrayOutput() UptimeCheckArrayOutput {
return o
}
func (o UptimeCheckArrayOutput) ToUptimeCheckArrayOutputWithContext(ctx context.Context) UptimeCheckArrayOutput {
return o
}
func (o UptimeCheckArrayOutput) Index(i pulumi.IntInput) UptimeCheckOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UptimeCheck {
return vs[0].([]*UptimeCheck)[vs[1].(int)]
}).(UptimeCheckOutput)
}
type UptimeCheckMapOutput struct{ *pulumi.OutputState }
func (UptimeCheckMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UptimeCheck)(nil)).Elem()
}
func (o UptimeCheckMapOutput) ToUptimeCheckMapOutput() UptimeCheckMapOutput {
return o
}
func (o UptimeCheckMapOutput) ToUptimeCheckMapOutputWithContext(ctx context.Context) UptimeCheckMapOutput {
return o
}
func (o UptimeCheckMapOutput) MapIndex(k pulumi.StringInput) UptimeCheckOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UptimeCheck {
return vs[0].(map[string]*UptimeCheck)[vs[1].(string)]
}).(UptimeCheckOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UptimeCheckInput)(nil)).Elem(), &UptimeCheck{})
pulumi.RegisterInputType(reflect.TypeOf((*UptimeCheckArrayInput)(nil)).Elem(), UptimeCheckArray{})
pulumi.RegisterInputType(reflect.TypeOf((*UptimeCheckMapInput)(nil)).Elem(), UptimeCheckMap{})
pulumi.RegisterOutputType(UptimeCheckOutput{})
pulumi.RegisterOutputType(UptimeCheckArrayOutput{})
pulumi.RegisterOutputType(UptimeCheckMapOutput{})
}