generated from pulumi/pulumi-tf-provider-boilerplate
/
notifyList.go
281 lines (233 loc) · 9.45 KB
/
notifyList.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
// 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 ns1
import (
"context"
"reflect"
"github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a NS1 Notify List resource. This can be used to create, modify, and delete notify lists.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ns1.NewNotifyList(ctx, "nl", &ns1.NotifyListArgs{
// Notifications: ns1.NotifyListNotificationArray{
// &ns1.NotifyListNotificationArgs{
// Config: pulumi.Map{
// "url": pulumi.Any("http://www.mywebhook.com"),
// },
// Type: pulumi.String("webhook"),
// },
// &ns1.NotifyListNotificationArgs{
// Config: pulumi.Map{
// "email": pulumi.Any("test@test.com"),
// },
// Type: pulumi.String("email"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## NS1 Documentation
//
// [NotifyList Api Doc](https://ns1.com/api#notification-lists)
//
// ## Import
//
// ```sh
// $ pulumi import ns1:index/notifyList:NotifyList <name> <notifylist_id>`
// ```
type NotifyList struct {
pulumi.CustomResourceState
// The free-form display name for the notify list.
Name pulumi.StringOutput `pulumi:"name"`
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
Notifications NotifyListNotificationArrayOutput `pulumi:"notifications"`
}
// NewNotifyList registers a new resource with the given unique name, arguments, and options.
func NewNotifyList(ctx *pulumi.Context,
name string, args *NotifyListArgs, opts ...pulumi.ResourceOption) (*NotifyList, error) {
if args == nil {
args = &NotifyListArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource NotifyList
err := ctx.RegisterResource("ns1:index/notifyList:NotifyList", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNotifyList gets an existing NotifyList 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 GetNotifyList(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NotifyListState, opts ...pulumi.ResourceOption) (*NotifyList, error) {
var resource NotifyList
err := ctx.ReadResource("ns1:index/notifyList:NotifyList", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering NotifyList resources.
type notifyListState struct {
// The free-form display name for the notify list.
Name *string `pulumi:"name"`
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
Notifications []NotifyListNotification `pulumi:"notifications"`
}
type NotifyListState struct {
// The free-form display name for the notify list.
Name pulumi.StringPtrInput
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
Notifications NotifyListNotificationArrayInput
}
func (NotifyListState) ElementType() reflect.Type {
return reflect.TypeOf((*notifyListState)(nil)).Elem()
}
type notifyListArgs struct {
// The free-form display name for the notify list.
Name *string `pulumi:"name"`
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
Notifications []NotifyListNotification `pulumi:"notifications"`
}
// The set of arguments for constructing a NotifyList resource.
type NotifyListArgs struct {
// The free-form display name for the notify list.
Name pulumi.StringPtrInput
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
Notifications NotifyListNotificationArrayInput
}
func (NotifyListArgs) ElementType() reflect.Type {
return reflect.TypeOf((*notifyListArgs)(nil)).Elem()
}
type NotifyListInput interface {
pulumi.Input
ToNotifyListOutput() NotifyListOutput
ToNotifyListOutputWithContext(ctx context.Context) NotifyListOutput
}
func (*NotifyList) ElementType() reflect.Type {
return reflect.TypeOf((**NotifyList)(nil)).Elem()
}
func (i *NotifyList) ToNotifyListOutput() NotifyListOutput {
return i.ToNotifyListOutputWithContext(context.Background())
}
func (i *NotifyList) ToNotifyListOutputWithContext(ctx context.Context) NotifyListOutput {
return pulumi.ToOutputWithContext(ctx, i).(NotifyListOutput)
}
// NotifyListArrayInput is an input type that accepts NotifyListArray and NotifyListArrayOutput values.
// You can construct a concrete instance of `NotifyListArrayInput` via:
//
// NotifyListArray{ NotifyListArgs{...} }
type NotifyListArrayInput interface {
pulumi.Input
ToNotifyListArrayOutput() NotifyListArrayOutput
ToNotifyListArrayOutputWithContext(context.Context) NotifyListArrayOutput
}
type NotifyListArray []NotifyListInput
func (NotifyListArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NotifyList)(nil)).Elem()
}
func (i NotifyListArray) ToNotifyListArrayOutput() NotifyListArrayOutput {
return i.ToNotifyListArrayOutputWithContext(context.Background())
}
func (i NotifyListArray) ToNotifyListArrayOutputWithContext(ctx context.Context) NotifyListArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(NotifyListArrayOutput)
}
// NotifyListMapInput is an input type that accepts NotifyListMap and NotifyListMapOutput values.
// You can construct a concrete instance of `NotifyListMapInput` via:
//
// NotifyListMap{ "key": NotifyListArgs{...} }
type NotifyListMapInput interface {
pulumi.Input
ToNotifyListMapOutput() NotifyListMapOutput
ToNotifyListMapOutputWithContext(context.Context) NotifyListMapOutput
}
type NotifyListMap map[string]NotifyListInput
func (NotifyListMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NotifyList)(nil)).Elem()
}
func (i NotifyListMap) ToNotifyListMapOutput() NotifyListMapOutput {
return i.ToNotifyListMapOutputWithContext(context.Background())
}
func (i NotifyListMap) ToNotifyListMapOutputWithContext(ctx context.Context) NotifyListMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(NotifyListMapOutput)
}
type NotifyListOutput struct{ *pulumi.OutputState }
func (NotifyListOutput) ElementType() reflect.Type {
return reflect.TypeOf((**NotifyList)(nil)).Elem()
}
func (o NotifyListOutput) ToNotifyListOutput() NotifyListOutput {
return o
}
func (o NotifyListOutput) ToNotifyListOutputWithContext(ctx context.Context) NotifyListOutput {
return o
}
// The free-form display name for the notify list.
func (o NotifyListOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *NotifyList) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// A list of notifiers. All notifiers in a notification list will receive notifications whenever an event is send to the list (e.g., when a monitoring job fails). Notifiers are documented below.
func (o NotifyListOutput) Notifications() NotifyListNotificationArrayOutput {
return o.ApplyT(func(v *NotifyList) NotifyListNotificationArrayOutput { return v.Notifications }).(NotifyListNotificationArrayOutput)
}
type NotifyListArrayOutput struct{ *pulumi.OutputState }
func (NotifyListArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NotifyList)(nil)).Elem()
}
func (o NotifyListArrayOutput) ToNotifyListArrayOutput() NotifyListArrayOutput {
return o
}
func (o NotifyListArrayOutput) ToNotifyListArrayOutputWithContext(ctx context.Context) NotifyListArrayOutput {
return o
}
func (o NotifyListArrayOutput) Index(i pulumi.IntInput) NotifyListOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NotifyList {
return vs[0].([]*NotifyList)[vs[1].(int)]
}).(NotifyListOutput)
}
type NotifyListMapOutput struct{ *pulumi.OutputState }
func (NotifyListMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NotifyList)(nil)).Elem()
}
func (o NotifyListMapOutput) ToNotifyListMapOutput() NotifyListMapOutput {
return o
}
func (o NotifyListMapOutput) ToNotifyListMapOutputWithContext(ctx context.Context) NotifyListMapOutput {
return o
}
func (o NotifyListMapOutput) MapIndex(k pulumi.StringInput) NotifyListOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NotifyList {
return vs[0].(map[string]*NotifyList)[vs[1].(string)]
}).(NotifyListOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*NotifyListInput)(nil)).Elem(), &NotifyList{})
pulumi.RegisterInputType(reflect.TypeOf((*NotifyListArrayInput)(nil)).Elem(), NotifyListArray{})
pulumi.RegisterInputType(reflect.TypeOf((*NotifyListMapInput)(nil)).Elem(), NotifyListMap{})
pulumi.RegisterOutputType(NotifyListOutput{})
pulumi.RegisterOutputType(NotifyListArrayOutput{})
pulumi.RegisterOutputType(NotifyListMapOutput{})
}