/
integration.go
446 lines (388 loc) · 18.6 KB
/
integration.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
// 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 jira
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-signalfx/sdk/v6/go/signalfx/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// SignalFx Jira integrations. For help with this integration see [Integration with Jira](https://docs.signalfx.com/en/latest/admin-guide/integrate-notifications.html#integrate-with-jira).
//
// > **NOTE** When managing integrations, use a session token of an administrator to authenticate the SignalFx provider. See [Operations that require a session token for an administrator](https://dev.splunk.com/observability/docs/administration/authtokens#Operations-that-require-a-session-token-for-an-administrator). Otherwise you'll receive a 4xx error.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-signalfx/sdk/v6/go/signalfx/jira"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := jira.NewIntegration(ctx, "jiraMyteamXX", &jira.IntegrationArgs{
// AssigneeDisplayName: pulumi.String("Testy Testerson"),
// AssigneeName: pulumi.String("testytesterson"),
// AuthMethod: pulumi.String("UsernameAndPassword"),
// BaseUrl: pulumi.String("https://www.example.com"),
// Enabled: pulumi.Bool(false),
// IssueType: pulumi.String("Story"),
// Password: pulumi.String("paasword"),
// ProjectKey: pulumi.String("TEST"),
// Username: pulumi.String("yoosername"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type Integration struct {
pulumi.CustomResourceState
// The API token for the user email
ApiToken pulumi.StringPtrOutput `pulumi:"apiToken"`
// Jira display name for the assignee.
AssigneeDisplayName pulumi.StringPtrOutput `pulumi:"assigneeDisplayName"`
// Jira user name for the assignee.
AssigneeName pulumi.StringOutput `pulumi:"assigneeName"`
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
AuthMethod pulumi.StringOutput `pulumi:"authMethod"`
// Base URL of the Jira instance that's integrated with SignalFx.
BaseUrl pulumi.StringOutput `pulumi:"baseUrl"`
// Whether the integration is enabled.
Enabled pulumi.BoolOutput `pulumi:"enabled"`
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
IssueType pulumi.StringOutput `pulumi:"issueType"`
// Name of the integration.
Name pulumi.StringOutput `pulumi:"name"`
// Password used to authenticate the Jira integration.
Password pulumi.StringPtrOutput `pulumi:"password"`
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
ProjectKey pulumi.StringOutput `pulumi:"projectKey"`
// Email address used to authenticate the Jira integration.
UserEmail pulumi.StringPtrOutput `pulumi:"userEmail"`
// User name used to authenticate the Jira integration.
Username pulumi.StringPtrOutput `pulumi:"username"`
}
// NewIntegration registers a new resource with the given unique name, arguments, and options.
func NewIntegration(ctx *pulumi.Context,
name string, args *IntegrationArgs, opts ...pulumi.ResourceOption) (*Integration, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AssigneeName == nil {
return nil, errors.New("invalid value for required argument 'AssigneeName'")
}
if args.AuthMethod == nil {
return nil, errors.New("invalid value for required argument 'AuthMethod'")
}
if args.BaseUrl == nil {
return nil, errors.New("invalid value for required argument 'BaseUrl'")
}
if args.Enabled == nil {
return nil, errors.New("invalid value for required argument 'Enabled'")
}
if args.IssueType == nil {
return nil, errors.New("invalid value for required argument 'IssueType'")
}
if args.ProjectKey == nil {
return nil, errors.New("invalid value for required argument 'ProjectKey'")
}
if args.ApiToken != nil {
args.ApiToken = pulumi.ToSecret(args.ApiToken).(pulumi.StringPtrInput)
}
if args.Password != nil {
args.Password = pulumi.ToSecret(args.Password).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"apiToken",
"password",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Integration
err := ctx.RegisterResource("signalfx:jira/integration:Integration", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIntegration gets an existing Integration 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 GetIntegration(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IntegrationState, opts ...pulumi.ResourceOption) (*Integration, error) {
var resource Integration
err := ctx.ReadResource("signalfx:jira/integration:Integration", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Integration resources.
type integrationState struct {
// The API token for the user email
ApiToken *string `pulumi:"apiToken"`
// Jira display name for the assignee.
AssigneeDisplayName *string `pulumi:"assigneeDisplayName"`
// Jira user name for the assignee.
AssigneeName *string `pulumi:"assigneeName"`
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
AuthMethod *string `pulumi:"authMethod"`
// Base URL of the Jira instance that's integrated with SignalFx.
BaseUrl *string `pulumi:"baseUrl"`
// Whether the integration is enabled.
Enabled *bool `pulumi:"enabled"`
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
IssueType *string `pulumi:"issueType"`
// Name of the integration.
Name *string `pulumi:"name"`
// Password used to authenticate the Jira integration.
Password *string `pulumi:"password"`
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
ProjectKey *string `pulumi:"projectKey"`
// Email address used to authenticate the Jira integration.
UserEmail *string `pulumi:"userEmail"`
// User name used to authenticate the Jira integration.
Username *string `pulumi:"username"`
}
type IntegrationState struct {
// The API token for the user email
ApiToken pulumi.StringPtrInput
// Jira display name for the assignee.
AssigneeDisplayName pulumi.StringPtrInput
// Jira user name for the assignee.
AssigneeName pulumi.StringPtrInput
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
AuthMethod pulumi.StringPtrInput
// Base URL of the Jira instance that's integrated with SignalFx.
BaseUrl pulumi.StringPtrInput
// Whether the integration is enabled.
Enabled pulumi.BoolPtrInput
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
IssueType pulumi.StringPtrInput
// Name of the integration.
Name pulumi.StringPtrInput
// Password used to authenticate the Jira integration.
Password pulumi.StringPtrInput
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
ProjectKey pulumi.StringPtrInput
// Email address used to authenticate the Jira integration.
UserEmail pulumi.StringPtrInput
// User name used to authenticate the Jira integration.
Username pulumi.StringPtrInput
}
func (IntegrationState) ElementType() reflect.Type {
return reflect.TypeOf((*integrationState)(nil)).Elem()
}
type integrationArgs struct {
// The API token for the user email
ApiToken *string `pulumi:"apiToken"`
// Jira display name for the assignee.
AssigneeDisplayName *string `pulumi:"assigneeDisplayName"`
// Jira user name for the assignee.
AssigneeName string `pulumi:"assigneeName"`
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
AuthMethod string `pulumi:"authMethod"`
// Base URL of the Jira instance that's integrated with SignalFx.
BaseUrl string `pulumi:"baseUrl"`
// Whether the integration is enabled.
Enabled bool `pulumi:"enabled"`
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
IssueType string `pulumi:"issueType"`
// Name of the integration.
Name *string `pulumi:"name"`
// Password used to authenticate the Jira integration.
Password *string `pulumi:"password"`
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
ProjectKey string `pulumi:"projectKey"`
// Email address used to authenticate the Jira integration.
UserEmail *string `pulumi:"userEmail"`
// User name used to authenticate the Jira integration.
Username *string `pulumi:"username"`
}
// The set of arguments for constructing a Integration resource.
type IntegrationArgs struct {
// The API token for the user email
ApiToken pulumi.StringPtrInput
// Jira display name for the assignee.
AssigneeDisplayName pulumi.StringPtrInput
// Jira user name for the assignee.
AssigneeName pulumi.StringInput
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
AuthMethod pulumi.StringInput
// Base URL of the Jira instance that's integrated with SignalFx.
BaseUrl pulumi.StringInput
// Whether the integration is enabled.
Enabled pulumi.BoolInput
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
IssueType pulumi.StringInput
// Name of the integration.
Name pulumi.StringPtrInput
// Password used to authenticate the Jira integration.
Password pulumi.StringPtrInput
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
ProjectKey pulumi.StringInput
// Email address used to authenticate the Jira integration.
UserEmail pulumi.StringPtrInput
// User name used to authenticate the Jira integration.
Username pulumi.StringPtrInput
}
func (IntegrationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*integrationArgs)(nil)).Elem()
}
type IntegrationInput interface {
pulumi.Input
ToIntegrationOutput() IntegrationOutput
ToIntegrationOutputWithContext(ctx context.Context) IntegrationOutput
}
func (*Integration) ElementType() reflect.Type {
return reflect.TypeOf((**Integration)(nil)).Elem()
}
func (i *Integration) ToIntegrationOutput() IntegrationOutput {
return i.ToIntegrationOutputWithContext(context.Background())
}
func (i *Integration) ToIntegrationOutputWithContext(ctx context.Context) IntegrationOutput {
return pulumi.ToOutputWithContext(ctx, i).(IntegrationOutput)
}
// IntegrationArrayInput is an input type that accepts IntegrationArray and IntegrationArrayOutput values.
// You can construct a concrete instance of `IntegrationArrayInput` via:
//
// IntegrationArray{ IntegrationArgs{...} }
type IntegrationArrayInput interface {
pulumi.Input
ToIntegrationArrayOutput() IntegrationArrayOutput
ToIntegrationArrayOutputWithContext(context.Context) IntegrationArrayOutput
}
type IntegrationArray []IntegrationInput
func (IntegrationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Integration)(nil)).Elem()
}
func (i IntegrationArray) ToIntegrationArrayOutput() IntegrationArrayOutput {
return i.ToIntegrationArrayOutputWithContext(context.Background())
}
func (i IntegrationArray) ToIntegrationArrayOutputWithContext(ctx context.Context) IntegrationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(IntegrationArrayOutput)
}
// IntegrationMapInput is an input type that accepts IntegrationMap and IntegrationMapOutput values.
// You can construct a concrete instance of `IntegrationMapInput` via:
//
// IntegrationMap{ "key": IntegrationArgs{...} }
type IntegrationMapInput interface {
pulumi.Input
ToIntegrationMapOutput() IntegrationMapOutput
ToIntegrationMapOutputWithContext(context.Context) IntegrationMapOutput
}
type IntegrationMap map[string]IntegrationInput
func (IntegrationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Integration)(nil)).Elem()
}
func (i IntegrationMap) ToIntegrationMapOutput() IntegrationMapOutput {
return i.ToIntegrationMapOutputWithContext(context.Background())
}
func (i IntegrationMap) ToIntegrationMapOutputWithContext(ctx context.Context) IntegrationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(IntegrationMapOutput)
}
type IntegrationOutput struct{ *pulumi.OutputState }
func (IntegrationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Integration)(nil)).Elem()
}
func (o IntegrationOutput) ToIntegrationOutput() IntegrationOutput {
return o
}
func (o IntegrationOutput) ToIntegrationOutputWithContext(ctx context.Context) IntegrationOutput {
return o
}
// The API token for the user email
func (o IntegrationOutput) ApiToken() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Integration) pulumi.StringPtrOutput { return v.ApiToken }).(pulumi.StringPtrOutput)
}
// Jira display name for the assignee.
func (o IntegrationOutput) AssigneeDisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Integration) pulumi.StringPtrOutput { return v.AssigneeDisplayName }).(pulumi.StringPtrOutput)
}
// Jira user name for the assignee.
func (o IntegrationOutput) AssigneeName() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.AssigneeName }).(pulumi.StringOutput)
}
// Authentication method used when creating the Jira integration. One of `EmailAndToken` (using `userEmail` and `apiToken`) or `UsernameAndPassword` (using `username` and `password`).
func (o IntegrationOutput) AuthMethod() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.AuthMethod }).(pulumi.StringOutput)
}
// Base URL of the Jira instance that's integrated with SignalFx.
func (o IntegrationOutput) BaseUrl() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.BaseUrl }).(pulumi.StringOutput)
}
// Whether the integration is enabled.
func (o IntegrationOutput) Enabled() pulumi.BoolOutput {
return o.ApplyT(func(v *Integration) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput)
}
// Issue type (for example, Story) for tickets that Jira creates for detector notifications. SignalFx validates issue types, so you must specify a type that's valid for the Jira project specified in `projectKey`.
func (o IntegrationOutput) IssueType() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.IssueType }).(pulumi.StringOutput)
}
// Name of the integration.
func (o IntegrationOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Password used to authenticate the Jira integration.
func (o IntegrationOutput) Password() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Integration) pulumi.StringPtrOutput { return v.Password }).(pulumi.StringPtrOutput)
}
// Jira key of an existing project. When Jira creates a new ticket for a detector notification, the ticket is assigned to this project.
func (o IntegrationOutput) ProjectKey() pulumi.StringOutput {
return o.ApplyT(func(v *Integration) pulumi.StringOutput { return v.ProjectKey }).(pulumi.StringOutput)
}
// Email address used to authenticate the Jira integration.
func (o IntegrationOutput) UserEmail() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Integration) pulumi.StringPtrOutput { return v.UserEmail }).(pulumi.StringPtrOutput)
}
// User name used to authenticate the Jira integration.
func (o IntegrationOutput) Username() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Integration) pulumi.StringPtrOutput { return v.Username }).(pulumi.StringPtrOutput)
}
type IntegrationArrayOutput struct{ *pulumi.OutputState }
func (IntegrationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Integration)(nil)).Elem()
}
func (o IntegrationArrayOutput) ToIntegrationArrayOutput() IntegrationArrayOutput {
return o
}
func (o IntegrationArrayOutput) ToIntegrationArrayOutputWithContext(ctx context.Context) IntegrationArrayOutput {
return o
}
func (o IntegrationArrayOutput) Index(i pulumi.IntInput) IntegrationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Integration {
return vs[0].([]*Integration)[vs[1].(int)]
}).(IntegrationOutput)
}
type IntegrationMapOutput struct{ *pulumi.OutputState }
func (IntegrationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Integration)(nil)).Elem()
}
func (o IntegrationMapOutput) ToIntegrationMapOutput() IntegrationMapOutput {
return o
}
func (o IntegrationMapOutput) ToIntegrationMapOutputWithContext(ctx context.Context) IntegrationMapOutput {
return o
}
func (o IntegrationMapOutput) MapIndex(k pulumi.StringInput) IntegrationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Integration {
return vs[0].(map[string]*Integration)[vs[1].(string)]
}).(IntegrationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IntegrationInput)(nil)).Elem(), &Integration{})
pulumi.RegisterInputType(reflect.TypeOf((*IntegrationArrayInput)(nil)).Elem(), IntegrationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*IntegrationMapInput)(nil)).Elem(), IntegrationMap{})
pulumi.RegisterOutputType(IntegrationOutput{})
pulumi.RegisterOutputType(IntegrationArrayOutput{})
pulumi.RegisterOutputType(IntegrationMapOutput{})
}