/
replicationTask.go
372 lines (326 loc) · 19.6 KB
/
replicationTask.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// *** 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 dms
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a DMS (Data Migration Service) replication task resource. DMS replication tasks can be created, updated, deleted, and imported.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/dms"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := dms.NewReplicationTask(ctx, "test", &dms.ReplicationTaskArgs{
// CdcStartTime: pulumi.String("1484346880"),
// MigrationType: pulumi.String("full-load"),
// ReplicationInstanceArn: pulumi.Any(aws_dms_replication_instance.Test - dms - replication - instance - tf.Replication_instance_arn),
// ReplicationTaskId: pulumi.String("test-dms-replication-task-tf"),
// ReplicationTaskSettings: pulumi.String("..."),
// SourceEndpointArn: pulumi.Any(aws_dms_endpoint.Test - dms - source - endpoint - tf.Endpoint_arn),
// TableMappings: pulumi.String(fmt.Sprintf("%v%v%v%v%v", "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"1\",\"object-locator\":{\"schema-name\":\"", "%", "\",\"table-name\":\"", "%", "\"},\"rule-action\":\"include\"}]}")),
// Tags: pulumi.StringMap{
// "Name": pulumi.String("test"),
// },
// TargetEndpointArn: pulumi.Any(aws_dms_endpoint.Test - dms - target - endpoint - tf.Endpoint_arn),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Replication tasks can be imported using the `replication_task_id`, e.g.,
//
// ```sh
// $ pulumi import aws:dms/replicationTask:ReplicationTask test test-dms-replication-task-tf
// ```
type ReplicationTask struct {
pulumi.CustomResourceState
// Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see [Determining a CDC native start point](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native).
CdcStartPosition pulumi.StringPtrOutput `pulumi:"cdcStartPosition"`
// The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.
CdcStartTime pulumi.StringPtrOutput `pulumi:"cdcStartTime"`
// The migration type. Can be one of `full-load | cdc | full-load-and-cdc`.
MigrationType pulumi.StringOutput `pulumi:"migrationType"`
// The Amazon Resource Name (ARN) of the replication instance.
ReplicationInstanceArn pulumi.StringOutput `pulumi:"replicationInstanceArn"`
// The Amazon Resource Name (ARN) for the replication task.
ReplicationTaskArn pulumi.StringOutput `pulumi:"replicationTaskArn"`
// The replication task identifier.
ReplicationTaskId pulumi.StringOutput `pulumi:"replicationTaskId"`
// An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html).
ReplicationTaskSettings pulumi.StringPtrOutput `pulumi:"replicationTaskSettings"`
// The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint.
SourceEndpointArn pulumi.StringOutput `pulumi:"sourceEndpointArn"`
// An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html)
TableMappings pulumi.StringOutput `pulumi:"tableMappings"`
// 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 .
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// The Amazon Resource Name (ARN) string that uniquely identifies the target endpoint.
TargetEndpointArn pulumi.StringOutput `pulumi:"targetEndpointArn"`
}
// NewReplicationTask registers a new resource with the given unique name, arguments, and options.
func NewReplicationTask(ctx *pulumi.Context,
name string, args *ReplicationTaskArgs, opts ...pulumi.ResourceOption) (*ReplicationTask, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.MigrationType == nil {
return nil, errors.New("invalid value for required argument 'MigrationType'")
}
if args.ReplicationInstanceArn == nil {
return nil, errors.New("invalid value for required argument 'ReplicationInstanceArn'")
}
if args.ReplicationTaskId == nil {
return nil, errors.New("invalid value for required argument 'ReplicationTaskId'")
}
if args.SourceEndpointArn == nil {
return nil, errors.New("invalid value for required argument 'SourceEndpointArn'")
}
if args.TableMappings == nil {
return nil, errors.New("invalid value for required argument 'TableMappings'")
}
if args.TargetEndpointArn == nil {
return nil, errors.New("invalid value for required argument 'TargetEndpointArn'")
}
var resource ReplicationTask
err := ctx.RegisterResource("aws:dms/replicationTask:ReplicationTask", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetReplicationTask gets an existing ReplicationTask 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 GetReplicationTask(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ReplicationTaskState, opts ...pulumi.ResourceOption) (*ReplicationTask, error) {
var resource ReplicationTask
err := ctx.ReadResource("aws:dms/replicationTask:ReplicationTask", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ReplicationTask resources.
type replicationTaskState struct {
// Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see [Determining a CDC native start point](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native).
CdcStartPosition *string `pulumi:"cdcStartPosition"`
// The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.
CdcStartTime *string `pulumi:"cdcStartTime"`
// The migration type. Can be one of `full-load | cdc | full-load-and-cdc`.
MigrationType *string `pulumi:"migrationType"`
// The Amazon Resource Name (ARN) of the replication instance.
ReplicationInstanceArn *string `pulumi:"replicationInstanceArn"`
// The Amazon Resource Name (ARN) for the replication task.
ReplicationTaskArn *string `pulumi:"replicationTaskArn"`
// The replication task identifier.
ReplicationTaskId *string `pulumi:"replicationTaskId"`
// An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html).
ReplicationTaskSettings *string `pulumi:"replicationTaskSettings"`
// The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint.
SourceEndpointArn *string `pulumi:"sourceEndpointArn"`
// An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html)
TableMappings *string `pulumi:"tableMappings"`
// 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 .
TagsAll map[string]string `pulumi:"tagsAll"`
// The Amazon Resource Name (ARN) string that uniquely identifies the target endpoint.
TargetEndpointArn *string `pulumi:"targetEndpointArn"`
}
type ReplicationTaskState struct {
// Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see [Determining a CDC native start point](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native).
CdcStartPosition pulumi.StringPtrInput
// The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.
CdcStartTime pulumi.StringPtrInput
// The migration type. Can be one of `full-load | cdc | full-load-and-cdc`.
MigrationType pulumi.StringPtrInput
// The Amazon Resource Name (ARN) of the replication instance.
ReplicationInstanceArn pulumi.StringPtrInput
// The Amazon Resource Name (ARN) for the replication task.
ReplicationTaskArn pulumi.StringPtrInput
// The replication task identifier.
ReplicationTaskId pulumi.StringPtrInput
// An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html).
ReplicationTaskSettings pulumi.StringPtrInput
// The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint.
SourceEndpointArn pulumi.StringPtrInput
// An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html)
TableMappings 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 .
TagsAll pulumi.StringMapInput
// The Amazon Resource Name (ARN) string that uniquely identifies the target endpoint.
TargetEndpointArn pulumi.StringPtrInput
}
func (ReplicationTaskState) ElementType() reflect.Type {
return reflect.TypeOf((*replicationTaskState)(nil)).Elem()
}
type replicationTaskArgs struct {
// Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see [Determining a CDC native start point](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native).
CdcStartPosition *string `pulumi:"cdcStartPosition"`
// The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.
CdcStartTime *string `pulumi:"cdcStartTime"`
// The migration type. Can be one of `full-load | cdc | full-load-and-cdc`.
MigrationType string `pulumi:"migrationType"`
// The Amazon Resource Name (ARN) of the replication instance.
ReplicationInstanceArn string `pulumi:"replicationInstanceArn"`
// The replication task identifier.
ReplicationTaskId string `pulumi:"replicationTaskId"`
// An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html).
ReplicationTaskSettings *string `pulumi:"replicationTaskSettings"`
// The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint.
SourceEndpointArn string `pulumi:"sourceEndpointArn"`
// An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html)
TableMappings string `pulumi:"tableMappings"`
// 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 Amazon Resource Name (ARN) string that uniquely identifies the target endpoint.
TargetEndpointArn string `pulumi:"targetEndpointArn"`
}
// The set of arguments for constructing a ReplicationTask resource.
type ReplicationTaskArgs struct {
// Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see [Determining a CDC native start point](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native).
CdcStartPosition pulumi.StringPtrInput
// The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.
CdcStartTime pulumi.StringPtrInput
// The migration type. Can be one of `full-load | cdc | full-load-and-cdc`.
MigrationType pulumi.StringInput
// The Amazon Resource Name (ARN) of the replication instance.
ReplicationInstanceArn pulumi.StringInput
// The replication task identifier.
ReplicationTaskId pulumi.StringInput
// An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html).
ReplicationTaskSettings pulumi.StringPtrInput
// The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint.
SourceEndpointArn pulumi.StringInput
// An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html)
TableMappings pulumi.StringInput
// 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
// The Amazon Resource Name (ARN) string that uniquely identifies the target endpoint.
TargetEndpointArn pulumi.StringInput
}
func (ReplicationTaskArgs) ElementType() reflect.Type {
return reflect.TypeOf((*replicationTaskArgs)(nil)).Elem()
}
type ReplicationTaskInput interface {
pulumi.Input
ToReplicationTaskOutput() ReplicationTaskOutput
ToReplicationTaskOutputWithContext(ctx context.Context) ReplicationTaskOutput
}
func (*ReplicationTask) ElementType() reflect.Type {
return reflect.TypeOf((**ReplicationTask)(nil)).Elem()
}
func (i *ReplicationTask) ToReplicationTaskOutput() ReplicationTaskOutput {
return i.ToReplicationTaskOutputWithContext(context.Background())
}
func (i *ReplicationTask) ToReplicationTaskOutputWithContext(ctx context.Context) ReplicationTaskOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReplicationTaskOutput)
}
// ReplicationTaskArrayInput is an input type that accepts ReplicationTaskArray and ReplicationTaskArrayOutput values.
// You can construct a concrete instance of `ReplicationTaskArrayInput` via:
//
// ReplicationTaskArray{ ReplicationTaskArgs{...} }
type ReplicationTaskArrayInput interface {
pulumi.Input
ToReplicationTaskArrayOutput() ReplicationTaskArrayOutput
ToReplicationTaskArrayOutputWithContext(context.Context) ReplicationTaskArrayOutput
}
type ReplicationTaskArray []ReplicationTaskInput
func (ReplicationTaskArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ReplicationTask)(nil)).Elem()
}
func (i ReplicationTaskArray) ToReplicationTaskArrayOutput() ReplicationTaskArrayOutput {
return i.ToReplicationTaskArrayOutputWithContext(context.Background())
}
func (i ReplicationTaskArray) ToReplicationTaskArrayOutputWithContext(ctx context.Context) ReplicationTaskArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReplicationTaskArrayOutput)
}
// ReplicationTaskMapInput is an input type that accepts ReplicationTaskMap and ReplicationTaskMapOutput values.
// You can construct a concrete instance of `ReplicationTaskMapInput` via:
//
// ReplicationTaskMap{ "key": ReplicationTaskArgs{...} }
type ReplicationTaskMapInput interface {
pulumi.Input
ToReplicationTaskMapOutput() ReplicationTaskMapOutput
ToReplicationTaskMapOutputWithContext(context.Context) ReplicationTaskMapOutput
}
type ReplicationTaskMap map[string]ReplicationTaskInput
func (ReplicationTaskMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ReplicationTask)(nil)).Elem()
}
func (i ReplicationTaskMap) ToReplicationTaskMapOutput() ReplicationTaskMapOutput {
return i.ToReplicationTaskMapOutputWithContext(context.Background())
}
func (i ReplicationTaskMap) ToReplicationTaskMapOutputWithContext(ctx context.Context) ReplicationTaskMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReplicationTaskMapOutput)
}
type ReplicationTaskOutput struct{ *pulumi.OutputState }
func (ReplicationTaskOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ReplicationTask)(nil)).Elem()
}
func (o ReplicationTaskOutput) ToReplicationTaskOutput() ReplicationTaskOutput {
return o
}
func (o ReplicationTaskOutput) ToReplicationTaskOutputWithContext(ctx context.Context) ReplicationTaskOutput {
return o
}
type ReplicationTaskArrayOutput struct{ *pulumi.OutputState }
func (ReplicationTaskArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ReplicationTask)(nil)).Elem()
}
func (o ReplicationTaskArrayOutput) ToReplicationTaskArrayOutput() ReplicationTaskArrayOutput {
return o
}
func (o ReplicationTaskArrayOutput) ToReplicationTaskArrayOutputWithContext(ctx context.Context) ReplicationTaskArrayOutput {
return o
}
func (o ReplicationTaskArrayOutput) Index(i pulumi.IntInput) ReplicationTaskOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ReplicationTask {
return vs[0].([]*ReplicationTask)[vs[1].(int)]
}).(ReplicationTaskOutput)
}
type ReplicationTaskMapOutput struct{ *pulumi.OutputState }
func (ReplicationTaskMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ReplicationTask)(nil)).Elem()
}
func (o ReplicationTaskMapOutput) ToReplicationTaskMapOutput() ReplicationTaskMapOutput {
return o
}
func (o ReplicationTaskMapOutput) ToReplicationTaskMapOutputWithContext(ctx context.Context) ReplicationTaskMapOutput {
return o
}
func (o ReplicationTaskMapOutput) MapIndex(k pulumi.StringInput) ReplicationTaskOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ReplicationTask {
return vs[0].(map[string]*ReplicationTask)[vs[1].(string)]
}).(ReplicationTaskOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ReplicationTaskInput)(nil)).Elem(), &ReplicationTask{})
pulumi.RegisterInputType(reflect.TypeOf((*ReplicationTaskArrayInput)(nil)).Elem(), ReplicationTaskArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ReplicationTaskMapInput)(nil)).Elem(), ReplicationTaskMap{})
pulumi.RegisterOutputType(ReplicationTaskOutput{})
pulumi.RegisterOutputType(ReplicationTaskArrayOutput{})
pulumi.RegisterOutputType(ReplicationTaskMapOutput{})
}