/
streamConsumer.go
302 lines (252 loc) · 10.6 KB
/
streamConsumer.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
// 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 kinesis
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to manage a Kinesis Stream Consumer.
//
// > **Note:** You can register up to 20 consumers per stream. A given consumer can only be registered with one stream at a time.
//
// For more details, see the [Amazon Kinesis Stream Consumer Documentation](https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-consumers.html).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/kinesis"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleStream, err := kinesis.NewStream(ctx, "exampleStream", &kinesis.StreamArgs{
// ShardCount: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// _, err = kinesis.NewStreamConsumer(ctx, "exampleStreamConsumer", &kinesis.StreamConsumerArgs{
// StreamArn: exampleStream.Arn,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Kinesis Stream Consumers can be imported using the Amazon Resource Name (ARN) e.g.,
//
// ```sh
//
// $ pulumi import aws:kinesis/streamConsumer:StreamConsumer example arn:aws:kinesis:us-west-2:123456789012:stream/example/consumer/example:1616044553
//
// ```
//
// [1]https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-consumers.html
type StreamConsumer struct {
pulumi.CustomResourceState
// Amazon Resource Name (ARN) of the stream consumer.
Arn pulumi.StringOutput `pulumi:"arn"`
// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
CreationTimestamp pulumi.StringOutput `pulumi:"creationTimestamp"`
// Name of the stream consumer.
Name pulumi.StringOutput `pulumi:"name"`
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
StreamArn pulumi.StringOutput `pulumi:"streamArn"`
}
// NewStreamConsumer registers a new resource with the given unique name, arguments, and options.
func NewStreamConsumer(ctx *pulumi.Context,
name string, args *StreamConsumerArgs, opts ...pulumi.ResourceOption) (*StreamConsumer, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.StreamArn == nil {
return nil, errors.New("invalid value for required argument 'StreamArn'")
}
var resource StreamConsumer
err := ctx.RegisterResource("aws:kinesis/streamConsumer:StreamConsumer", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetStreamConsumer gets an existing StreamConsumer 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 GetStreamConsumer(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *StreamConsumerState, opts ...pulumi.ResourceOption) (*StreamConsumer, error) {
var resource StreamConsumer
err := ctx.ReadResource("aws:kinesis/streamConsumer:StreamConsumer", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering StreamConsumer resources.
type streamConsumerState struct {
// Amazon Resource Name (ARN) of the stream consumer.
Arn *string `pulumi:"arn"`
// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
CreationTimestamp *string `pulumi:"creationTimestamp"`
// Name of the stream consumer.
Name *string `pulumi:"name"`
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
StreamArn *string `pulumi:"streamArn"`
}
type StreamConsumerState struct {
// Amazon Resource Name (ARN) of the stream consumer.
Arn pulumi.StringPtrInput
// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
CreationTimestamp pulumi.StringPtrInput
// Name of the stream consumer.
Name pulumi.StringPtrInput
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
StreamArn pulumi.StringPtrInput
}
func (StreamConsumerState) ElementType() reflect.Type {
return reflect.TypeOf((*streamConsumerState)(nil)).Elem()
}
type streamConsumerArgs struct {
// Name of the stream consumer.
Name *string `pulumi:"name"`
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
StreamArn string `pulumi:"streamArn"`
}
// The set of arguments for constructing a StreamConsumer resource.
type StreamConsumerArgs struct {
// Name of the stream consumer.
Name pulumi.StringPtrInput
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
StreamArn pulumi.StringInput
}
func (StreamConsumerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*streamConsumerArgs)(nil)).Elem()
}
type StreamConsumerInput interface {
pulumi.Input
ToStreamConsumerOutput() StreamConsumerOutput
ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput
}
func (*StreamConsumer) ElementType() reflect.Type {
return reflect.TypeOf((**StreamConsumer)(nil)).Elem()
}
func (i *StreamConsumer) ToStreamConsumerOutput() StreamConsumerOutput {
return i.ToStreamConsumerOutputWithContext(context.Background())
}
func (i *StreamConsumer) ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput {
return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerOutput)
}
// StreamConsumerArrayInput is an input type that accepts StreamConsumerArray and StreamConsumerArrayOutput values.
// You can construct a concrete instance of `StreamConsumerArrayInput` via:
//
// StreamConsumerArray{ StreamConsumerArgs{...} }
type StreamConsumerArrayInput interface {
pulumi.Input
ToStreamConsumerArrayOutput() StreamConsumerArrayOutput
ToStreamConsumerArrayOutputWithContext(context.Context) StreamConsumerArrayOutput
}
type StreamConsumerArray []StreamConsumerInput
func (StreamConsumerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*StreamConsumer)(nil)).Elem()
}
func (i StreamConsumerArray) ToStreamConsumerArrayOutput() StreamConsumerArrayOutput {
return i.ToStreamConsumerArrayOutputWithContext(context.Background())
}
func (i StreamConsumerArray) ToStreamConsumerArrayOutputWithContext(ctx context.Context) StreamConsumerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerArrayOutput)
}
// StreamConsumerMapInput is an input type that accepts StreamConsumerMap and StreamConsumerMapOutput values.
// You can construct a concrete instance of `StreamConsumerMapInput` via:
//
// StreamConsumerMap{ "key": StreamConsumerArgs{...} }
type StreamConsumerMapInput interface {
pulumi.Input
ToStreamConsumerMapOutput() StreamConsumerMapOutput
ToStreamConsumerMapOutputWithContext(context.Context) StreamConsumerMapOutput
}
type StreamConsumerMap map[string]StreamConsumerInput
func (StreamConsumerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*StreamConsumer)(nil)).Elem()
}
func (i StreamConsumerMap) ToStreamConsumerMapOutput() StreamConsumerMapOutput {
return i.ToStreamConsumerMapOutputWithContext(context.Background())
}
func (i StreamConsumerMap) ToStreamConsumerMapOutputWithContext(ctx context.Context) StreamConsumerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerMapOutput)
}
type StreamConsumerOutput struct{ *pulumi.OutputState }
func (StreamConsumerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**StreamConsumer)(nil)).Elem()
}
func (o StreamConsumerOutput) ToStreamConsumerOutput() StreamConsumerOutput {
return o
}
func (o StreamConsumerOutput) ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput {
return o
}
// Amazon Resource Name (ARN) of the stream consumer.
func (o StreamConsumerOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
func (o StreamConsumerOutput) CreationTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.CreationTimestamp }).(pulumi.StringOutput)
}
// Name of the stream consumer.
func (o StreamConsumerOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
func (o StreamConsumerOutput) StreamArn() pulumi.StringOutput {
return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.StreamArn }).(pulumi.StringOutput)
}
type StreamConsumerArrayOutput struct{ *pulumi.OutputState }
func (StreamConsumerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*StreamConsumer)(nil)).Elem()
}
func (o StreamConsumerArrayOutput) ToStreamConsumerArrayOutput() StreamConsumerArrayOutput {
return o
}
func (o StreamConsumerArrayOutput) ToStreamConsumerArrayOutputWithContext(ctx context.Context) StreamConsumerArrayOutput {
return o
}
func (o StreamConsumerArrayOutput) Index(i pulumi.IntInput) StreamConsumerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *StreamConsumer {
return vs[0].([]*StreamConsumer)[vs[1].(int)]
}).(StreamConsumerOutput)
}
type StreamConsumerMapOutput struct{ *pulumi.OutputState }
func (StreamConsumerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*StreamConsumer)(nil)).Elem()
}
func (o StreamConsumerMapOutput) ToStreamConsumerMapOutput() StreamConsumerMapOutput {
return o
}
func (o StreamConsumerMapOutput) ToStreamConsumerMapOutputWithContext(ctx context.Context) StreamConsumerMapOutput {
return o
}
func (o StreamConsumerMapOutput) MapIndex(k pulumi.StringInput) StreamConsumerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *StreamConsumer {
return vs[0].(map[string]*StreamConsumer)[vs[1].(string)]
}).(StreamConsumerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerInput)(nil)).Elem(), &StreamConsumer{})
pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerArrayInput)(nil)).Elem(), StreamConsumerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerMapInput)(nil)).Elem(), StreamConsumerMap{})
pulumi.RegisterOutputType(StreamConsumerOutput{})
pulumi.RegisterOutputType(StreamConsumerArrayOutput{})
pulumi.RegisterOutputType(StreamConsumerMapOutput{})
}