-
Notifications
You must be signed in to change notification settings - Fork 2
/
escalationPolicy.go
284 lines (233 loc) · 11.4 KB
/
escalationPolicy.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
// 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"
)
// An [escalation policy](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEyNQ-create-an-escalation-policy) determines what user or schedule will be notified first, second, and so on when an incident is triggered. Escalation policies are used by one or more services.
//
// ## Import
//
// Escalation policies can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import pagerduty:index/escalationPolicy:EscalationPolicy main PLBP09X
// ```
type EscalationPolicy struct {
pulumi.CustomResourceState
Description pulumi.StringOutput `pulumi:"description"`
// The name of the escalation policy.
Name pulumi.StringOutput `pulumi:"name"`
// The number of times the escalation policy will repeat after reaching the end of its escalation.
NumLoops pulumi.IntPtrOutput `pulumi:"numLoops"`
// An Escalation rule block. Escalation rules documented below.
Rules EscalationPolicyRuleArrayOutput `pulumi:"rules"`
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
Teams pulumi.StringPtrOutput `pulumi:"teams"`
}
// NewEscalationPolicy registers a new resource with the given unique name, arguments, and options.
func NewEscalationPolicy(ctx *pulumi.Context,
name string, args *EscalationPolicyArgs, opts ...pulumi.ResourceOption) (*EscalationPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Rules == nil {
return nil, errors.New("invalid value for required argument 'Rules'")
}
if args.Description == nil {
args.Description = pulumi.StringPtr("Managed by Pulumi")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource EscalationPolicy
err := ctx.RegisterResource("pagerduty:index/escalationPolicy:EscalationPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEscalationPolicy gets an existing EscalationPolicy 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 GetEscalationPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EscalationPolicyState, opts ...pulumi.ResourceOption) (*EscalationPolicy, error) {
var resource EscalationPolicy
err := ctx.ReadResource("pagerduty:index/escalationPolicy:EscalationPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EscalationPolicy resources.
type escalationPolicyState struct {
Description *string `pulumi:"description"`
// The name of the escalation policy.
Name *string `pulumi:"name"`
// The number of times the escalation policy will repeat after reaching the end of its escalation.
NumLoops *int `pulumi:"numLoops"`
// An Escalation rule block. Escalation rules documented below.
Rules []EscalationPolicyRule `pulumi:"rules"`
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
Teams *string `pulumi:"teams"`
}
type EscalationPolicyState struct {
Description pulumi.StringPtrInput
// The name of the escalation policy.
Name pulumi.StringPtrInput
// The number of times the escalation policy will repeat after reaching the end of its escalation.
NumLoops pulumi.IntPtrInput
// An Escalation rule block. Escalation rules documented below.
Rules EscalationPolicyRuleArrayInput
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
Teams pulumi.StringPtrInput
}
func (EscalationPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*escalationPolicyState)(nil)).Elem()
}
type escalationPolicyArgs struct {
Description *string `pulumi:"description"`
// The name of the escalation policy.
Name *string `pulumi:"name"`
// The number of times the escalation policy will repeat after reaching the end of its escalation.
NumLoops *int `pulumi:"numLoops"`
// An Escalation rule block. Escalation rules documented below.
Rules []EscalationPolicyRule `pulumi:"rules"`
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
Teams *string `pulumi:"teams"`
}
// The set of arguments for constructing a EscalationPolicy resource.
type EscalationPolicyArgs struct {
Description pulumi.StringPtrInput
// The name of the escalation policy.
Name pulumi.StringPtrInput
// The number of times the escalation policy will repeat after reaching the end of its escalation.
NumLoops pulumi.IntPtrInput
// An Escalation rule block. Escalation rules documented below.
Rules EscalationPolicyRuleArrayInput
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
Teams pulumi.StringPtrInput
}
func (EscalationPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*escalationPolicyArgs)(nil)).Elem()
}
type EscalationPolicyInput interface {
pulumi.Input
ToEscalationPolicyOutput() EscalationPolicyOutput
ToEscalationPolicyOutputWithContext(ctx context.Context) EscalationPolicyOutput
}
func (*EscalationPolicy) ElementType() reflect.Type {
return reflect.TypeOf((**EscalationPolicy)(nil)).Elem()
}
func (i *EscalationPolicy) ToEscalationPolicyOutput() EscalationPolicyOutput {
return i.ToEscalationPolicyOutputWithContext(context.Background())
}
func (i *EscalationPolicy) ToEscalationPolicyOutputWithContext(ctx context.Context) EscalationPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(EscalationPolicyOutput)
}
// EscalationPolicyArrayInput is an input type that accepts EscalationPolicyArray and EscalationPolicyArrayOutput values.
// You can construct a concrete instance of `EscalationPolicyArrayInput` via:
//
// EscalationPolicyArray{ EscalationPolicyArgs{...} }
type EscalationPolicyArrayInput interface {
pulumi.Input
ToEscalationPolicyArrayOutput() EscalationPolicyArrayOutput
ToEscalationPolicyArrayOutputWithContext(context.Context) EscalationPolicyArrayOutput
}
type EscalationPolicyArray []EscalationPolicyInput
func (EscalationPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EscalationPolicy)(nil)).Elem()
}
func (i EscalationPolicyArray) ToEscalationPolicyArrayOutput() EscalationPolicyArrayOutput {
return i.ToEscalationPolicyArrayOutputWithContext(context.Background())
}
func (i EscalationPolicyArray) ToEscalationPolicyArrayOutputWithContext(ctx context.Context) EscalationPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EscalationPolicyArrayOutput)
}
// EscalationPolicyMapInput is an input type that accepts EscalationPolicyMap and EscalationPolicyMapOutput values.
// You can construct a concrete instance of `EscalationPolicyMapInput` via:
//
// EscalationPolicyMap{ "key": EscalationPolicyArgs{...} }
type EscalationPolicyMapInput interface {
pulumi.Input
ToEscalationPolicyMapOutput() EscalationPolicyMapOutput
ToEscalationPolicyMapOutputWithContext(context.Context) EscalationPolicyMapOutput
}
type EscalationPolicyMap map[string]EscalationPolicyInput
func (EscalationPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EscalationPolicy)(nil)).Elem()
}
func (i EscalationPolicyMap) ToEscalationPolicyMapOutput() EscalationPolicyMapOutput {
return i.ToEscalationPolicyMapOutputWithContext(context.Background())
}
func (i EscalationPolicyMap) ToEscalationPolicyMapOutputWithContext(ctx context.Context) EscalationPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EscalationPolicyMapOutput)
}
type EscalationPolicyOutput struct{ *pulumi.OutputState }
func (EscalationPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EscalationPolicy)(nil)).Elem()
}
func (o EscalationPolicyOutput) ToEscalationPolicyOutput() EscalationPolicyOutput {
return o
}
func (o EscalationPolicyOutput) ToEscalationPolicyOutputWithContext(ctx context.Context) EscalationPolicyOutput {
return o
}
func (o EscalationPolicyOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *EscalationPolicy) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// The name of the escalation policy.
func (o EscalationPolicyOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *EscalationPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The number of times the escalation policy will repeat after reaching the end of its escalation.
func (o EscalationPolicyOutput) NumLoops() pulumi.IntPtrOutput {
return o.ApplyT(func(v *EscalationPolicy) pulumi.IntPtrOutput { return v.NumLoops }).(pulumi.IntPtrOutput)
}
// An Escalation rule block. Escalation rules documented below.
func (o EscalationPolicyOutput) Rules() EscalationPolicyRuleArrayOutput {
return o.ApplyT(func(v *EscalationPolicy) EscalationPolicyRuleArrayOutput { return v.Rules }).(EscalationPolicyRuleArrayOutput)
}
// Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the `teams` ability to use this parameter.
func (o EscalationPolicyOutput) Teams() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EscalationPolicy) pulumi.StringPtrOutput { return v.Teams }).(pulumi.StringPtrOutput)
}
type EscalationPolicyArrayOutput struct{ *pulumi.OutputState }
func (EscalationPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EscalationPolicy)(nil)).Elem()
}
func (o EscalationPolicyArrayOutput) ToEscalationPolicyArrayOutput() EscalationPolicyArrayOutput {
return o
}
func (o EscalationPolicyArrayOutput) ToEscalationPolicyArrayOutputWithContext(ctx context.Context) EscalationPolicyArrayOutput {
return o
}
func (o EscalationPolicyArrayOutput) Index(i pulumi.IntInput) EscalationPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EscalationPolicy {
return vs[0].([]*EscalationPolicy)[vs[1].(int)]
}).(EscalationPolicyOutput)
}
type EscalationPolicyMapOutput struct{ *pulumi.OutputState }
func (EscalationPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EscalationPolicy)(nil)).Elem()
}
func (o EscalationPolicyMapOutput) ToEscalationPolicyMapOutput() EscalationPolicyMapOutput {
return o
}
func (o EscalationPolicyMapOutput) ToEscalationPolicyMapOutputWithContext(ctx context.Context) EscalationPolicyMapOutput {
return o
}
func (o EscalationPolicyMapOutput) MapIndex(k pulumi.StringInput) EscalationPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EscalationPolicy {
return vs[0].(map[string]*EscalationPolicy)[vs[1].(string)]
}).(EscalationPolicyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EscalationPolicyInput)(nil)).Elem(), &EscalationPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*EscalationPolicyArrayInput)(nil)).Elem(), EscalationPolicyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EscalationPolicyMapInput)(nil)).Elem(), EscalationPolicyMap{})
pulumi.RegisterOutputType(EscalationPolicyOutput{})
pulumi.RegisterOutputType(EscalationPolicyArrayOutput{})
pulumi.RegisterOutputType(EscalationPolicyMapOutput{})
}