-
Notifications
You must be signed in to change notification settings - Fork 2
/
businessServiceSubscriber.go
319 lines (270 loc) · 13 KB
/
businessServiceSubscriber.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
// 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 [business service subscriber](https://developer.pagerduty.com/api-reference/b3A6NDUwNDgxOQ-list-business-service-subscribers) allows you to subscribe users or teams to automatically receive updates about key business services.
//
// ## 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 {
// exampleBusinessService, err := pagerduty.NewBusinessService(ctx, "exampleBusinessService", &pagerduty.BusinessServiceArgs{
// Description: pulumi.String("A very descriptive description of this business service"),
// PointOfContact: pulumi.String("PagerDuty Admin"),
// Team: pulumi.String("P37RSRS"),
// })
// if err != nil {
// return err
// }
// engteam, err := pagerduty.NewTeam(ctx, "engteam", nil)
// if err != nil {
// return err
// }
// exampleUser, err := pagerduty.NewUser(ctx, "exampleUser", &pagerduty.UserArgs{
// Email: pulumi.String("125.greenholt.earline@graham.name"),
// })
// if err != nil {
// return err
// }
// _, err = pagerduty.NewBusinessServiceSubscriber(ctx, "teamExample", &pagerduty.BusinessServiceSubscriberArgs{
// SubscriberId: engteam.ID(),
// SubscriberType: pulumi.String("team"),
// BusinessServiceId: exampleBusinessService.ID(),
// })
// if err != nil {
// return err
// }
// _, err = pagerduty.NewBusinessServiceSubscriber(ctx, "userExample", &pagerduty.BusinessServiceSubscriberArgs{
// SubscriberId: exampleUser.ID(),
// SubscriberType: pulumi.String("user"),
// BusinessServiceId: exampleBusinessService.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Services can be imported using the `id` using the related business service ID, the subscriber type and the subscriber ID separated by a dot, e.g.
//
// ```sh
// $ pulumi import pagerduty:index/businessServiceSubscriber:BusinessServiceSubscriber main PLBP09X.team.PLBP09X
// ```
type BusinessServiceSubscriber struct {
pulumi.CustomResourceState
// The ID of the business service to subscribe to.
BusinessServiceId pulumi.StringOutput `pulumi:"businessServiceId"`
// The ID of the subscriber entity.
SubscriberId pulumi.StringOutput `pulumi:"subscriberId"`
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
SubscriberType pulumi.StringOutput `pulumi:"subscriberType"`
}
// NewBusinessServiceSubscriber registers a new resource with the given unique name, arguments, and options.
func NewBusinessServiceSubscriber(ctx *pulumi.Context,
name string, args *BusinessServiceSubscriberArgs, opts ...pulumi.ResourceOption) (*BusinessServiceSubscriber, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.BusinessServiceId == nil {
return nil, errors.New("invalid value for required argument 'BusinessServiceId'")
}
if args.SubscriberId == nil {
return nil, errors.New("invalid value for required argument 'SubscriberId'")
}
if args.SubscriberType == nil {
return nil, errors.New("invalid value for required argument 'SubscriberType'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource BusinessServiceSubscriber
err := ctx.RegisterResource("pagerduty:index/businessServiceSubscriber:BusinessServiceSubscriber", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBusinessServiceSubscriber gets an existing BusinessServiceSubscriber 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 GetBusinessServiceSubscriber(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BusinessServiceSubscriberState, opts ...pulumi.ResourceOption) (*BusinessServiceSubscriber, error) {
var resource BusinessServiceSubscriber
err := ctx.ReadResource("pagerduty:index/businessServiceSubscriber:BusinessServiceSubscriber", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BusinessServiceSubscriber resources.
type businessServiceSubscriberState struct {
// The ID of the business service to subscribe to.
BusinessServiceId *string `pulumi:"businessServiceId"`
// The ID of the subscriber entity.
SubscriberId *string `pulumi:"subscriberId"`
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
SubscriberType *string `pulumi:"subscriberType"`
}
type BusinessServiceSubscriberState struct {
// The ID of the business service to subscribe to.
BusinessServiceId pulumi.StringPtrInput
// The ID of the subscriber entity.
SubscriberId pulumi.StringPtrInput
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
SubscriberType pulumi.StringPtrInput
}
func (BusinessServiceSubscriberState) ElementType() reflect.Type {
return reflect.TypeOf((*businessServiceSubscriberState)(nil)).Elem()
}
type businessServiceSubscriberArgs struct {
// The ID of the business service to subscribe to.
BusinessServiceId string `pulumi:"businessServiceId"`
// The ID of the subscriber entity.
SubscriberId string `pulumi:"subscriberId"`
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
SubscriberType string `pulumi:"subscriberType"`
}
// The set of arguments for constructing a BusinessServiceSubscriber resource.
type BusinessServiceSubscriberArgs struct {
// The ID of the business service to subscribe to.
BusinessServiceId pulumi.StringInput
// The ID of the subscriber entity.
SubscriberId pulumi.StringInput
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
SubscriberType pulumi.StringInput
}
func (BusinessServiceSubscriberArgs) ElementType() reflect.Type {
return reflect.TypeOf((*businessServiceSubscriberArgs)(nil)).Elem()
}
type BusinessServiceSubscriberInput interface {
pulumi.Input
ToBusinessServiceSubscriberOutput() BusinessServiceSubscriberOutput
ToBusinessServiceSubscriberOutputWithContext(ctx context.Context) BusinessServiceSubscriberOutput
}
func (*BusinessServiceSubscriber) ElementType() reflect.Type {
return reflect.TypeOf((**BusinessServiceSubscriber)(nil)).Elem()
}
func (i *BusinessServiceSubscriber) ToBusinessServiceSubscriberOutput() BusinessServiceSubscriberOutput {
return i.ToBusinessServiceSubscriberOutputWithContext(context.Background())
}
func (i *BusinessServiceSubscriber) ToBusinessServiceSubscriberOutputWithContext(ctx context.Context) BusinessServiceSubscriberOutput {
return pulumi.ToOutputWithContext(ctx, i).(BusinessServiceSubscriberOutput)
}
// BusinessServiceSubscriberArrayInput is an input type that accepts BusinessServiceSubscriberArray and BusinessServiceSubscriberArrayOutput values.
// You can construct a concrete instance of `BusinessServiceSubscriberArrayInput` via:
//
// BusinessServiceSubscriberArray{ BusinessServiceSubscriberArgs{...} }
type BusinessServiceSubscriberArrayInput interface {
pulumi.Input
ToBusinessServiceSubscriberArrayOutput() BusinessServiceSubscriberArrayOutput
ToBusinessServiceSubscriberArrayOutputWithContext(context.Context) BusinessServiceSubscriberArrayOutput
}
type BusinessServiceSubscriberArray []BusinessServiceSubscriberInput
func (BusinessServiceSubscriberArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BusinessServiceSubscriber)(nil)).Elem()
}
func (i BusinessServiceSubscriberArray) ToBusinessServiceSubscriberArrayOutput() BusinessServiceSubscriberArrayOutput {
return i.ToBusinessServiceSubscriberArrayOutputWithContext(context.Background())
}
func (i BusinessServiceSubscriberArray) ToBusinessServiceSubscriberArrayOutputWithContext(ctx context.Context) BusinessServiceSubscriberArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BusinessServiceSubscriberArrayOutput)
}
// BusinessServiceSubscriberMapInput is an input type that accepts BusinessServiceSubscriberMap and BusinessServiceSubscriberMapOutput values.
// You can construct a concrete instance of `BusinessServiceSubscriberMapInput` via:
//
// BusinessServiceSubscriberMap{ "key": BusinessServiceSubscriberArgs{...} }
type BusinessServiceSubscriberMapInput interface {
pulumi.Input
ToBusinessServiceSubscriberMapOutput() BusinessServiceSubscriberMapOutput
ToBusinessServiceSubscriberMapOutputWithContext(context.Context) BusinessServiceSubscriberMapOutput
}
type BusinessServiceSubscriberMap map[string]BusinessServiceSubscriberInput
func (BusinessServiceSubscriberMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BusinessServiceSubscriber)(nil)).Elem()
}
func (i BusinessServiceSubscriberMap) ToBusinessServiceSubscriberMapOutput() BusinessServiceSubscriberMapOutput {
return i.ToBusinessServiceSubscriberMapOutputWithContext(context.Background())
}
func (i BusinessServiceSubscriberMap) ToBusinessServiceSubscriberMapOutputWithContext(ctx context.Context) BusinessServiceSubscriberMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BusinessServiceSubscriberMapOutput)
}
type BusinessServiceSubscriberOutput struct{ *pulumi.OutputState }
func (BusinessServiceSubscriberOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BusinessServiceSubscriber)(nil)).Elem()
}
func (o BusinessServiceSubscriberOutput) ToBusinessServiceSubscriberOutput() BusinessServiceSubscriberOutput {
return o
}
func (o BusinessServiceSubscriberOutput) ToBusinessServiceSubscriberOutputWithContext(ctx context.Context) BusinessServiceSubscriberOutput {
return o
}
// The ID of the business service to subscribe to.
func (o BusinessServiceSubscriberOutput) BusinessServiceId() pulumi.StringOutput {
return o.ApplyT(func(v *BusinessServiceSubscriber) pulumi.StringOutput { return v.BusinessServiceId }).(pulumi.StringOutput)
}
// The ID of the subscriber entity.
func (o BusinessServiceSubscriberOutput) SubscriberId() pulumi.StringOutput {
return o.ApplyT(func(v *BusinessServiceSubscriber) pulumi.StringOutput { return v.SubscriberId }).(pulumi.StringOutput)
}
// Type of subscriber entity in the subscriber assignment. Possible values can be `user` and `team`.
func (o BusinessServiceSubscriberOutput) SubscriberType() pulumi.StringOutput {
return o.ApplyT(func(v *BusinessServiceSubscriber) pulumi.StringOutput { return v.SubscriberType }).(pulumi.StringOutput)
}
type BusinessServiceSubscriberArrayOutput struct{ *pulumi.OutputState }
func (BusinessServiceSubscriberArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BusinessServiceSubscriber)(nil)).Elem()
}
func (o BusinessServiceSubscriberArrayOutput) ToBusinessServiceSubscriberArrayOutput() BusinessServiceSubscriberArrayOutput {
return o
}
func (o BusinessServiceSubscriberArrayOutput) ToBusinessServiceSubscriberArrayOutputWithContext(ctx context.Context) BusinessServiceSubscriberArrayOutput {
return o
}
func (o BusinessServiceSubscriberArrayOutput) Index(i pulumi.IntInput) BusinessServiceSubscriberOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BusinessServiceSubscriber {
return vs[0].([]*BusinessServiceSubscriber)[vs[1].(int)]
}).(BusinessServiceSubscriberOutput)
}
type BusinessServiceSubscriberMapOutput struct{ *pulumi.OutputState }
func (BusinessServiceSubscriberMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BusinessServiceSubscriber)(nil)).Elem()
}
func (o BusinessServiceSubscriberMapOutput) ToBusinessServiceSubscriberMapOutput() BusinessServiceSubscriberMapOutput {
return o
}
func (o BusinessServiceSubscriberMapOutput) ToBusinessServiceSubscriberMapOutputWithContext(ctx context.Context) BusinessServiceSubscriberMapOutput {
return o
}
func (o BusinessServiceSubscriberMapOutput) MapIndex(k pulumi.StringInput) BusinessServiceSubscriberOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BusinessServiceSubscriber {
return vs[0].(map[string]*BusinessServiceSubscriber)[vs[1].(string)]
}).(BusinessServiceSubscriberOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BusinessServiceSubscriberInput)(nil)).Elem(), &BusinessServiceSubscriber{})
pulumi.RegisterInputType(reflect.TypeOf((*BusinessServiceSubscriberArrayInput)(nil)).Elem(), BusinessServiceSubscriberArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BusinessServiceSubscriberMapInput)(nil)).Elem(), BusinessServiceSubscriberMap{})
pulumi.RegisterOutputType(BusinessServiceSubscriberOutput{})
pulumi.RegisterOutputType(BusinessServiceSubscriberArrayOutput{})
pulumi.RegisterOutputType(BusinessServiceSubscriberMapOutput{})
}