/
eventStream.go
298 lines (252 loc) · 10.5 KB
/
eventStream.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
// *** 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 pinpoint
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Pinpoint Event Stream resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/kinesis"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/pinpoint"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// app, err := pinpoint.NewApp(ctx, "app", nil)
// if err != nil {
// return err
// }
// testStream, err := kinesis.NewStream(ctx, "testStream", &kinesis.StreamArgs{
// ShardCount: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// testRole, err := iam.NewRole(ctx, "testRole", &iam.RoleArgs{
// AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": \"sts:AssumeRole\",\n", " \"Principal\": {\n", " \"Service\": \"pinpoint.us-east-1.amazonaws.com\"\n", " },\n", " \"Effect\": \"Allow\",\n", " \"Sid\": \"\"\n", " }\n", " ]\n", "}\n")),
// })
// if err != nil {
// return err
// }
// _, err = pinpoint.NewEventStream(ctx, "stream", &pinpoint.EventStreamArgs{
// ApplicationId: app.ApplicationId,
// DestinationStreamArn: testStream.Arn,
// RoleArn: testRole.Arn,
// })
// if err != nil {
// return err
// }
// _, err = iam.NewRolePolicy(ctx, "testRolePolicy", &iam.RolePolicyArgs{
// Role: testRole.ID(),
// Policy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": {\n", " \"Action\": [\n", " \"kinesis:PutRecords\",\n", " \"kinesis:DescribeStream\"\n", " ],\n", " \"Effect\": \"Allow\",\n", " \"Resource\": [\n", " \"arn:aws:kinesis:us-east-1:*:*/*\"\n", " ]\n", " }\n", "}\n")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Pinpoint Event Stream can be imported using the `application-id`, e.g.,
//
// ```sh
// $ pulumi import aws:pinpoint/eventStream:EventStream stream application-id
// ```
type EventStream struct {
pulumi.CustomResourceState
// The application ID.
ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
// The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
DestinationStreamArn pulumi.StringOutput `pulumi:"destinationStreamArn"`
// The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
RoleArn pulumi.StringOutput `pulumi:"roleArn"`
}
// NewEventStream registers a new resource with the given unique name, arguments, and options.
func NewEventStream(ctx *pulumi.Context,
name string, args *EventStreamArgs, opts ...pulumi.ResourceOption) (*EventStream, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApplicationId == nil {
return nil, errors.New("invalid value for required argument 'ApplicationId'")
}
if args.DestinationStreamArn == nil {
return nil, errors.New("invalid value for required argument 'DestinationStreamArn'")
}
if args.RoleArn == nil {
return nil, errors.New("invalid value for required argument 'RoleArn'")
}
var resource EventStream
err := ctx.RegisterResource("aws:pinpoint/eventStream:EventStream", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEventStream gets an existing EventStream 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 GetEventStream(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EventStreamState, opts ...pulumi.ResourceOption) (*EventStream, error) {
var resource EventStream
err := ctx.ReadResource("aws:pinpoint/eventStream:EventStream", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EventStream resources.
type eventStreamState struct {
// The application ID.
ApplicationId *string `pulumi:"applicationId"`
// The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
DestinationStreamArn *string `pulumi:"destinationStreamArn"`
// The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
RoleArn *string `pulumi:"roleArn"`
}
type EventStreamState struct {
// The application ID.
ApplicationId pulumi.StringPtrInput
// The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
DestinationStreamArn pulumi.StringPtrInput
// The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
RoleArn pulumi.StringPtrInput
}
func (EventStreamState) ElementType() reflect.Type {
return reflect.TypeOf((*eventStreamState)(nil)).Elem()
}
type eventStreamArgs struct {
// The application ID.
ApplicationId string `pulumi:"applicationId"`
// The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
DestinationStreamArn string `pulumi:"destinationStreamArn"`
// The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
RoleArn string `pulumi:"roleArn"`
}
// The set of arguments for constructing a EventStream resource.
type EventStreamArgs struct {
// The application ID.
ApplicationId pulumi.StringInput
// The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
DestinationStreamArn pulumi.StringInput
// The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
RoleArn pulumi.StringInput
}
func (EventStreamArgs) ElementType() reflect.Type {
return reflect.TypeOf((*eventStreamArgs)(nil)).Elem()
}
type EventStreamInput interface {
pulumi.Input
ToEventStreamOutput() EventStreamOutput
ToEventStreamOutputWithContext(ctx context.Context) EventStreamOutput
}
func (*EventStream) ElementType() reflect.Type {
return reflect.TypeOf((**EventStream)(nil)).Elem()
}
func (i *EventStream) ToEventStreamOutput() EventStreamOutput {
return i.ToEventStreamOutputWithContext(context.Background())
}
func (i *EventStream) ToEventStreamOutputWithContext(ctx context.Context) EventStreamOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventStreamOutput)
}
// EventStreamArrayInput is an input type that accepts EventStreamArray and EventStreamArrayOutput values.
// You can construct a concrete instance of `EventStreamArrayInput` via:
//
// EventStreamArray{ EventStreamArgs{...} }
type EventStreamArrayInput interface {
pulumi.Input
ToEventStreamArrayOutput() EventStreamArrayOutput
ToEventStreamArrayOutputWithContext(context.Context) EventStreamArrayOutput
}
type EventStreamArray []EventStreamInput
func (EventStreamArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EventStream)(nil)).Elem()
}
func (i EventStreamArray) ToEventStreamArrayOutput() EventStreamArrayOutput {
return i.ToEventStreamArrayOutputWithContext(context.Background())
}
func (i EventStreamArray) ToEventStreamArrayOutputWithContext(ctx context.Context) EventStreamArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventStreamArrayOutput)
}
// EventStreamMapInput is an input type that accepts EventStreamMap and EventStreamMapOutput values.
// You can construct a concrete instance of `EventStreamMapInput` via:
//
// EventStreamMap{ "key": EventStreamArgs{...} }
type EventStreamMapInput interface {
pulumi.Input
ToEventStreamMapOutput() EventStreamMapOutput
ToEventStreamMapOutputWithContext(context.Context) EventStreamMapOutput
}
type EventStreamMap map[string]EventStreamInput
func (EventStreamMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EventStream)(nil)).Elem()
}
func (i EventStreamMap) ToEventStreamMapOutput() EventStreamMapOutput {
return i.ToEventStreamMapOutputWithContext(context.Background())
}
func (i EventStreamMap) ToEventStreamMapOutputWithContext(ctx context.Context) EventStreamMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EventStreamMapOutput)
}
type EventStreamOutput struct{ *pulumi.OutputState }
func (EventStreamOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EventStream)(nil)).Elem()
}
func (o EventStreamOutput) ToEventStreamOutput() EventStreamOutput {
return o
}
func (o EventStreamOutput) ToEventStreamOutputWithContext(ctx context.Context) EventStreamOutput {
return o
}
type EventStreamArrayOutput struct{ *pulumi.OutputState }
func (EventStreamArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EventStream)(nil)).Elem()
}
func (o EventStreamArrayOutput) ToEventStreamArrayOutput() EventStreamArrayOutput {
return o
}
func (o EventStreamArrayOutput) ToEventStreamArrayOutputWithContext(ctx context.Context) EventStreamArrayOutput {
return o
}
func (o EventStreamArrayOutput) Index(i pulumi.IntInput) EventStreamOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventStream {
return vs[0].([]*EventStream)[vs[1].(int)]
}).(EventStreamOutput)
}
type EventStreamMapOutput struct{ *pulumi.OutputState }
func (EventStreamMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EventStream)(nil)).Elem()
}
func (o EventStreamMapOutput) ToEventStreamMapOutput() EventStreamMapOutput {
return o
}
func (o EventStreamMapOutput) ToEventStreamMapOutputWithContext(ctx context.Context) EventStreamMapOutput {
return o
}
func (o EventStreamMapOutput) MapIndex(k pulumi.StringInput) EventStreamOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventStream {
return vs[0].(map[string]*EventStream)[vs[1].(string)]
}).(EventStreamOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EventStreamInput)(nil)).Elem(), &EventStream{})
pulumi.RegisterInputType(reflect.TypeOf((*EventStreamArrayInput)(nil)).Elem(), EventStreamArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EventStreamMapInput)(nil)).Elem(), EventStreamMap{})
pulumi.RegisterOutputType(EventStreamOutput{})
pulumi.RegisterOutputType(EventStreamArrayOutput{})
pulumi.RegisterOutputType(EventStreamMapOutput{})
}