/
eventBus.go
331 lines (280 loc) · 12.1 KB
/
eventBus.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
// 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 cloudwatch
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an EventBridge event bus resource.
//
// > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudwatch"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudwatch.NewEventBus(ctx, "messenger", nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudwatch"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// examplepartnerEventSource, err := cloudwatch.GetEventSource(ctx, &cloudwatch.GetEventSourceArgs{
// NamePrefix: pulumi.StringRef("aws.partner/examplepartner.com"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = cloudwatch.NewEventBus(ctx, "examplepartnerEventBus", &cloudwatch.EventBusArgs{
// EventSourceName: *pulumi.String(examplepartnerEventSource.Name),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// # EventBridge event buses can be imported using the `name` (which can also be a partner event source name), e.g., console
//
// ```sh
//
// $ pulumi import aws:cloudwatch/eventBus:EventBus messenger chat-messages
//
// ```
type EventBus struct {
pulumi.CustomResourceState
// The Amazon Resource Name (ARN) of the event bus.
Arn pulumi.StringOutput `pulumi:"arn"`
// The partner event source that the new event bus will be matched with. Must match `name`.
EventSourceName pulumi.StringPtrOutput `pulumi:"eventSourceName"`
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
Name pulumi.StringOutput `pulumi:"name"`
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewEventBus registers a new resource with the given unique name, arguments, and options.
func NewEventBus(ctx *pulumi.Context,
name string, args *EventBusArgs, opts ...pulumi.ResourceOption) (*EventBus, error) {
if args == nil {
args = &EventBusArgs{}
}
var resource EventBus
err := ctx.RegisterResource("aws:cloudwatch/eventBus:EventBus", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEventBus gets an existing EventBus 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 GetEventBus(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EventBusState, opts ...pulumi.ResourceOption) (*EventBus, error) {
var resource EventBus
err := ctx.ReadResource("aws:cloudwatch/eventBus:EventBus", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EventBus resources.
type eventBusState struct {
// The Amazon Resource Name (ARN) of the event bus.
Arn *string `pulumi:"arn"`
// The partner event source that the new event bus will be matched with. Must match `name`.
EventSourceName *string `pulumi:"eventSourceName"`
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
Name *string `pulumi:"name"`
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll map[string]string `pulumi:"tagsAll"`
}
type EventBusState struct {
// The Amazon Resource Name (ARN) of the event bus.
Arn pulumi.StringPtrInput
// The partner event source that the new event bus will be matched with. Must match `name`.
EventSourceName pulumi.StringPtrInput
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
Name pulumi.StringPtrInput
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapInput
}
func (EventBusState) ElementType() reflect.Type {
return reflect.TypeOf((*eventBusState)(nil)).Elem()
}
type eventBusArgs struct {
// The partner event source that the new event bus will be matched with. Must match `name`.
EventSourceName *string `pulumi:"eventSourceName"`
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
Name *string `pulumi:"name"`
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a EventBus resource.
type EventBusArgs struct {
// The partner event source that the new event bus will be matched with. Must match `name`.
EventSourceName pulumi.StringPtrInput
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
Name pulumi.StringPtrInput
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
}
func (EventBusArgs) ElementType() reflect.Type {
return reflect.TypeOf((*eventBusArgs)(nil)).Elem()
}
type EventBusInput interface {
pulumi.Input
ToEventBusOutput() EventBusOutput
ToEventBusOutputWithContext(ctx context.Context) EventBusOutput
}
func (*EventBus) ElementType() reflect.Type {
return reflect.TypeOf((**EventBus)(nil)).Elem()
}
func (i *EventBus) ToEventBusOutput() EventBusOutput {
return i.ToEventBusOutputWithContext(context.Background())
}
func (i *EventBus) ToEventBusOutputWithContext(ctx context.Context) EventBusOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventBusOutput)
}
// EventBusArrayInput is an input type that accepts EventBusArray and EventBusArrayOutput values.
// You can construct a concrete instance of `EventBusArrayInput` via:
//
// EventBusArray{ EventBusArgs{...} }
type EventBusArrayInput interface {
pulumi.Input
ToEventBusArrayOutput() EventBusArrayOutput
ToEventBusArrayOutputWithContext(context.Context) EventBusArrayOutput
}
type EventBusArray []EventBusInput
func (EventBusArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EventBus)(nil)).Elem()
}
func (i EventBusArray) ToEventBusArrayOutput() EventBusArrayOutput {
return i.ToEventBusArrayOutputWithContext(context.Background())
}
func (i EventBusArray) ToEventBusArrayOutputWithContext(ctx context.Context) EventBusArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventBusArrayOutput)
}
// EventBusMapInput is an input type that accepts EventBusMap and EventBusMapOutput values.
// You can construct a concrete instance of `EventBusMapInput` via:
//
// EventBusMap{ "key": EventBusArgs{...} }
type EventBusMapInput interface {
pulumi.Input
ToEventBusMapOutput() EventBusMapOutput
ToEventBusMapOutputWithContext(context.Context) EventBusMapOutput
}
type EventBusMap map[string]EventBusInput
func (EventBusMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EventBus)(nil)).Elem()
}
func (i EventBusMap) ToEventBusMapOutput() EventBusMapOutput {
return i.ToEventBusMapOutputWithContext(context.Background())
}
func (i EventBusMap) ToEventBusMapOutputWithContext(ctx context.Context) EventBusMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventBusMapOutput)
}
type EventBusOutput struct{ *pulumi.OutputState }
func (EventBusOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EventBus)(nil)).Elem()
}
func (o EventBusOutput) ToEventBusOutput() EventBusOutput {
return o
}
func (o EventBusOutput) ToEventBusOutputWithContext(ctx context.Context) EventBusOutput {
return o
}
// The Amazon Resource Name (ARN) of the event bus.
func (o EventBusOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *EventBus) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The partner event source that the new event bus will be matched with. Must match `name`.
func (o EventBusOutput) EventSourceName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EventBus) pulumi.StringPtrOutput { return v.EventSourceName }).(pulumi.StringPtrOutput)
}
// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
func (o EventBusOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *EventBus) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
func (o EventBusOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *EventBus) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
func (o EventBusOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *EventBus) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
type EventBusArrayOutput struct{ *pulumi.OutputState }
func (EventBusArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EventBus)(nil)).Elem()
}
func (o EventBusArrayOutput) ToEventBusArrayOutput() EventBusArrayOutput {
return o
}
func (o EventBusArrayOutput) ToEventBusArrayOutputWithContext(ctx context.Context) EventBusArrayOutput {
return o
}
func (o EventBusArrayOutput) Index(i pulumi.IntInput) EventBusOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventBus {
return vs[0].([]*EventBus)[vs[1].(int)]
}).(EventBusOutput)
}
type EventBusMapOutput struct{ *pulumi.OutputState }
func (EventBusMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EventBus)(nil)).Elem()
}
func (o EventBusMapOutput) ToEventBusMapOutput() EventBusMapOutput {
return o
}
func (o EventBusMapOutput) ToEventBusMapOutputWithContext(ctx context.Context) EventBusMapOutput {
return o
}
func (o EventBusMapOutput) MapIndex(k pulumi.StringInput) EventBusOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventBus {
return vs[0].(map[string]*EventBus)[vs[1].(string)]
}).(EventBusOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EventBusInput)(nil)).Elem(), &EventBus{})
pulumi.RegisterInputType(reflect.TypeOf((*EventBusArrayInput)(nil)).Elem(), EventBusArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EventBusMapInput)(nil)).Elem(), EventBusMap{})
pulumi.RegisterOutputType(EventBusOutput{})
pulumi.RegisterOutputType(EventBusArrayOutput{})
pulumi.RegisterOutputType(EventBusMapOutput{})
}