This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
flagTrigger.go
348 lines (294 loc) · 18.3 KB
/
flagTrigger.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
// 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 launchdarkly
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Import
//
// # LaunchDarkly flag triggers can be imported using the following syntax
//
// ```sh
//
// $ pulumi import launchdarkly:index/flagTrigger:FlagTrigger example example-project-key/example-env-key/example-flag-key/62581d4488def814b831abc3
//
// ```
//
// where the string following the final slash is your unique trigger ID. The unique trigger ID can be found in your saved trigger URLhttps://app.launchdarkly.com/webhook/triggers/THIS_IS_YOUR_TRIGGER_ID/aff25a53-17d9-4112-a9b8-12718d1a2e79 Please note that if you did not save this upon creation of the resource, you will have to reset it to get a new value, which can cause breaking changes.
type FlagTrigger struct {
pulumi.CustomResourceState
// Whether the trigger is currently active or not. This property defaults to true upon creation
Enabled pulumi.BoolOutput `pulumi:"enabled"`
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
EnvKey pulumi.StringOutput `pulumi:"envKey"`
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
FlagKey pulumi.StringOutput `pulumi:"flagKey"`
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
Instructions FlagTriggerInstructionsOutput `pulumi:"instructions"`
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
IntegrationKey pulumi.StringOutput `pulumi:"integrationKey"`
// The LaunchDarkly ID of the member who maintains the trigger. The API will automatically apply the member associated with
// your Terraform API key or the most recently-set maintainer
MaintainerId pulumi.StringOutput `pulumi:"maintainerId"`
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
ProjectKey pulumi.StringOutput `pulumi:"projectKey"`
// The unique trigger URL
TriggerUrl pulumi.StringOutput `pulumi:"triggerUrl"`
}
// NewFlagTrigger registers a new resource with the given unique name, arguments, and options.
func NewFlagTrigger(ctx *pulumi.Context,
name string, args *FlagTriggerArgs, opts ...pulumi.ResourceOption) (*FlagTrigger, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Enabled == nil {
return nil, errors.New("invalid value for required argument 'Enabled'")
}
if args.EnvKey == nil {
return nil, errors.New("invalid value for required argument 'EnvKey'")
}
if args.FlagKey == nil {
return nil, errors.New("invalid value for required argument 'FlagKey'")
}
if args.Instructions == nil {
return nil, errors.New("invalid value for required argument 'Instructions'")
}
if args.IntegrationKey == nil {
return nil, errors.New("invalid value for required argument 'IntegrationKey'")
}
if args.ProjectKey == nil {
return nil, errors.New("invalid value for required argument 'ProjectKey'")
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"triggerUrl",
})
opts = append(opts, secrets)
opts = pkgResourceDefaultOpts(opts)
var resource FlagTrigger
err := ctx.RegisterResource("launchdarkly:index/flagTrigger:FlagTrigger", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFlagTrigger gets an existing FlagTrigger 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 GetFlagTrigger(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FlagTriggerState, opts ...pulumi.ResourceOption) (*FlagTrigger, error) {
var resource FlagTrigger
err := ctx.ReadResource("launchdarkly:index/flagTrigger:FlagTrigger", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering FlagTrigger resources.
type flagTriggerState struct {
// Whether the trigger is currently active or not. This property defaults to true upon creation
Enabled *bool `pulumi:"enabled"`
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
EnvKey *string `pulumi:"envKey"`
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
FlagKey *string `pulumi:"flagKey"`
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
Instructions *FlagTriggerInstructions `pulumi:"instructions"`
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
IntegrationKey *string `pulumi:"integrationKey"`
// The LaunchDarkly ID of the member who maintains the trigger. The API will automatically apply the member associated with
// your Terraform API key or the most recently-set maintainer
MaintainerId *string `pulumi:"maintainerId"`
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
ProjectKey *string `pulumi:"projectKey"`
// The unique trigger URL
TriggerUrl *string `pulumi:"triggerUrl"`
}
type FlagTriggerState struct {
// Whether the trigger is currently active or not. This property defaults to true upon creation
Enabled pulumi.BoolPtrInput
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
EnvKey pulumi.StringPtrInput
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
FlagKey pulumi.StringPtrInput
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
Instructions FlagTriggerInstructionsPtrInput
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
IntegrationKey pulumi.StringPtrInput
// The LaunchDarkly ID of the member who maintains the trigger. The API will automatically apply the member associated with
// your Terraform API key or the most recently-set maintainer
MaintainerId pulumi.StringPtrInput
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
ProjectKey pulumi.StringPtrInput
// The unique trigger URL
TriggerUrl pulumi.StringPtrInput
}
func (FlagTriggerState) ElementType() reflect.Type {
return reflect.TypeOf((*flagTriggerState)(nil)).Elem()
}
type flagTriggerArgs struct {
// Whether the trigger is currently active or not. This property defaults to true upon creation
Enabled bool `pulumi:"enabled"`
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
EnvKey string `pulumi:"envKey"`
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
FlagKey string `pulumi:"flagKey"`
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
Instructions FlagTriggerInstructions `pulumi:"instructions"`
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
IntegrationKey string `pulumi:"integrationKey"`
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
ProjectKey string `pulumi:"projectKey"`
}
// The set of arguments for constructing a FlagTrigger resource.
type FlagTriggerArgs struct {
// Whether the trigger is currently active or not. This property defaults to true upon creation
Enabled pulumi.BoolInput
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
EnvKey pulumi.StringInput
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
FlagKey pulumi.StringInput
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
Instructions FlagTriggerInstructionsInput
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
IntegrationKey pulumi.StringInput
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
ProjectKey pulumi.StringInput
}
func (FlagTriggerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*flagTriggerArgs)(nil)).Elem()
}
type FlagTriggerInput interface {
pulumi.Input
ToFlagTriggerOutput() FlagTriggerOutput
ToFlagTriggerOutputWithContext(ctx context.Context) FlagTriggerOutput
}
func (*FlagTrigger) ElementType() reflect.Type {
return reflect.TypeOf((**FlagTrigger)(nil)).Elem()
}
func (i *FlagTrigger) ToFlagTriggerOutput() FlagTriggerOutput {
return i.ToFlagTriggerOutputWithContext(context.Background())
}
func (i *FlagTrigger) ToFlagTriggerOutputWithContext(ctx context.Context) FlagTriggerOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlagTriggerOutput)
}
// FlagTriggerArrayInput is an input type that accepts FlagTriggerArray and FlagTriggerArrayOutput values.
// You can construct a concrete instance of `FlagTriggerArrayInput` via:
//
// FlagTriggerArray{ FlagTriggerArgs{...} }
type FlagTriggerArrayInput interface {
pulumi.Input
ToFlagTriggerArrayOutput() FlagTriggerArrayOutput
ToFlagTriggerArrayOutputWithContext(context.Context) FlagTriggerArrayOutput
}
type FlagTriggerArray []FlagTriggerInput
func (FlagTriggerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FlagTrigger)(nil)).Elem()
}
func (i FlagTriggerArray) ToFlagTriggerArrayOutput() FlagTriggerArrayOutput {
return i.ToFlagTriggerArrayOutputWithContext(context.Background())
}
func (i FlagTriggerArray) ToFlagTriggerArrayOutputWithContext(ctx context.Context) FlagTriggerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlagTriggerArrayOutput)
}
// FlagTriggerMapInput is an input type that accepts FlagTriggerMap and FlagTriggerMapOutput values.
// You can construct a concrete instance of `FlagTriggerMapInput` via:
//
// FlagTriggerMap{ "key": FlagTriggerArgs{...} }
type FlagTriggerMapInput interface {
pulumi.Input
ToFlagTriggerMapOutput() FlagTriggerMapOutput
ToFlagTriggerMapOutputWithContext(context.Context) FlagTriggerMapOutput
}
type FlagTriggerMap map[string]FlagTriggerInput
func (FlagTriggerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FlagTrigger)(nil)).Elem()
}
func (i FlagTriggerMap) ToFlagTriggerMapOutput() FlagTriggerMapOutput {
return i.ToFlagTriggerMapOutputWithContext(context.Background())
}
func (i FlagTriggerMap) ToFlagTriggerMapOutputWithContext(ctx context.Context) FlagTriggerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlagTriggerMapOutput)
}
type FlagTriggerOutput struct{ *pulumi.OutputState }
func (FlagTriggerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**FlagTrigger)(nil)).Elem()
}
func (o FlagTriggerOutput) ToFlagTriggerOutput() FlagTriggerOutput {
return o
}
func (o FlagTriggerOutput) ToFlagTriggerOutputWithContext(ctx context.Context) FlagTriggerOutput {
return o
}
// Whether the trigger is currently active or not. This property defaults to true upon creation
func (o FlagTriggerOutput) Enabled() pulumi.BoolOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput)
}
// The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
func (o FlagTriggerOutput) EnvKey() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.EnvKey }).(pulumi.StringOutput)
}
// The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
func (o FlagTriggerOutput) FlagKey() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.FlagKey }).(pulumi.StringOutput)
}
// Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `"turnFlagOn"` and `"turnFlagOff"`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`.
func (o FlagTriggerOutput) Instructions() FlagTriggerInstructionsOutput {
return o.ApplyT(func(v *FlagTrigger) FlagTriggerInstructionsOutput { return v.Instructions }).(FlagTriggerInstructionsOutput)
}
// The unique identifier of the integration you intend to set your trigger up with. Currently supported are `"datadog"`, `"dynatrace"`, `"honeycomb"`, `"new-relic-apm"`, `"signalfx"`, and `"generic-trigger"`. `"generic-trigger"` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
func (o FlagTriggerOutput) IntegrationKey() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.IntegrationKey }).(pulumi.StringOutput)
}
// The LaunchDarkly ID of the member who maintains the trigger. The API will automatically apply the member associated with
// your Terraform API key or the most recently-set maintainer
func (o FlagTriggerOutput) MaintainerId() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.MaintainerId }).(pulumi.StringOutput)
}
// The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
func (o FlagTriggerOutput) ProjectKey() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.ProjectKey }).(pulumi.StringOutput)
}
// The unique trigger URL
func (o FlagTriggerOutput) TriggerUrl() pulumi.StringOutput {
return o.ApplyT(func(v *FlagTrigger) pulumi.StringOutput { return v.TriggerUrl }).(pulumi.StringOutput)
}
type FlagTriggerArrayOutput struct{ *pulumi.OutputState }
func (FlagTriggerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FlagTrigger)(nil)).Elem()
}
func (o FlagTriggerArrayOutput) ToFlagTriggerArrayOutput() FlagTriggerArrayOutput {
return o
}
func (o FlagTriggerArrayOutput) ToFlagTriggerArrayOutputWithContext(ctx context.Context) FlagTriggerArrayOutput {
return o
}
func (o FlagTriggerArrayOutput) Index(i pulumi.IntInput) FlagTriggerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FlagTrigger {
return vs[0].([]*FlagTrigger)[vs[1].(int)]
}).(FlagTriggerOutput)
}
type FlagTriggerMapOutput struct{ *pulumi.OutputState }
func (FlagTriggerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FlagTrigger)(nil)).Elem()
}
func (o FlagTriggerMapOutput) ToFlagTriggerMapOutput() FlagTriggerMapOutput {
return o
}
func (o FlagTriggerMapOutput) ToFlagTriggerMapOutputWithContext(ctx context.Context) FlagTriggerMapOutput {
return o
}
func (o FlagTriggerMapOutput) MapIndex(k pulumi.StringInput) FlagTriggerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FlagTrigger {
return vs[0].(map[string]*FlagTrigger)[vs[1].(string)]
}).(FlagTriggerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FlagTriggerInput)(nil)).Elem(), &FlagTrigger{})
pulumi.RegisterInputType(reflect.TypeOf((*FlagTriggerArrayInput)(nil)).Elem(), FlagTriggerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*FlagTriggerMapInput)(nil)).Elem(), FlagTriggerMap{})
pulumi.RegisterOutputType(FlagTriggerOutput{})
pulumi.RegisterOutputType(FlagTriggerArrayOutput{})
pulumi.RegisterOutputType(FlagTriggerMapOutput{})
}