-
Notifications
You must be signed in to change notification settings - Fork 2
/
extensionServiceNow.go
497 lines (438 loc) · 19.6 KB
/
extensionServiceNow.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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
// 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 pagerduty
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A special case for [extension](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEzMw-create-an-extension) for ServiceNow.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// servicenow, err := pagerduty.GetExtensionSchema(ctx, &pagerduty.GetExtensionSchemaArgs{
// Name: "ServiceNow (v7)",
// }, nil)
// if err != nil {
// return err
// }
// exampleUser, err := pagerduty.NewUser(ctx, "exampleUser", &pagerduty.UserArgs{
// Email: pulumi.String("howard.james@example.domain"),
// })
// if err != nil {
// return err
// }
// exampleEscalationPolicy, err := pagerduty.NewEscalationPolicy(ctx, "exampleEscalationPolicy", &pagerduty.EscalationPolicyArgs{
// NumLoops: pulumi.Int(2),
// Rules: pagerduty.EscalationPolicyRuleArray{
// &pagerduty.EscalationPolicyRuleArgs{
// EscalationDelayInMinutes: pulumi.Int(10),
// Targets: pagerduty.EscalationPolicyRuleTargetArray{
// &pagerduty.EscalationPolicyRuleTargetArgs{
// Type: pulumi.String("user"),
// Id: exampleUser.ID(),
// },
// },
// },
// },
// })
// if err != nil {
// return err
// }
// exampleService, err := pagerduty.NewService(ctx, "exampleService", &pagerduty.ServiceArgs{
// AutoResolveTimeout: pulumi.String("14400"),
// AcknowledgementTimeout: pulumi.String("600"),
// EscalationPolicy: exampleEscalationPolicy.ID(),
// })
// if err != nil {
// return err
// }
// _, err = pagerduty.NewExtensionServiceNow(ctx, "snow", &pagerduty.ExtensionServiceNowArgs{
// ExtensionSchema: pulumi.String(servicenow.Id),
// ExtensionObjects: pulumi.StringArray{
// exampleService.ID(),
// },
// SnowUser: pulumi.String("meeps"),
// SnowPassword: pulumi.String("zorz"),
// SyncOptions: pulumi.String("manual_sync"),
// Target: pulumi.String("https://foo.servicenow.com/webhook_foo"),
// TaskType: pulumi.String("incident"),
// Referer: pulumi.String("None"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Extensions can be imported using the id.e.g.
//
// ```sh
// $ pulumi import pagerduty:index/extensionServiceNow:ExtensionServiceNow main PLBP09X
// ```
type ExtensionServiceNow struct {
pulumi.CustomResourceState
EndpointUrl pulumi.StringPtrOutput `pulumi:"endpointUrl"`
// This is the objects for which the extension applies (An array of service ids).
ExtensionObjects pulumi.StringArrayOutput `pulumi:"extensionObjects"`
// This is the schema for this extension.
ExtensionSchema pulumi.StringOutput `pulumi:"extensionSchema"`
// URL at which the entity is uniquely displayed in the Web app.
HtmlUrl pulumi.StringOutput `pulumi:"htmlUrl"`
// The name of the service extension.
Name pulumi.StringOutput `pulumi:"name"`
// The ServiceNow referer.
Referer pulumi.StringOutput `pulumi:"referer"`
// The ServiceNow password.
SnowPassword pulumi.StringOutput `pulumi:"snowPassword"`
// The ServiceNow username.
SnowUser pulumi.StringOutput `pulumi:"snowUser"`
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
Summary pulumi.StringOutput `pulumi:"summary"`
// The ServiceNow sync option.
SyncOptions pulumi.StringOutput `pulumi:"syncOptions"`
// Target Webhook URL.
Target pulumi.StringOutput `pulumi:"target"`
// The ServiceNow task type, typically `incident`.
TaskType pulumi.StringOutput `pulumi:"taskType"`
Type pulumi.StringOutput `pulumi:"type"`
}
// NewExtensionServiceNow registers a new resource with the given unique name, arguments, and options.
func NewExtensionServiceNow(ctx *pulumi.Context,
name string, args *ExtensionServiceNowArgs, opts ...pulumi.ResourceOption) (*ExtensionServiceNow, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ExtensionObjects == nil {
return nil, errors.New("invalid value for required argument 'ExtensionObjects'")
}
if args.ExtensionSchema == nil {
return nil, errors.New("invalid value for required argument 'ExtensionSchema'")
}
if args.Referer == nil {
return nil, errors.New("invalid value for required argument 'Referer'")
}
if args.SnowPassword == nil {
return nil, errors.New("invalid value for required argument 'SnowPassword'")
}
if args.SnowUser == nil {
return nil, errors.New("invalid value for required argument 'SnowUser'")
}
if args.SyncOptions == nil {
return nil, errors.New("invalid value for required argument 'SyncOptions'")
}
if args.Target == nil {
return nil, errors.New("invalid value for required argument 'Target'")
}
if args.TaskType == nil {
return nil, errors.New("invalid value for required argument 'TaskType'")
}
if args.EndpointUrl != nil {
args.EndpointUrl = pulumi.ToSecret(args.EndpointUrl).(pulumi.StringPtrInput)
}
if args.SnowPassword != nil {
args.SnowPassword = pulumi.ToSecret(args.SnowPassword).(pulumi.StringInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"endpointUrl",
"snowPassword",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ExtensionServiceNow
err := ctx.RegisterResource("pagerduty:index/extensionServiceNow:ExtensionServiceNow", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetExtensionServiceNow gets an existing ExtensionServiceNow 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 GetExtensionServiceNow(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ExtensionServiceNowState, opts ...pulumi.ResourceOption) (*ExtensionServiceNow, error) {
var resource ExtensionServiceNow
err := ctx.ReadResource("pagerduty:index/extensionServiceNow:ExtensionServiceNow", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ExtensionServiceNow resources.
type extensionServiceNowState struct {
EndpointUrl *string `pulumi:"endpointUrl"`
// This is the objects for which the extension applies (An array of service ids).
ExtensionObjects []string `pulumi:"extensionObjects"`
// This is the schema for this extension.
ExtensionSchema *string `pulumi:"extensionSchema"`
// URL at which the entity is uniquely displayed in the Web app.
HtmlUrl *string `pulumi:"htmlUrl"`
// The name of the service extension.
Name *string `pulumi:"name"`
// The ServiceNow referer.
Referer *string `pulumi:"referer"`
// The ServiceNow password.
SnowPassword *string `pulumi:"snowPassword"`
// The ServiceNow username.
SnowUser *string `pulumi:"snowUser"`
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
Summary *string `pulumi:"summary"`
// The ServiceNow sync option.
SyncOptions *string `pulumi:"syncOptions"`
// Target Webhook URL.
Target *string `pulumi:"target"`
// The ServiceNow task type, typically `incident`.
TaskType *string `pulumi:"taskType"`
Type *string `pulumi:"type"`
}
type ExtensionServiceNowState struct {
EndpointUrl pulumi.StringPtrInput
// This is the objects for which the extension applies (An array of service ids).
ExtensionObjects pulumi.StringArrayInput
// This is the schema for this extension.
ExtensionSchema pulumi.StringPtrInput
// URL at which the entity is uniquely displayed in the Web app.
HtmlUrl pulumi.StringPtrInput
// The name of the service extension.
Name pulumi.StringPtrInput
// The ServiceNow referer.
Referer pulumi.StringPtrInput
// The ServiceNow password.
SnowPassword pulumi.StringPtrInput
// The ServiceNow username.
SnowUser pulumi.StringPtrInput
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
Summary pulumi.StringPtrInput
// The ServiceNow sync option.
SyncOptions pulumi.StringPtrInput
// Target Webhook URL.
Target pulumi.StringPtrInput
// The ServiceNow task type, typically `incident`.
TaskType pulumi.StringPtrInput
Type pulumi.StringPtrInput
}
func (ExtensionServiceNowState) ElementType() reflect.Type {
return reflect.TypeOf((*extensionServiceNowState)(nil)).Elem()
}
type extensionServiceNowArgs struct {
EndpointUrl *string `pulumi:"endpointUrl"`
// This is the objects for which the extension applies (An array of service ids).
ExtensionObjects []string `pulumi:"extensionObjects"`
// This is the schema for this extension.
ExtensionSchema string `pulumi:"extensionSchema"`
// The name of the service extension.
Name *string `pulumi:"name"`
// The ServiceNow referer.
Referer string `pulumi:"referer"`
// The ServiceNow password.
SnowPassword string `pulumi:"snowPassword"`
// The ServiceNow username.
SnowUser string `pulumi:"snowUser"`
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
Summary *string `pulumi:"summary"`
// The ServiceNow sync option.
SyncOptions string `pulumi:"syncOptions"`
// Target Webhook URL.
Target string `pulumi:"target"`
// The ServiceNow task type, typically `incident`.
TaskType string `pulumi:"taskType"`
Type *string `pulumi:"type"`
}
// The set of arguments for constructing a ExtensionServiceNow resource.
type ExtensionServiceNowArgs struct {
EndpointUrl pulumi.StringPtrInput
// This is the objects for which the extension applies (An array of service ids).
ExtensionObjects pulumi.StringArrayInput
// This is the schema for this extension.
ExtensionSchema pulumi.StringInput
// The name of the service extension.
Name pulumi.StringPtrInput
// The ServiceNow referer.
Referer pulumi.StringInput
// The ServiceNow password.
SnowPassword pulumi.StringInput
// The ServiceNow username.
SnowUser pulumi.StringInput
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
Summary pulumi.StringPtrInput
// The ServiceNow sync option.
SyncOptions pulumi.StringInput
// Target Webhook URL.
Target pulumi.StringInput
// The ServiceNow task type, typically `incident`.
TaskType pulumi.StringInput
Type pulumi.StringPtrInput
}
func (ExtensionServiceNowArgs) ElementType() reflect.Type {
return reflect.TypeOf((*extensionServiceNowArgs)(nil)).Elem()
}
type ExtensionServiceNowInput interface {
pulumi.Input
ToExtensionServiceNowOutput() ExtensionServiceNowOutput
ToExtensionServiceNowOutputWithContext(ctx context.Context) ExtensionServiceNowOutput
}
func (*ExtensionServiceNow) ElementType() reflect.Type {
return reflect.TypeOf((**ExtensionServiceNow)(nil)).Elem()
}
func (i *ExtensionServiceNow) ToExtensionServiceNowOutput() ExtensionServiceNowOutput {
return i.ToExtensionServiceNowOutputWithContext(context.Background())
}
func (i *ExtensionServiceNow) ToExtensionServiceNowOutputWithContext(ctx context.Context) ExtensionServiceNowOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExtensionServiceNowOutput)
}
// ExtensionServiceNowArrayInput is an input type that accepts ExtensionServiceNowArray and ExtensionServiceNowArrayOutput values.
// You can construct a concrete instance of `ExtensionServiceNowArrayInput` via:
//
// ExtensionServiceNowArray{ ExtensionServiceNowArgs{...} }
type ExtensionServiceNowArrayInput interface {
pulumi.Input
ToExtensionServiceNowArrayOutput() ExtensionServiceNowArrayOutput
ToExtensionServiceNowArrayOutputWithContext(context.Context) ExtensionServiceNowArrayOutput
}
type ExtensionServiceNowArray []ExtensionServiceNowInput
func (ExtensionServiceNowArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ExtensionServiceNow)(nil)).Elem()
}
func (i ExtensionServiceNowArray) ToExtensionServiceNowArrayOutput() ExtensionServiceNowArrayOutput {
return i.ToExtensionServiceNowArrayOutputWithContext(context.Background())
}
func (i ExtensionServiceNowArray) ToExtensionServiceNowArrayOutputWithContext(ctx context.Context) ExtensionServiceNowArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExtensionServiceNowArrayOutput)
}
// ExtensionServiceNowMapInput is an input type that accepts ExtensionServiceNowMap and ExtensionServiceNowMapOutput values.
// You can construct a concrete instance of `ExtensionServiceNowMapInput` via:
//
// ExtensionServiceNowMap{ "key": ExtensionServiceNowArgs{...} }
type ExtensionServiceNowMapInput interface {
pulumi.Input
ToExtensionServiceNowMapOutput() ExtensionServiceNowMapOutput
ToExtensionServiceNowMapOutputWithContext(context.Context) ExtensionServiceNowMapOutput
}
type ExtensionServiceNowMap map[string]ExtensionServiceNowInput
func (ExtensionServiceNowMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ExtensionServiceNow)(nil)).Elem()
}
func (i ExtensionServiceNowMap) ToExtensionServiceNowMapOutput() ExtensionServiceNowMapOutput {
return i.ToExtensionServiceNowMapOutputWithContext(context.Background())
}
func (i ExtensionServiceNowMap) ToExtensionServiceNowMapOutputWithContext(ctx context.Context) ExtensionServiceNowMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExtensionServiceNowMapOutput)
}
type ExtensionServiceNowOutput struct{ *pulumi.OutputState }
func (ExtensionServiceNowOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ExtensionServiceNow)(nil)).Elem()
}
func (o ExtensionServiceNowOutput) ToExtensionServiceNowOutput() ExtensionServiceNowOutput {
return o
}
func (o ExtensionServiceNowOutput) ToExtensionServiceNowOutputWithContext(ctx context.Context) ExtensionServiceNowOutput {
return o
}
func (o ExtensionServiceNowOutput) EndpointUrl() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringPtrOutput { return v.EndpointUrl }).(pulumi.StringPtrOutput)
}
// This is the objects for which the extension applies (An array of service ids).
func (o ExtensionServiceNowOutput) ExtensionObjects() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringArrayOutput { return v.ExtensionObjects }).(pulumi.StringArrayOutput)
}
// This is the schema for this extension.
func (o ExtensionServiceNowOutput) ExtensionSchema() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.ExtensionSchema }).(pulumi.StringOutput)
}
// URL at which the entity is uniquely displayed in the Web app.
func (o ExtensionServiceNowOutput) HtmlUrl() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.HtmlUrl }).(pulumi.StringOutput)
}
// The name of the service extension.
func (o ExtensionServiceNowOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ServiceNow referer.
func (o ExtensionServiceNowOutput) Referer() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.Referer }).(pulumi.StringOutput)
}
// The ServiceNow password.
func (o ExtensionServiceNowOutput) SnowPassword() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.SnowPassword }).(pulumi.StringOutput)
}
// The ServiceNow username.
func (o ExtensionServiceNowOutput) SnowUser() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.SnowUser }).(pulumi.StringOutput)
}
// A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier.
func (o ExtensionServiceNowOutput) Summary() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.Summary }).(pulumi.StringOutput)
}
// The ServiceNow sync option.
func (o ExtensionServiceNowOutput) SyncOptions() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.SyncOptions }).(pulumi.StringOutput)
}
// Target Webhook URL.
func (o ExtensionServiceNowOutput) Target() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.Target }).(pulumi.StringOutput)
}
// The ServiceNow task type, typically `incident`.
func (o ExtensionServiceNowOutput) TaskType() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.TaskType }).(pulumi.StringOutput)
}
func (o ExtensionServiceNowOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *ExtensionServiceNow) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type ExtensionServiceNowArrayOutput struct{ *pulumi.OutputState }
func (ExtensionServiceNowArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ExtensionServiceNow)(nil)).Elem()
}
func (o ExtensionServiceNowArrayOutput) ToExtensionServiceNowArrayOutput() ExtensionServiceNowArrayOutput {
return o
}
func (o ExtensionServiceNowArrayOutput) ToExtensionServiceNowArrayOutputWithContext(ctx context.Context) ExtensionServiceNowArrayOutput {
return o
}
func (o ExtensionServiceNowArrayOutput) Index(i pulumi.IntInput) ExtensionServiceNowOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ExtensionServiceNow {
return vs[0].([]*ExtensionServiceNow)[vs[1].(int)]
}).(ExtensionServiceNowOutput)
}
type ExtensionServiceNowMapOutput struct{ *pulumi.OutputState }
func (ExtensionServiceNowMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ExtensionServiceNow)(nil)).Elem()
}
func (o ExtensionServiceNowMapOutput) ToExtensionServiceNowMapOutput() ExtensionServiceNowMapOutput {
return o
}
func (o ExtensionServiceNowMapOutput) ToExtensionServiceNowMapOutputWithContext(ctx context.Context) ExtensionServiceNowMapOutput {
return o
}
func (o ExtensionServiceNowMapOutput) MapIndex(k pulumi.StringInput) ExtensionServiceNowOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ExtensionServiceNow {
return vs[0].(map[string]*ExtensionServiceNow)[vs[1].(string)]
}).(ExtensionServiceNowOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ExtensionServiceNowInput)(nil)).Elem(), &ExtensionServiceNow{})
pulumi.RegisterInputType(reflect.TypeOf((*ExtensionServiceNowArrayInput)(nil)).Elem(), ExtensionServiceNowArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ExtensionServiceNowMapInput)(nil)).Elem(), ExtensionServiceNowMap{})
pulumi.RegisterOutputType(ExtensionServiceNowOutput{})
pulumi.RegisterOutputType(ExtensionServiceNowArrayOutput{})
pulumi.RegisterOutputType(ExtensionServiceNowMapOutput{})
}