-
Notifications
You must be signed in to change notification settings - Fork 2
/
team.go
295 lines (244 loc) · 8.43 KB
/
team.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
// 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"
"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A [team](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODIyMg-create-a-team) is a collection of users and escalation policies that represent a group of people within an organization.
//
// The account must have the `teams` ability to use the following resource.
//
// ## Example Usage
//
// ```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 {
// parent, err := pagerduty.NewTeam(ctx, "parent", &pagerduty.TeamArgs{
// Name: pulumi.String("Product Development"),
// Description: pulumi.String("Product and Engineering"),
// })
// if err != nil {
// return err
// }
// _, err = pagerduty.NewTeam(ctx, "example", &pagerduty.TeamArgs{
// Name: pulumi.String("Engineering"),
// Description: pulumi.String("All engineering"),
// Parent: parent.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Teams can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import pagerduty:index/team:Team main PLBP09X
// ```
type Team struct {
pulumi.CustomResourceState
DefaultRole pulumi.StringOutput `pulumi:"defaultRole"`
Description pulumi.StringOutput `pulumi:"description"`
// URL at which the entity is uniquely displayed in the Web app
HtmlUrl pulumi.StringOutput `pulumi:"htmlUrl"`
Name pulumi.StringOutput `pulumi:"name"`
Parent pulumi.StringPtrOutput `pulumi:"parent"`
}
// NewTeam registers a new resource with the given unique name, arguments, and options.
func NewTeam(ctx *pulumi.Context,
name string, args *TeamArgs, opts ...pulumi.ResourceOption) (*Team, error) {
if args == nil {
args = &TeamArgs{}
}
if args.Description == nil {
args.Description = pulumi.StringPtr("Managed by Pulumi")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Team
err := ctx.RegisterResource("pagerduty:index/team:Team", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTeam gets an existing Team 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 GetTeam(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TeamState, opts ...pulumi.ResourceOption) (*Team, error) {
var resource Team
err := ctx.ReadResource("pagerduty:index/team:Team", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Team resources.
type teamState struct {
DefaultRole *string `pulumi:"defaultRole"`
Description *string `pulumi:"description"`
// URL at which the entity is uniquely displayed in the Web app
HtmlUrl *string `pulumi:"htmlUrl"`
Name *string `pulumi:"name"`
Parent *string `pulumi:"parent"`
}
type TeamState struct {
DefaultRole pulumi.StringPtrInput
Description pulumi.StringPtrInput
// URL at which the entity is uniquely displayed in the Web app
HtmlUrl pulumi.StringPtrInput
Name pulumi.StringPtrInput
Parent pulumi.StringPtrInput
}
func (TeamState) ElementType() reflect.Type {
return reflect.TypeOf((*teamState)(nil)).Elem()
}
type teamArgs struct {
DefaultRole *string `pulumi:"defaultRole"`
Description *string `pulumi:"description"`
Name *string `pulumi:"name"`
Parent *string `pulumi:"parent"`
}
// The set of arguments for constructing a Team resource.
type TeamArgs struct {
DefaultRole pulumi.StringPtrInput
Description pulumi.StringPtrInput
Name pulumi.StringPtrInput
Parent pulumi.StringPtrInput
}
func (TeamArgs) ElementType() reflect.Type {
return reflect.TypeOf((*teamArgs)(nil)).Elem()
}
type TeamInput interface {
pulumi.Input
ToTeamOutput() TeamOutput
ToTeamOutputWithContext(ctx context.Context) TeamOutput
}
func (*Team) ElementType() reflect.Type {
return reflect.TypeOf((**Team)(nil)).Elem()
}
func (i *Team) ToTeamOutput() TeamOutput {
return i.ToTeamOutputWithContext(context.Background())
}
func (i *Team) ToTeamOutputWithContext(ctx context.Context) TeamOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamOutput)
}
// TeamArrayInput is an input type that accepts TeamArray and TeamArrayOutput values.
// You can construct a concrete instance of `TeamArrayInput` via:
//
// TeamArray{ TeamArgs{...} }
type TeamArrayInput interface {
pulumi.Input
ToTeamArrayOutput() TeamArrayOutput
ToTeamArrayOutputWithContext(context.Context) TeamArrayOutput
}
type TeamArray []TeamInput
func (TeamArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Team)(nil)).Elem()
}
func (i TeamArray) ToTeamArrayOutput() TeamArrayOutput {
return i.ToTeamArrayOutputWithContext(context.Background())
}
func (i TeamArray) ToTeamArrayOutputWithContext(ctx context.Context) TeamArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamArrayOutput)
}
// TeamMapInput is an input type that accepts TeamMap and TeamMapOutput values.
// You can construct a concrete instance of `TeamMapInput` via:
//
// TeamMap{ "key": TeamArgs{...} }
type TeamMapInput interface {
pulumi.Input
ToTeamMapOutput() TeamMapOutput
ToTeamMapOutputWithContext(context.Context) TeamMapOutput
}
type TeamMap map[string]TeamInput
func (TeamMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Team)(nil)).Elem()
}
func (i TeamMap) ToTeamMapOutput() TeamMapOutput {
return i.ToTeamMapOutputWithContext(context.Background())
}
func (i TeamMap) ToTeamMapOutputWithContext(ctx context.Context) TeamMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TeamMapOutput)
}
type TeamOutput struct{ *pulumi.OutputState }
func (TeamOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Team)(nil)).Elem()
}
func (o TeamOutput) ToTeamOutput() TeamOutput {
return o
}
func (o TeamOutput) ToTeamOutputWithContext(ctx context.Context) TeamOutput {
return o
}
func (o TeamOutput) DefaultRole() pulumi.StringOutput {
return o.ApplyT(func(v *Team) pulumi.StringOutput { return v.DefaultRole }).(pulumi.StringOutput)
}
func (o TeamOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Team) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// URL at which the entity is uniquely displayed in the Web app
func (o TeamOutput) HtmlUrl() pulumi.StringOutput {
return o.ApplyT(func(v *Team) pulumi.StringOutput { return v.HtmlUrl }).(pulumi.StringOutput)
}
func (o TeamOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Team) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o TeamOutput) Parent() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Team) pulumi.StringPtrOutput { return v.Parent }).(pulumi.StringPtrOutput)
}
type TeamArrayOutput struct{ *pulumi.OutputState }
func (TeamArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Team)(nil)).Elem()
}
func (o TeamArrayOutput) ToTeamArrayOutput() TeamArrayOutput {
return o
}
func (o TeamArrayOutput) ToTeamArrayOutputWithContext(ctx context.Context) TeamArrayOutput {
return o
}
func (o TeamArrayOutput) Index(i pulumi.IntInput) TeamOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Team {
return vs[0].([]*Team)[vs[1].(int)]
}).(TeamOutput)
}
type TeamMapOutput struct{ *pulumi.OutputState }
func (TeamMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Team)(nil)).Elem()
}
func (o TeamMapOutput) ToTeamMapOutput() TeamMapOutput {
return o
}
func (o TeamMapOutput) ToTeamMapOutputWithContext(ctx context.Context) TeamMapOutput {
return o
}
func (o TeamMapOutput) MapIndex(k pulumi.StringInput) TeamOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Team {
return vs[0].(map[string]*Team)[vs[1].(string)]
}).(TeamOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TeamInput)(nil)).Elem(), &Team{})
pulumi.RegisterInputType(reflect.TypeOf((*TeamArrayInput)(nil)).Elem(), TeamArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TeamMapInput)(nil)).Elem(), TeamMap{})
pulumi.RegisterOutputType(TeamOutput{})
pulumi.RegisterOutputType(TeamArrayOutput{})
pulumi.RegisterOutputType(TeamMapOutput{})
}