/
teamMembership.go
345 lines (285 loc) · 11.7 KB
/
teamMembership.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package pagerduty
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A [team membership](https://v2.developer.pagerduty.com/v2/page/api-reference#!/Teams/put_teams_id_users_user_id) manages memberships within a team.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-pagerduty/sdk/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// fooUser, err := pagerduty.NewUser(ctx, "fooUser", &pagerduty.UserArgs{
// Email: pulumi.String("foo@bar.com"),
// })
// if err != nil {
// return err
// }
// fooTeam, err := pagerduty.NewTeam(ctx, "fooTeam", &pagerduty.TeamArgs{
// Description: pulumi.String("foo"),
// })
// if err != nil {
// return err
// }
// _, err = pagerduty.NewTeamMembership(ctx, "fooTeamMembership", &pagerduty.TeamMembershipArgs{
// UserId: fooUser.ID(),
// TeamId: fooTeam.ID(),
// Role: pulumi.String("manager"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Team memberships can be imported using the `user_id` and `team_id`, e.g.
//
// ```sh
// $ pulumi import pagerduty:index/teamMembership:TeamMembership main PLBP09X:PLB09Z
// ```
type TeamMembership struct {
pulumi.CustomResourceState
// The role of the user in the team. One of `observer`, `responder`, or `manager`. Defaults to `manager`. These roles match up to user roles in the following ways:
// * User role of `user` is a Team role of `manager`
// * User role of `limitedUser` is a Team role of `responder`
Role pulumi.StringPtrOutput `pulumi:"role"`
// The ID of the team in which the user will belong.
TeamId pulumi.StringOutput `pulumi:"teamId"`
// The ID of the user to add to the team.
UserId pulumi.StringOutput `pulumi:"userId"`
}
// NewTeamMembership registers a new resource with the given unique name, arguments, and options.
func NewTeamMembership(ctx *pulumi.Context,
name string, args *TeamMembershipArgs, opts ...pulumi.ResourceOption) (*TeamMembership, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.TeamId == nil {
return nil, errors.New("invalid value for required argument 'TeamId'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
var resource TeamMembership
err := ctx.RegisterResource("pagerduty:index/teamMembership:TeamMembership", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTeamMembership gets an existing TeamMembership 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 GetTeamMembership(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TeamMembershipState, opts ...pulumi.ResourceOption) (*TeamMembership, error) {
var resource TeamMembership
err := ctx.ReadResource("pagerduty:index/teamMembership:TeamMembership", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TeamMembership resources.
type teamMembershipState struct {
// The role of the user in the team. One of `observer`, `responder`, or `manager`. Defaults to `manager`. These roles match up to user roles in the following ways:
// * User role of `user` is a Team role of `manager`
// * User role of `limitedUser` is a Team role of `responder`
Role *string `pulumi:"role"`
// The ID of the team in which the user will belong.
TeamId *string `pulumi:"teamId"`
// The ID of the user to add to the team.
UserId *string `pulumi:"userId"`
}
type TeamMembershipState struct {
// The role of the user in the team. One of `observer`, `responder`, or `manager`. Defaults to `manager`. These roles match up to user roles in the following ways:
// * User role of `user` is a Team role of `manager`
// * User role of `limitedUser` is a Team role of `responder`
Role pulumi.StringPtrInput
// The ID of the team in which the user will belong.
TeamId pulumi.StringPtrInput
// The ID of the user to add to the team.
UserId pulumi.StringPtrInput
}
func (TeamMembershipState) ElementType() reflect.Type {
return reflect.TypeOf((*teamMembershipState)(nil)).Elem()
}
type teamMembershipArgs struct {
// The role of the user in the team. One of `observer`, `responder`, or `manager`. Defaults to `manager`. These roles match up to user roles in the following ways:
// * User role of `user` is a Team role of `manager`
// * User role of `limitedUser` is a Team role of `responder`
Role *string `pulumi:"role"`
// The ID of the team in which the user will belong.
TeamId string `pulumi:"teamId"`
// The ID of the user to add to the team.
UserId string `pulumi:"userId"`
}
// The set of arguments for constructing a TeamMembership resource.
type TeamMembershipArgs struct {
// The role of the user in the team. One of `observer`, `responder`, or `manager`. Defaults to `manager`. These roles match up to user roles in the following ways:
// * User role of `user` is a Team role of `manager`
// * User role of `limitedUser` is a Team role of `responder`
Role pulumi.StringPtrInput
// The ID of the team in which the user will belong.
TeamId pulumi.StringInput
// The ID of the user to add to the team.
UserId pulumi.StringInput
}
func (TeamMembershipArgs) ElementType() reflect.Type {
return reflect.TypeOf((*teamMembershipArgs)(nil)).Elem()
}
type TeamMembershipInput interface {
pulumi.Input
ToTeamMembershipOutput() TeamMembershipOutput
ToTeamMembershipOutputWithContext(ctx context.Context) TeamMembershipOutput
}
func (*TeamMembership) ElementType() reflect.Type {
return reflect.TypeOf((*TeamMembership)(nil))
}
func (i *TeamMembership) ToTeamMembershipOutput() TeamMembershipOutput {
return i.ToTeamMembershipOutputWithContext(context.Background())
}
func (i *TeamMembership) ToTeamMembershipOutputWithContext(ctx context.Context) TeamMembershipOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMembershipOutput)
}
func (i *TeamMembership) ToTeamMembershipPtrOutput() TeamMembershipPtrOutput {
return i.ToTeamMembershipPtrOutputWithContext(context.Background())
}
func (i *TeamMembership) ToTeamMembershipPtrOutputWithContext(ctx context.Context) TeamMembershipPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMembershipPtrOutput)
}
type TeamMembershipPtrInput interface {
pulumi.Input
ToTeamMembershipPtrOutput() TeamMembershipPtrOutput
ToTeamMembershipPtrOutputWithContext(ctx context.Context) TeamMembershipPtrOutput
}
type teamMembershipPtrType TeamMembershipArgs
func (*teamMembershipPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**TeamMembership)(nil))
}
func (i *teamMembershipPtrType) ToTeamMembershipPtrOutput() TeamMembershipPtrOutput {
return i.ToTeamMembershipPtrOutputWithContext(context.Background())
}
func (i *teamMembershipPtrType) ToTeamMembershipPtrOutputWithContext(ctx context.Context) TeamMembershipPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMembershipPtrOutput)
}
// TeamMembershipArrayInput is an input type that accepts TeamMembershipArray and TeamMembershipArrayOutput values.
// You can construct a concrete instance of `TeamMembershipArrayInput` via:
//
// TeamMembershipArray{ TeamMembershipArgs{...} }
type TeamMembershipArrayInput interface {
pulumi.Input
ToTeamMembershipArrayOutput() TeamMembershipArrayOutput
ToTeamMembershipArrayOutputWithContext(context.Context) TeamMembershipArrayOutput
}
type TeamMembershipArray []TeamMembershipInput
func (TeamMembershipArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*TeamMembership)(nil))
}
func (i TeamMembershipArray) ToTeamMembershipArrayOutput() TeamMembershipArrayOutput {
return i.ToTeamMembershipArrayOutputWithContext(context.Background())
}
func (i TeamMembershipArray) ToTeamMembershipArrayOutputWithContext(ctx context.Context) TeamMembershipArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMembershipArrayOutput)
}
// TeamMembershipMapInput is an input type that accepts TeamMembershipMap and TeamMembershipMapOutput values.
// You can construct a concrete instance of `TeamMembershipMapInput` via:
//
// TeamMembershipMap{ "key": TeamMembershipArgs{...} }
type TeamMembershipMapInput interface {
pulumi.Input
ToTeamMembershipMapOutput() TeamMembershipMapOutput
ToTeamMembershipMapOutputWithContext(context.Context) TeamMembershipMapOutput
}
type TeamMembershipMap map[string]TeamMembershipInput
func (TeamMembershipMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*TeamMembership)(nil))
}
func (i TeamMembershipMap) ToTeamMembershipMapOutput() TeamMembershipMapOutput {
return i.ToTeamMembershipMapOutputWithContext(context.Background())
}
func (i TeamMembershipMap) ToTeamMembershipMapOutputWithContext(ctx context.Context) TeamMembershipMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMembershipMapOutput)
}
type TeamMembershipOutput struct {
*pulumi.OutputState
}
func (TeamMembershipOutput) ElementType() reflect.Type {
return reflect.TypeOf((*TeamMembership)(nil))
}
func (o TeamMembershipOutput) ToTeamMembershipOutput() TeamMembershipOutput {
return o
}
func (o TeamMembershipOutput) ToTeamMembershipOutputWithContext(ctx context.Context) TeamMembershipOutput {
return o
}
func (o TeamMembershipOutput) ToTeamMembershipPtrOutput() TeamMembershipPtrOutput {
return o.ToTeamMembershipPtrOutputWithContext(context.Background())
}
func (o TeamMembershipOutput) ToTeamMembershipPtrOutputWithContext(ctx context.Context) TeamMembershipPtrOutput {
return o.ApplyT(func(v TeamMembership) *TeamMembership {
return &v
}).(TeamMembershipPtrOutput)
}
type TeamMembershipPtrOutput struct {
*pulumi.OutputState
}
func (TeamMembershipPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TeamMembership)(nil))
}
func (o TeamMembershipPtrOutput) ToTeamMembershipPtrOutput() TeamMembershipPtrOutput {
return o
}
func (o TeamMembershipPtrOutput) ToTeamMembershipPtrOutputWithContext(ctx context.Context) TeamMembershipPtrOutput {
return o
}
type TeamMembershipArrayOutput struct{ *pulumi.OutputState }
func (TeamMembershipArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]TeamMembership)(nil))
}
func (o TeamMembershipArrayOutput) ToTeamMembershipArrayOutput() TeamMembershipArrayOutput {
return o
}
func (o TeamMembershipArrayOutput) ToTeamMembershipArrayOutputWithContext(ctx context.Context) TeamMembershipArrayOutput {
return o
}
func (o TeamMembershipArrayOutput) Index(i pulumi.IntInput) TeamMembershipOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) TeamMembership {
return vs[0].([]TeamMembership)[vs[1].(int)]
}).(TeamMembershipOutput)
}
type TeamMembershipMapOutput struct{ *pulumi.OutputState }
func (TeamMembershipMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]TeamMembership)(nil))
}
func (o TeamMembershipMapOutput) ToTeamMembershipMapOutput() TeamMembershipMapOutput {
return o
}
func (o TeamMembershipMapOutput) ToTeamMembershipMapOutputWithContext(ctx context.Context) TeamMembershipMapOutput {
return o
}
func (o TeamMembershipMapOutput) MapIndex(k pulumi.StringInput) TeamMembershipOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) TeamMembership {
return vs[0].(map[string]TeamMembership)[vs[1].(string)]
}).(TeamMembershipOutput)
}
func init() {
pulumi.RegisterOutputType(TeamMembershipOutput{})
pulumi.RegisterOutputType(TeamMembershipPtrOutput{})
pulumi.RegisterOutputType(TeamMembershipArrayOutput{})
pulumi.RegisterOutputType(TeamMembershipMapOutput{})
}