-
Notifications
You must be signed in to change notification settings - Fork 6
/
monitor.ts
313 lines (304 loc) · 10.8 KB
/
monitor.ts
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
// *** 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! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "../utilities";
/**
* Use this resource to create, update, and delete a synthetics monitor in New Relic.
*
* ## Example Usage
*
* ##### Type: `SIMPLE`
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.synthetics.Monitor("foo", {
* frequency: 5,
* locations: [
* "AWS_US_EAST_1",
* "AWS_US_EAST_2",
* ],
* status: "ENABLED",
* type: "SIMPLE",
* uri: "https://example.com", // Required for type "SIMPLE" and "BROWSER"
* validationString: "add example validation check here", // Optional for type "SIMPLE" and "BROWSER"
* verifySsl: true, // Optional for type "SIMPLE" and "BROWSER"
* });
* ```
* See additional examples.
*
* ## Additional Examples
*
* Type: `BROWSER`
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.synthetics.Monitor("foo", {
* bypassHeadRequest: true, // Note: optional for type "BROWSER" only
* frequency: 5,
* locations: ["AWS_US_EAST_1"],
* status: "ENABLED",
* treatRedirectAsFailure: true, // Note: optional for type "BROWSER" only
* type: "BROWSER",
* uri: "https://example.com", // required for type "SIMPLE" and "BROWSER"
* validationString: "add example validation check here", // optional for type "SIMPLE" and "BROWSER"
* verifySsl: true, // optional for type "SIMPLE" and "BROWSER"
* });
* ```
*
* Type: `SCRIPT_BROWSER`
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.synthetics.Monitor("foo", {
* frequency: 5,
* locations: ["AWS_US_EAST_1"],
* status: "ENABLED",
* type: "SCRIPT_BROWSER",
* });
* ```
*
* Type: `SCRIPT_API`
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.synthetics.Monitor("foo", {
* frequency: 5,
* locations: ["AWS_US_EAST_1"],
* status: "ENABLED",
* type: "SCRIPT_API",
* });
* ```
*
* > This content is derived from https://github.com/terraform-providers/terraform-provider-newrelic/blob/master/website/docs/r/synthetics_monitor.html.markdown.
*/
export class Monitor extends pulumi.CustomResource {
/**
* Get an existing Monitor 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.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: MonitorState, opts?: pulumi.CustomResourceOptions): Monitor {
return new Monitor(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'newrelic:synthetics/monitor:Monitor';
/**
* Returns true if the given object is an instance of Monitor. 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 Monitor {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Monitor.__pulumiType;
}
/**
* Bypass HEAD request.
*/
public readonly bypassHeadRequest!: pulumi.Output<boolean | undefined>;
/**
* The interval (in minutes) at which this monitor should run.
*/
public readonly frequency!: pulumi.Output<number>;
/**
* The locations in which this monitor should be run.
*/
public readonly locations!: pulumi.Output<string[]>;
/**
* The title of this monitor.
*/
public readonly name!: pulumi.Output<string>;
/**
* The base threshold for the SLA report.
*/
public readonly slaThreshold!: pulumi.Output<number | undefined>;
/**
* The monitor status (i.e. `ENABLED`, `MUTED`, `DISABLED`)
*/
public readonly status!: pulumi.Output<string>;
/**
* Fail the monitor check if redirected.
*/
public readonly treatRedirectAsFailure!: pulumi.Output<boolean | undefined>;
/**
* The monitor type. Valid values are `SIMPLE`, `BROWSER`, `SCRIPT_BROWSER`, and `SCRIPT_API`.
*/
public readonly type!: pulumi.Output<string>;
/**
* The URI for the monitor to hit.
*/
public readonly uri!: pulumi.Output<string | undefined>;
/**
* The string to validate against in the response.
*/
public readonly validationString!: pulumi.Output<string | undefined>;
/**
* Verify SSL.
*/
public readonly verifySsl!: pulumi.Output<boolean | undefined>;
/**
* Create a Monitor 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: MonitorArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: MonitorArgs | MonitorState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (opts && opts.id) {
const state = argsOrState as MonitorState | undefined;
inputs["bypassHeadRequest"] = state ? state.bypassHeadRequest : undefined;
inputs["frequency"] = state ? state.frequency : undefined;
inputs["locations"] = state ? state.locations : undefined;
inputs["name"] = state ? state.name : undefined;
inputs["slaThreshold"] = state ? state.slaThreshold : undefined;
inputs["status"] = state ? state.status : undefined;
inputs["treatRedirectAsFailure"] = state ? state.treatRedirectAsFailure : undefined;
inputs["type"] = state ? state.type : undefined;
inputs["uri"] = state ? state.uri : undefined;
inputs["validationString"] = state ? state.validationString : undefined;
inputs["verifySsl"] = state ? state.verifySsl : undefined;
} else {
const args = argsOrState as MonitorArgs | undefined;
if (!args || args.frequency === undefined) {
throw new Error("Missing required property 'frequency'");
}
if (!args || args.locations === undefined) {
throw new Error("Missing required property 'locations'");
}
if (!args || args.status === undefined) {
throw new Error("Missing required property 'status'");
}
if (!args || args.type === undefined) {
throw new Error("Missing required property 'type'");
}
inputs["bypassHeadRequest"] = args ? args.bypassHeadRequest : undefined;
inputs["frequency"] = args ? args.frequency : undefined;
inputs["locations"] = args ? args.locations : undefined;
inputs["name"] = args ? args.name : undefined;
inputs["slaThreshold"] = args ? args.slaThreshold : undefined;
inputs["status"] = args ? args.status : undefined;
inputs["treatRedirectAsFailure"] = args ? args.treatRedirectAsFailure : undefined;
inputs["type"] = args ? args.type : undefined;
inputs["uri"] = args ? args.uri : undefined;
inputs["validationString"] = args ? args.validationString : undefined;
inputs["verifySsl"] = args ? args.verifySsl : undefined;
}
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
super(Monitor.__pulumiType, name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering Monitor resources.
*/
export interface MonitorState {
/**
* Bypass HEAD request.
*/
readonly bypassHeadRequest?: pulumi.Input<boolean>;
/**
* The interval (in minutes) at which this monitor should run.
*/
readonly frequency?: pulumi.Input<number>;
/**
* The locations in which this monitor should be run.
*/
readonly locations?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The title of this monitor.
*/
readonly name?: pulumi.Input<string>;
/**
* The base threshold for the SLA report.
*/
readonly slaThreshold?: pulumi.Input<number>;
/**
* The monitor status (i.e. `ENABLED`, `MUTED`, `DISABLED`)
*/
readonly status?: pulumi.Input<string>;
/**
* Fail the monitor check if redirected.
*/
readonly treatRedirectAsFailure?: pulumi.Input<boolean>;
/**
* The monitor type. Valid values are `SIMPLE`, `BROWSER`, `SCRIPT_BROWSER`, and `SCRIPT_API`.
*/
readonly type?: pulumi.Input<string>;
/**
* The URI for the monitor to hit.
*/
readonly uri?: pulumi.Input<string>;
/**
* The string to validate against in the response.
*/
readonly validationString?: pulumi.Input<string>;
/**
* Verify SSL.
*/
readonly verifySsl?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a Monitor resource.
*/
export interface MonitorArgs {
/**
* Bypass HEAD request.
*/
readonly bypassHeadRequest?: pulumi.Input<boolean>;
/**
* The interval (in minutes) at which this monitor should run.
*/
readonly frequency: pulumi.Input<number>;
/**
* The locations in which this monitor should be run.
*/
readonly locations: pulumi.Input<pulumi.Input<string>[]>;
/**
* The title of this monitor.
*/
readonly name?: pulumi.Input<string>;
/**
* The base threshold for the SLA report.
*/
readonly slaThreshold?: pulumi.Input<number>;
/**
* The monitor status (i.e. `ENABLED`, `MUTED`, `DISABLED`)
*/
readonly status: pulumi.Input<string>;
/**
* Fail the monitor check if redirected.
*/
readonly treatRedirectAsFailure?: pulumi.Input<boolean>;
/**
* The monitor type. Valid values are `SIMPLE`, `BROWSER`, `SCRIPT_BROWSER`, and `SCRIPT_API`.
*/
readonly type: pulumi.Input<string>;
/**
* The URI for the monitor to hit.
*/
readonly uri?: pulumi.Input<string>;
/**
* The string to validate against in the response.
*/
readonly validationString?: pulumi.Input<string>;
/**
* Verify SSL.
*/
readonly verifySsl?: pulumi.Input<boolean>;
}