/
ruleset.go
292 lines (242 loc) · 8.67 KB
/
ruleset.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
// 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/v3/go/pagerduty/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-pagerduty/sdk/v3/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// fooTeam, err := pagerduty.NewTeam(ctx, "fooTeam", nil)
// if err != nil {
// return err
// }
// _, err = pagerduty.NewRuleset(ctx, "fooRuleset", &pagerduty.RulesetArgs{
// Team: &pagerduty.RulesetTeamArgs{
// Id: fooTeam.ID(),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Rulesets can be imported using the `id`, e.g.
//
// ```sh
//
// $ pulumi import pagerduty:index/ruleset:Ruleset main 19acac92-027a-4ea0-b06c-bbf516519601
//
// ```
type Ruleset struct {
pulumi.CustomResourceState
// Name of the ruleset.
Name pulumi.StringOutput `pulumi:"name"`
// Routing keys routed to this ruleset.
RoutingKeys pulumi.StringArrayOutput `pulumi:"routingKeys"`
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
Team RulesetTeamPtrOutput `pulumi:"team"`
// Type of ruleset. Currently, only sets to `global`.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewRuleset registers a new resource with the given unique name, arguments, and options.
func NewRuleset(ctx *pulumi.Context,
name string, args *RulesetArgs, opts ...pulumi.ResourceOption) (*Ruleset, error) {
if args == nil {
args = &RulesetArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Ruleset
err := ctx.RegisterResource("pagerduty:index/ruleset:Ruleset", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRuleset gets an existing Ruleset 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 GetRuleset(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RulesetState, opts ...pulumi.ResourceOption) (*Ruleset, error) {
var resource Ruleset
err := ctx.ReadResource("pagerduty:index/ruleset:Ruleset", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Ruleset resources.
type rulesetState struct {
// Name of the ruleset.
Name *string `pulumi:"name"`
// Routing keys routed to this ruleset.
RoutingKeys []string `pulumi:"routingKeys"`
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
Team *RulesetTeam `pulumi:"team"`
// Type of ruleset. Currently, only sets to `global`.
Type *string `pulumi:"type"`
}
type RulesetState struct {
// Name of the ruleset.
Name pulumi.StringPtrInput
// Routing keys routed to this ruleset.
RoutingKeys pulumi.StringArrayInput
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
Team RulesetTeamPtrInput
// Type of ruleset. Currently, only sets to `global`.
Type pulumi.StringPtrInput
}
func (RulesetState) ElementType() reflect.Type {
return reflect.TypeOf((*rulesetState)(nil)).Elem()
}
type rulesetArgs struct {
// Name of the ruleset.
Name *string `pulumi:"name"`
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
Team *RulesetTeam `pulumi:"team"`
}
// The set of arguments for constructing a Ruleset resource.
type RulesetArgs struct {
// Name of the ruleset.
Name pulumi.StringPtrInput
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
Team RulesetTeamPtrInput
}
func (RulesetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*rulesetArgs)(nil)).Elem()
}
type RulesetInput interface {
pulumi.Input
ToRulesetOutput() RulesetOutput
ToRulesetOutputWithContext(ctx context.Context) RulesetOutput
}
func (*Ruleset) ElementType() reflect.Type {
return reflect.TypeOf((**Ruleset)(nil)).Elem()
}
func (i *Ruleset) ToRulesetOutput() RulesetOutput {
return i.ToRulesetOutputWithContext(context.Background())
}
func (i *Ruleset) ToRulesetOutputWithContext(ctx context.Context) RulesetOutput {
return pulumi.ToOutputWithContext(ctx, i).(RulesetOutput)
}
// RulesetArrayInput is an input type that accepts RulesetArray and RulesetArrayOutput values.
// You can construct a concrete instance of `RulesetArrayInput` via:
//
// RulesetArray{ RulesetArgs{...} }
type RulesetArrayInput interface {
pulumi.Input
ToRulesetArrayOutput() RulesetArrayOutput
ToRulesetArrayOutputWithContext(context.Context) RulesetArrayOutput
}
type RulesetArray []RulesetInput
func (RulesetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Ruleset)(nil)).Elem()
}
func (i RulesetArray) ToRulesetArrayOutput() RulesetArrayOutput {
return i.ToRulesetArrayOutputWithContext(context.Background())
}
func (i RulesetArray) ToRulesetArrayOutputWithContext(ctx context.Context) RulesetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RulesetArrayOutput)
}
// RulesetMapInput is an input type that accepts RulesetMap and RulesetMapOutput values.
// You can construct a concrete instance of `RulesetMapInput` via:
//
// RulesetMap{ "key": RulesetArgs{...} }
type RulesetMapInput interface {
pulumi.Input
ToRulesetMapOutput() RulesetMapOutput
ToRulesetMapOutputWithContext(context.Context) RulesetMapOutput
}
type RulesetMap map[string]RulesetInput
func (RulesetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Ruleset)(nil)).Elem()
}
func (i RulesetMap) ToRulesetMapOutput() RulesetMapOutput {
return i.ToRulesetMapOutputWithContext(context.Background())
}
func (i RulesetMap) ToRulesetMapOutputWithContext(ctx context.Context) RulesetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RulesetMapOutput)
}
type RulesetOutput struct{ *pulumi.OutputState }
func (RulesetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Ruleset)(nil)).Elem()
}
func (o RulesetOutput) ToRulesetOutput() RulesetOutput {
return o
}
func (o RulesetOutput) ToRulesetOutputWithContext(ctx context.Context) RulesetOutput {
return o
}
// Name of the ruleset.
func (o RulesetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Ruleset) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Routing keys routed to this ruleset.
func (o RulesetOutput) RoutingKeys() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Ruleset) pulumi.StringArrayOutput { return v.RoutingKeys }).(pulumi.StringArrayOutput)
}
// Reference to the team that owns the ruleset. If none is specified, only admins have access.
func (o RulesetOutput) Team() RulesetTeamPtrOutput {
return o.ApplyT(func(v *Ruleset) RulesetTeamPtrOutput { return v.Team }).(RulesetTeamPtrOutput)
}
// Type of ruleset. Currently, only sets to `global`.
func (o RulesetOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *Ruleset) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type RulesetArrayOutput struct{ *pulumi.OutputState }
func (RulesetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Ruleset)(nil)).Elem()
}
func (o RulesetArrayOutput) ToRulesetArrayOutput() RulesetArrayOutput {
return o
}
func (o RulesetArrayOutput) ToRulesetArrayOutputWithContext(ctx context.Context) RulesetArrayOutput {
return o
}
func (o RulesetArrayOutput) Index(i pulumi.IntInput) RulesetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Ruleset {
return vs[0].([]*Ruleset)[vs[1].(int)]
}).(RulesetOutput)
}
type RulesetMapOutput struct{ *pulumi.OutputState }
func (RulesetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Ruleset)(nil)).Elem()
}
func (o RulesetMapOutput) ToRulesetMapOutput() RulesetMapOutput {
return o
}
func (o RulesetMapOutput) ToRulesetMapOutputWithContext(ctx context.Context) RulesetMapOutput {
return o
}
func (o RulesetMapOutput) MapIndex(k pulumi.StringInput) RulesetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Ruleset {
return vs[0].(map[string]*Ruleset)[vs[1].(string)]
}).(RulesetOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RulesetInput)(nil)).Elem(), &Ruleset{})
pulumi.RegisterInputType(reflect.TypeOf((*RulesetArrayInput)(nil)).Elem(), RulesetArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RulesetMapInput)(nil)).Elem(), RulesetMap{})
pulumi.RegisterOutputType(RulesetOutput{})
pulumi.RegisterOutputType(RulesetArrayOutput{})
pulumi.RegisterOutputType(RulesetMapOutput{})
}