/
kinesisStreamingDestination.go
301 lines (253 loc) · 12.3 KB
/
kinesisStreamingDestination.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
// 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 dynamodb
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Enables a [Kinesis streaming destination](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/kds.html) for data replication of a DynamoDB table.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{
// Name: pulumi.String("orders"),
// HashKey: pulumi.String("id"),
// Attributes: dynamodb.TableAttributeArray{
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("id"),
// Type: pulumi.String("S"),
// },
// },
// })
// if err != nil {
// return err
// }
// exampleStream, err := kinesis.NewStream(ctx, "example", &kinesis.StreamArgs{
// Name: pulumi.String("order_item_changes"),
// ShardCount: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// _, err = dynamodb.NewKinesisStreamingDestination(ctx, "example", &dynamodb.KinesisStreamingDestinationArgs{
// StreamArn: exampleStream.Arn,
// TableName: example.Name,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import DynamoDB Kinesis Streaming Destinations using the `table_name` and `stream_arn` separated by `,`. For example:
//
// ```sh
// $ pulumi import aws:dynamodb/kinesisStreamingDestination:KinesisStreamingDestination example example,arn:aws:kinesis:us-east-1:111122223333:exampleStreamName
// ```
type KinesisStreamingDestination struct {
pulumi.CustomResourceState
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
StreamArn pulumi.StringOutput `pulumi:"streamArn"`
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
TableName pulumi.StringOutput `pulumi:"tableName"`
}
// NewKinesisStreamingDestination registers a new resource with the given unique name, arguments, and options.
func NewKinesisStreamingDestination(ctx *pulumi.Context,
name string, args *KinesisStreamingDestinationArgs, opts ...pulumi.ResourceOption) (*KinesisStreamingDestination, 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'")
}
if args.TableName == nil {
return nil, errors.New("invalid value for required argument 'TableName'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource KinesisStreamingDestination
err := ctx.RegisterResource("aws:dynamodb/kinesisStreamingDestination:KinesisStreamingDestination", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKinesisStreamingDestination gets an existing KinesisStreamingDestination 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 GetKinesisStreamingDestination(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KinesisStreamingDestinationState, opts ...pulumi.ResourceOption) (*KinesisStreamingDestination, error) {
var resource KinesisStreamingDestination
err := ctx.ReadResource("aws:dynamodb/kinesisStreamingDestination:KinesisStreamingDestination", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering KinesisStreamingDestination resources.
type kinesisStreamingDestinationState struct {
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
StreamArn *string `pulumi:"streamArn"`
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
TableName *string `pulumi:"tableName"`
}
type KinesisStreamingDestinationState struct {
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
StreamArn pulumi.StringPtrInput
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
TableName pulumi.StringPtrInput
}
func (KinesisStreamingDestinationState) ElementType() reflect.Type {
return reflect.TypeOf((*kinesisStreamingDestinationState)(nil)).Elem()
}
type kinesisStreamingDestinationArgs struct {
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
StreamArn string `pulumi:"streamArn"`
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
TableName string `pulumi:"tableName"`
}
// The set of arguments for constructing a KinesisStreamingDestination resource.
type KinesisStreamingDestinationArgs struct {
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
StreamArn pulumi.StringInput
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
TableName pulumi.StringInput
}
func (KinesisStreamingDestinationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*kinesisStreamingDestinationArgs)(nil)).Elem()
}
type KinesisStreamingDestinationInput interface {
pulumi.Input
ToKinesisStreamingDestinationOutput() KinesisStreamingDestinationOutput
ToKinesisStreamingDestinationOutputWithContext(ctx context.Context) KinesisStreamingDestinationOutput
}
func (*KinesisStreamingDestination) ElementType() reflect.Type {
return reflect.TypeOf((**KinesisStreamingDestination)(nil)).Elem()
}
func (i *KinesisStreamingDestination) ToKinesisStreamingDestinationOutput() KinesisStreamingDestinationOutput {
return i.ToKinesisStreamingDestinationOutputWithContext(context.Background())
}
func (i *KinesisStreamingDestination) ToKinesisStreamingDestinationOutputWithContext(ctx context.Context) KinesisStreamingDestinationOutput {
return pulumi.ToOutputWithContext(ctx, i).(KinesisStreamingDestinationOutput)
}
// KinesisStreamingDestinationArrayInput is an input type that accepts KinesisStreamingDestinationArray and KinesisStreamingDestinationArrayOutput values.
// You can construct a concrete instance of `KinesisStreamingDestinationArrayInput` via:
//
// KinesisStreamingDestinationArray{ KinesisStreamingDestinationArgs{...} }
type KinesisStreamingDestinationArrayInput interface {
pulumi.Input
ToKinesisStreamingDestinationArrayOutput() KinesisStreamingDestinationArrayOutput
ToKinesisStreamingDestinationArrayOutputWithContext(context.Context) KinesisStreamingDestinationArrayOutput
}
type KinesisStreamingDestinationArray []KinesisStreamingDestinationInput
func (KinesisStreamingDestinationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KinesisStreamingDestination)(nil)).Elem()
}
func (i KinesisStreamingDestinationArray) ToKinesisStreamingDestinationArrayOutput() KinesisStreamingDestinationArrayOutput {
return i.ToKinesisStreamingDestinationArrayOutputWithContext(context.Background())
}
func (i KinesisStreamingDestinationArray) ToKinesisStreamingDestinationArrayOutputWithContext(ctx context.Context) KinesisStreamingDestinationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(KinesisStreamingDestinationArrayOutput)
}
// KinesisStreamingDestinationMapInput is an input type that accepts KinesisStreamingDestinationMap and KinesisStreamingDestinationMapOutput values.
// You can construct a concrete instance of `KinesisStreamingDestinationMapInput` via:
//
// KinesisStreamingDestinationMap{ "key": KinesisStreamingDestinationArgs{...} }
type KinesisStreamingDestinationMapInput interface {
pulumi.Input
ToKinesisStreamingDestinationMapOutput() KinesisStreamingDestinationMapOutput
ToKinesisStreamingDestinationMapOutputWithContext(context.Context) KinesisStreamingDestinationMapOutput
}
type KinesisStreamingDestinationMap map[string]KinesisStreamingDestinationInput
func (KinesisStreamingDestinationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KinesisStreamingDestination)(nil)).Elem()
}
func (i KinesisStreamingDestinationMap) ToKinesisStreamingDestinationMapOutput() KinesisStreamingDestinationMapOutput {
return i.ToKinesisStreamingDestinationMapOutputWithContext(context.Background())
}
func (i KinesisStreamingDestinationMap) ToKinesisStreamingDestinationMapOutputWithContext(ctx context.Context) KinesisStreamingDestinationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(KinesisStreamingDestinationMapOutput)
}
type KinesisStreamingDestinationOutput struct{ *pulumi.OutputState }
func (KinesisStreamingDestinationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KinesisStreamingDestination)(nil)).Elem()
}
func (o KinesisStreamingDestinationOutput) ToKinesisStreamingDestinationOutput() KinesisStreamingDestinationOutput {
return o
}
func (o KinesisStreamingDestinationOutput) ToKinesisStreamingDestinationOutputWithContext(ctx context.Context) KinesisStreamingDestinationOutput {
return o
}
// The ARN for a Kinesis data stream. This must exist in the same account and region as the DynamoDB table.
func (o KinesisStreamingDestinationOutput) StreamArn() pulumi.StringOutput {
return o.ApplyT(func(v *KinesisStreamingDestination) pulumi.StringOutput { return v.StreamArn }).(pulumi.StringOutput)
}
// The name of the DynamoDB table. There
// can only be one Kinesis streaming destination for a given DynamoDB table.
func (o KinesisStreamingDestinationOutput) TableName() pulumi.StringOutput {
return o.ApplyT(func(v *KinesisStreamingDestination) pulumi.StringOutput { return v.TableName }).(pulumi.StringOutput)
}
type KinesisStreamingDestinationArrayOutput struct{ *pulumi.OutputState }
func (KinesisStreamingDestinationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KinesisStreamingDestination)(nil)).Elem()
}
func (o KinesisStreamingDestinationArrayOutput) ToKinesisStreamingDestinationArrayOutput() KinesisStreamingDestinationArrayOutput {
return o
}
func (o KinesisStreamingDestinationArrayOutput) ToKinesisStreamingDestinationArrayOutputWithContext(ctx context.Context) KinesisStreamingDestinationArrayOutput {
return o
}
func (o KinesisStreamingDestinationArrayOutput) Index(i pulumi.IntInput) KinesisStreamingDestinationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KinesisStreamingDestination {
return vs[0].([]*KinesisStreamingDestination)[vs[1].(int)]
}).(KinesisStreamingDestinationOutput)
}
type KinesisStreamingDestinationMapOutput struct{ *pulumi.OutputState }
func (KinesisStreamingDestinationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KinesisStreamingDestination)(nil)).Elem()
}
func (o KinesisStreamingDestinationMapOutput) ToKinesisStreamingDestinationMapOutput() KinesisStreamingDestinationMapOutput {
return o
}
func (o KinesisStreamingDestinationMapOutput) ToKinesisStreamingDestinationMapOutputWithContext(ctx context.Context) KinesisStreamingDestinationMapOutput {
return o
}
func (o KinesisStreamingDestinationMapOutput) MapIndex(k pulumi.StringInput) KinesisStreamingDestinationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KinesisStreamingDestination {
return vs[0].(map[string]*KinesisStreamingDestination)[vs[1].(string)]
}).(KinesisStreamingDestinationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*KinesisStreamingDestinationInput)(nil)).Elem(), &KinesisStreamingDestination{})
pulumi.RegisterInputType(reflect.TypeOf((*KinesisStreamingDestinationArrayInput)(nil)).Elem(), KinesisStreamingDestinationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*KinesisStreamingDestinationMapInput)(nil)).Elem(), KinesisStreamingDestinationMap{})
pulumi.RegisterOutputType(KinesisStreamingDestinationOutput{})
pulumi.RegisterOutputType(KinesisStreamingDestinationArrayOutput{})
pulumi.RegisterOutputType(KinesisStreamingDestinationMapOutput{})
}