/
alertManagerDefinition.go
263 lines (217 loc) · 10.5 KB
/
alertManagerDefinition.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
// *** 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 amp
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an Amazon Managed Service for Prometheus (AMP) Alert Manager Definition
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/amp"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// demoWorkspace, err := amp.NewWorkspace(ctx, "demoWorkspace", nil)
// if err != nil {
// return err
// }
// _, err = amp.NewAlertManagerDefinition(ctx, "demoAlertManagerDefinition", &.AlertManagerDefinitionArgs{
// WorkspaceId: demoWorkspace.ID(),
// Definition: pulumi.String(fmt.Sprintf("%v%v%v%v%v", "alertmanager_config: |\n", " route:\n", " receiver: 'default'\n", " receivers:\n", " - name: 'default'\n")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// The prometheus alert manager definition can be imported using the workspace identifier, e.g.,
//
// ```sh
// $ pulumi import aws:amp/alertManagerDefinition:AlertManagerDefinition demo ws-C6DCB907-F2D7-4D96-957B-66691F865D8B
// ```
type AlertManagerDefinition struct {
pulumi.CustomResourceState
// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
Definition pulumi.StringOutput `pulumi:"definition"`
// The id of the prometheus workspace the alert manager definition should be linked to
WorkspaceId pulumi.StringOutput `pulumi:"workspaceId"`
}
// NewAlertManagerDefinition registers a new resource with the given unique name, arguments, and options.
func NewAlertManagerDefinition(ctx *pulumi.Context,
name string, args *AlertManagerDefinitionArgs, opts ...pulumi.ResourceOption) (*AlertManagerDefinition, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Definition == nil {
return nil, errors.New("invalid value for required argument 'Definition'")
}
if args.WorkspaceId == nil {
return nil, errors.New("invalid value for required argument 'WorkspaceId'")
}
var resource AlertManagerDefinition
err := ctx.RegisterResource("aws:amp/alertManagerDefinition:AlertManagerDefinition", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAlertManagerDefinition gets an existing AlertManagerDefinition 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 GetAlertManagerDefinition(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AlertManagerDefinitionState, opts ...pulumi.ResourceOption) (*AlertManagerDefinition, error) {
var resource AlertManagerDefinition
err := ctx.ReadResource("aws:amp/alertManagerDefinition:AlertManagerDefinition", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AlertManagerDefinition resources.
type alertManagerDefinitionState struct {
// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
Definition *string `pulumi:"definition"`
// The id of the prometheus workspace the alert manager definition should be linked to
WorkspaceId *string `pulumi:"workspaceId"`
}
type AlertManagerDefinitionState struct {
// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
Definition pulumi.StringPtrInput
// The id of the prometheus workspace the alert manager definition should be linked to
WorkspaceId pulumi.StringPtrInput
}
func (AlertManagerDefinitionState) ElementType() reflect.Type {
return reflect.TypeOf((*alertManagerDefinitionState)(nil)).Elem()
}
type alertManagerDefinitionArgs struct {
// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
Definition string `pulumi:"definition"`
// The id of the prometheus workspace the alert manager definition should be linked to
WorkspaceId string `pulumi:"workspaceId"`
}
// The set of arguments for constructing a AlertManagerDefinition resource.
type AlertManagerDefinitionArgs struct {
// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
Definition pulumi.StringInput
// The id of the prometheus workspace the alert manager definition should be linked to
WorkspaceId pulumi.StringInput
}
func (AlertManagerDefinitionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*alertManagerDefinitionArgs)(nil)).Elem()
}
type AlertManagerDefinitionInput interface {
pulumi.Input
ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput
ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput
}
func (*AlertManagerDefinition) ElementType() reflect.Type {
return reflect.TypeOf((**AlertManagerDefinition)(nil)).Elem()
}
func (i *AlertManagerDefinition) ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput {
return i.ToAlertManagerDefinitionOutputWithContext(context.Background())
}
func (i *AlertManagerDefinition) ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput {
return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionOutput)
}
// AlertManagerDefinitionArrayInput is an input type that accepts AlertManagerDefinitionArray and AlertManagerDefinitionArrayOutput values.
// You can construct a concrete instance of `AlertManagerDefinitionArrayInput` via:
//
// AlertManagerDefinitionArray{ AlertManagerDefinitionArgs{...} }
type AlertManagerDefinitionArrayInput interface {
pulumi.Input
ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput
ToAlertManagerDefinitionArrayOutputWithContext(context.Context) AlertManagerDefinitionArrayOutput
}
type AlertManagerDefinitionArray []AlertManagerDefinitionInput
func (AlertManagerDefinitionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AlertManagerDefinition)(nil)).Elem()
}
func (i AlertManagerDefinitionArray) ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput {
return i.ToAlertManagerDefinitionArrayOutputWithContext(context.Background())
}
func (i AlertManagerDefinitionArray) ToAlertManagerDefinitionArrayOutputWithContext(ctx context.Context) AlertManagerDefinitionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionArrayOutput)
}
// AlertManagerDefinitionMapInput is an input type that accepts AlertManagerDefinitionMap and AlertManagerDefinitionMapOutput values.
// You can construct a concrete instance of `AlertManagerDefinitionMapInput` via:
//
// AlertManagerDefinitionMap{ "key": AlertManagerDefinitionArgs{...} }
type AlertManagerDefinitionMapInput interface {
pulumi.Input
ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput
ToAlertManagerDefinitionMapOutputWithContext(context.Context) AlertManagerDefinitionMapOutput
}
type AlertManagerDefinitionMap map[string]AlertManagerDefinitionInput
func (AlertManagerDefinitionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AlertManagerDefinition)(nil)).Elem()
}
func (i AlertManagerDefinitionMap) ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput {
return i.ToAlertManagerDefinitionMapOutputWithContext(context.Background())
}
func (i AlertManagerDefinitionMap) ToAlertManagerDefinitionMapOutputWithContext(ctx context.Context) AlertManagerDefinitionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionMapOutput)
}
type AlertManagerDefinitionOutput struct{ *pulumi.OutputState }
func (AlertManagerDefinitionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AlertManagerDefinition)(nil)).Elem()
}
func (o AlertManagerDefinitionOutput) ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput {
return o
}
func (o AlertManagerDefinitionOutput) ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput {
return o
}
type AlertManagerDefinitionArrayOutput struct{ *pulumi.OutputState }
func (AlertManagerDefinitionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AlertManagerDefinition)(nil)).Elem()
}
func (o AlertManagerDefinitionArrayOutput) ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput {
return o
}
func (o AlertManagerDefinitionArrayOutput) ToAlertManagerDefinitionArrayOutputWithContext(ctx context.Context) AlertManagerDefinitionArrayOutput {
return o
}
func (o AlertManagerDefinitionArrayOutput) Index(i pulumi.IntInput) AlertManagerDefinitionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AlertManagerDefinition {
return vs[0].([]*AlertManagerDefinition)[vs[1].(int)]
}).(AlertManagerDefinitionOutput)
}
type AlertManagerDefinitionMapOutput struct{ *pulumi.OutputState }
func (AlertManagerDefinitionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AlertManagerDefinition)(nil)).Elem()
}
func (o AlertManagerDefinitionMapOutput) ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput {
return o
}
func (o AlertManagerDefinitionMapOutput) ToAlertManagerDefinitionMapOutputWithContext(ctx context.Context) AlertManagerDefinitionMapOutput {
return o
}
func (o AlertManagerDefinitionMapOutput) MapIndex(k pulumi.StringInput) AlertManagerDefinitionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AlertManagerDefinition {
return vs[0].(map[string]*AlertManagerDefinition)[vs[1].(string)]
}).(AlertManagerDefinitionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionInput)(nil)).Elem(), &AlertManagerDefinition{})
pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionArrayInput)(nil)).Elem(), AlertManagerDefinitionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionMapInput)(nil)).Elem(), AlertManagerDefinitionMap{})
pulumi.RegisterOutputType(AlertManagerDefinitionOutput{})
pulumi.RegisterOutputType(AlertManagerDefinitionArrayOutput{})
pulumi.RegisterOutputType(AlertManagerDefinitionMapOutput{})
}