github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/datasync/task.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package datasync 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages an AWS DataSync Task, which represents a configuration for synchronization. Starting an execution of these DataSync Tasks (actually synchronizing files) is performed outside of this resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/datasync" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{ 34 // DestinationLocationArn: pulumi.Any(destination.Arn), 35 // Name: pulumi.String("example"), 36 // SourceLocationArn: pulumi.Any(source.Arn), 37 // Options: &datasync.TaskOptionsArgs{ 38 // BytesPerSecond: -1, 39 // }, 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // return nil 45 // }) 46 // } 47 // 48 // ``` 49 // <!--End PulumiCodeChooser --> 50 // 51 // ### With Scheduling 52 // 53 // <!--Start PulumiCodeChooser --> 54 // ```go 55 // package main 56 // 57 // import ( 58 // 59 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 60 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/datasync" 61 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 62 // 63 // ) 64 // 65 // func main() { 66 // pulumi.Run(func(ctx *pulumi.Context) error { 67 // _, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{ 68 // DestinationLocationArn: pulumi.Any(destination.Arn), 69 // Name: pulumi.String("example"), 70 // SourceLocationArn: pulumi.Any(source.Arn), 71 // Schedule: &datasync.TaskScheduleArgs{ 72 // ScheduleExpression: pulumi.String("cron(0 12 ? * SUN,WED *)"), 73 // }, 74 // }) 75 // if err != nil { 76 // return err 77 // } 78 // return nil 79 // }) 80 // } 81 // 82 // ``` 83 // <!--End PulumiCodeChooser --> 84 // 85 // ### With Filtering 86 // 87 // <!--Start PulumiCodeChooser --> 88 // ```go 89 // package main 90 // 91 // import ( 92 // 93 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 94 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/datasync" 95 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 96 // 97 // ) 98 // 99 // func main() { 100 // pulumi.Run(func(ctx *pulumi.Context) error { 101 // _, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{ 102 // DestinationLocationArn: pulumi.Any(destination.Arn), 103 // Name: pulumi.String("example"), 104 // SourceLocationArn: pulumi.Any(source.Arn), 105 // Excludes: &datasync.TaskExcludesArgs{ 106 // FilterType: pulumi.String("SIMPLE_PATTERN"), 107 // Value: pulumi.String("/folder1|/folder2"), 108 // }, 109 // Includes: &datasync.TaskIncludesArgs{ 110 // FilterType: pulumi.String("SIMPLE_PATTERN"), 111 // Value: pulumi.String("/folder1|/folder2"), 112 // }, 113 // }) 114 // if err != nil { 115 // return err 116 // } 117 // return nil 118 // }) 119 // } 120 // 121 // ``` 122 // <!--End PulumiCodeChooser --> 123 // 124 // ## Import 125 // 126 // Using `pulumi import`, import `aws_datasync_task` using the DataSync Task Amazon Resource Name (ARN). For example: 127 // 128 // ```sh 129 // $ pulumi import aws:datasync/task:Task example arn:aws:datasync:us-east-1:123456789012:task/task-12345678901234567 130 // ``` 131 type Task struct { 132 pulumi.CustomResourceState 133 134 // Amazon Resource Name (ARN) of the DataSync Task. 135 Arn pulumi.StringOutput `pulumi:"arn"` 136 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 137 CloudwatchLogGroupArn pulumi.StringPtrOutput `pulumi:"cloudwatchLogGroupArn"` 138 // Amazon Resource Name (ARN) of destination DataSync Location. 139 DestinationLocationArn pulumi.StringOutput `pulumi:"destinationLocationArn"` 140 // Filter rules that determines which files to exclude from a task. 141 Excludes TaskExcludesPtrOutput `pulumi:"excludes"` 142 // Filter rules that determines which files to include in a task. 143 Includes TaskIncludesPtrOutput `pulumi:"includes"` 144 // Name of the DataSync Task. 145 Name pulumi.StringOutput `pulumi:"name"` 146 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 147 Options TaskOptionsPtrOutput `pulumi:"options"` 148 // Specifies a schedule used to periodically transfer files from a source to a destination location. 149 Schedule TaskSchedulePtrOutput `pulumi:"schedule"` 150 // Amazon Resource Name (ARN) of source DataSync Location. 151 SourceLocationArn pulumi.StringOutput `pulumi:"sourceLocationArn"` 152 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 153 Tags pulumi.StringMapOutput `pulumi:"tags"` 154 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 155 // 156 // Deprecated: Please use `tags` instead. 157 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 158 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 159 TaskReportConfig TaskTaskReportConfigPtrOutput `pulumi:"taskReportConfig"` 160 } 161 162 // NewTask registers a new resource with the given unique name, arguments, and options. 163 func NewTask(ctx *pulumi.Context, 164 name string, args *TaskArgs, opts ...pulumi.ResourceOption) (*Task, error) { 165 if args == nil { 166 return nil, errors.New("missing one or more required arguments") 167 } 168 169 if args.DestinationLocationArn == nil { 170 return nil, errors.New("invalid value for required argument 'DestinationLocationArn'") 171 } 172 if args.SourceLocationArn == nil { 173 return nil, errors.New("invalid value for required argument 'SourceLocationArn'") 174 } 175 opts = internal.PkgResourceDefaultOpts(opts) 176 var resource Task 177 err := ctx.RegisterResource("aws:datasync/task:Task", name, args, &resource, opts...) 178 if err != nil { 179 return nil, err 180 } 181 return &resource, nil 182 } 183 184 // GetTask gets an existing Task resource's state with the given name, ID, and optional 185 // state properties that are used to uniquely qualify the lookup (nil if not required). 186 func GetTask(ctx *pulumi.Context, 187 name string, id pulumi.IDInput, state *TaskState, opts ...pulumi.ResourceOption) (*Task, error) { 188 var resource Task 189 err := ctx.ReadResource("aws:datasync/task:Task", name, id, state, &resource, opts...) 190 if err != nil { 191 return nil, err 192 } 193 return &resource, nil 194 } 195 196 // Input properties used for looking up and filtering Task resources. 197 type taskState struct { 198 // Amazon Resource Name (ARN) of the DataSync Task. 199 Arn *string `pulumi:"arn"` 200 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 201 CloudwatchLogGroupArn *string `pulumi:"cloudwatchLogGroupArn"` 202 // Amazon Resource Name (ARN) of destination DataSync Location. 203 DestinationLocationArn *string `pulumi:"destinationLocationArn"` 204 // Filter rules that determines which files to exclude from a task. 205 Excludes *TaskExcludes `pulumi:"excludes"` 206 // Filter rules that determines which files to include in a task. 207 Includes *TaskIncludes `pulumi:"includes"` 208 // Name of the DataSync Task. 209 Name *string `pulumi:"name"` 210 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 211 Options *TaskOptions `pulumi:"options"` 212 // Specifies a schedule used to periodically transfer files from a source to a destination location. 213 Schedule *TaskSchedule `pulumi:"schedule"` 214 // Amazon Resource Name (ARN) of source DataSync Location. 215 SourceLocationArn *string `pulumi:"sourceLocationArn"` 216 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 217 Tags map[string]string `pulumi:"tags"` 218 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 219 // 220 // Deprecated: Please use `tags` instead. 221 TagsAll map[string]string `pulumi:"tagsAll"` 222 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 223 TaskReportConfig *TaskTaskReportConfig `pulumi:"taskReportConfig"` 224 } 225 226 type TaskState struct { 227 // Amazon Resource Name (ARN) of the DataSync Task. 228 Arn pulumi.StringPtrInput 229 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 230 CloudwatchLogGroupArn pulumi.StringPtrInput 231 // Amazon Resource Name (ARN) of destination DataSync Location. 232 DestinationLocationArn pulumi.StringPtrInput 233 // Filter rules that determines which files to exclude from a task. 234 Excludes TaskExcludesPtrInput 235 // Filter rules that determines which files to include in a task. 236 Includes TaskIncludesPtrInput 237 // Name of the DataSync Task. 238 Name pulumi.StringPtrInput 239 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 240 Options TaskOptionsPtrInput 241 // Specifies a schedule used to periodically transfer files from a source to a destination location. 242 Schedule TaskSchedulePtrInput 243 // Amazon Resource Name (ARN) of source DataSync Location. 244 SourceLocationArn pulumi.StringPtrInput 245 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 246 Tags pulumi.StringMapInput 247 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 248 // 249 // Deprecated: Please use `tags` instead. 250 TagsAll pulumi.StringMapInput 251 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 252 TaskReportConfig TaskTaskReportConfigPtrInput 253 } 254 255 func (TaskState) ElementType() reflect.Type { 256 return reflect.TypeOf((*taskState)(nil)).Elem() 257 } 258 259 type taskArgs struct { 260 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 261 CloudwatchLogGroupArn *string `pulumi:"cloudwatchLogGroupArn"` 262 // Amazon Resource Name (ARN) of destination DataSync Location. 263 DestinationLocationArn string `pulumi:"destinationLocationArn"` 264 // Filter rules that determines which files to exclude from a task. 265 Excludes *TaskExcludes `pulumi:"excludes"` 266 // Filter rules that determines which files to include in a task. 267 Includes *TaskIncludes `pulumi:"includes"` 268 // Name of the DataSync Task. 269 Name *string `pulumi:"name"` 270 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 271 Options *TaskOptions `pulumi:"options"` 272 // Specifies a schedule used to periodically transfer files from a source to a destination location. 273 Schedule *TaskSchedule `pulumi:"schedule"` 274 // Amazon Resource Name (ARN) of source DataSync Location. 275 SourceLocationArn string `pulumi:"sourceLocationArn"` 276 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 277 Tags map[string]string `pulumi:"tags"` 278 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 279 TaskReportConfig *TaskTaskReportConfig `pulumi:"taskReportConfig"` 280 } 281 282 // The set of arguments for constructing a Task resource. 283 type TaskArgs struct { 284 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 285 CloudwatchLogGroupArn pulumi.StringPtrInput 286 // Amazon Resource Name (ARN) of destination DataSync Location. 287 DestinationLocationArn pulumi.StringInput 288 // Filter rules that determines which files to exclude from a task. 289 Excludes TaskExcludesPtrInput 290 // Filter rules that determines which files to include in a task. 291 Includes TaskIncludesPtrInput 292 // Name of the DataSync Task. 293 Name pulumi.StringPtrInput 294 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 295 Options TaskOptionsPtrInput 296 // Specifies a schedule used to periodically transfer files from a source to a destination location. 297 Schedule TaskSchedulePtrInput 298 // Amazon Resource Name (ARN) of source DataSync Location. 299 SourceLocationArn pulumi.StringInput 300 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 301 Tags pulumi.StringMapInput 302 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 303 TaskReportConfig TaskTaskReportConfigPtrInput 304 } 305 306 func (TaskArgs) ElementType() reflect.Type { 307 return reflect.TypeOf((*taskArgs)(nil)).Elem() 308 } 309 310 type TaskInput interface { 311 pulumi.Input 312 313 ToTaskOutput() TaskOutput 314 ToTaskOutputWithContext(ctx context.Context) TaskOutput 315 } 316 317 func (*Task) ElementType() reflect.Type { 318 return reflect.TypeOf((**Task)(nil)).Elem() 319 } 320 321 func (i *Task) ToTaskOutput() TaskOutput { 322 return i.ToTaskOutputWithContext(context.Background()) 323 } 324 325 func (i *Task) ToTaskOutputWithContext(ctx context.Context) TaskOutput { 326 return pulumi.ToOutputWithContext(ctx, i).(TaskOutput) 327 } 328 329 // TaskArrayInput is an input type that accepts TaskArray and TaskArrayOutput values. 330 // You can construct a concrete instance of `TaskArrayInput` via: 331 // 332 // TaskArray{ TaskArgs{...} } 333 type TaskArrayInput interface { 334 pulumi.Input 335 336 ToTaskArrayOutput() TaskArrayOutput 337 ToTaskArrayOutputWithContext(context.Context) TaskArrayOutput 338 } 339 340 type TaskArray []TaskInput 341 342 func (TaskArray) ElementType() reflect.Type { 343 return reflect.TypeOf((*[]*Task)(nil)).Elem() 344 } 345 346 func (i TaskArray) ToTaskArrayOutput() TaskArrayOutput { 347 return i.ToTaskArrayOutputWithContext(context.Background()) 348 } 349 350 func (i TaskArray) ToTaskArrayOutputWithContext(ctx context.Context) TaskArrayOutput { 351 return pulumi.ToOutputWithContext(ctx, i).(TaskArrayOutput) 352 } 353 354 // TaskMapInput is an input type that accepts TaskMap and TaskMapOutput values. 355 // You can construct a concrete instance of `TaskMapInput` via: 356 // 357 // TaskMap{ "key": TaskArgs{...} } 358 type TaskMapInput interface { 359 pulumi.Input 360 361 ToTaskMapOutput() TaskMapOutput 362 ToTaskMapOutputWithContext(context.Context) TaskMapOutput 363 } 364 365 type TaskMap map[string]TaskInput 366 367 func (TaskMap) ElementType() reflect.Type { 368 return reflect.TypeOf((*map[string]*Task)(nil)).Elem() 369 } 370 371 func (i TaskMap) ToTaskMapOutput() TaskMapOutput { 372 return i.ToTaskMapOutputWithContext(context.Background()) 373 } 374 375 func (i TaskMap) ToTaskMapOutputWithContext(ctx context.Context) TaskMapOutput { 376 return pulumi.ToOutputWithContext(ctx, i).(TaskMapOutput) 377 } 378 379 type TaskOutput struct{ *pulumi.OutputState } 380 381 func (TaskOutput) ElementType() reflect.Type { 382 return reflect.TypeOf((**Task)(nil)).Elem() 383 } 384 385 func (o TaskOutput) ToTaskOutput() TaskOutput { 386 return o 387 } 388 389 func (o TaskOutput) ToTaskOutputWithContext(ctx context.Context) TaskOutput { 390 return o 391 } 392 393 // Amazon Resource Name (ARN) of the DataSync Task. 394 func (o TaskOutput) Arn() pulumi.StringOutput { 395 return o.ApplyT(func(v *Task) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 396 } 397 398 // Amazon Resource Name (ARN) of the CloudWatch Log Group that is used to monitor and log events in the sync task. 399 func (o TaskOutput) CloudwatchLogGroupArn() pulumi.StringPtrOutput { 400 return o.ApplyT(func(v *Task) pulumi.StringPtrOutput { return v.CloudwatchLogGroupArn }).(pulumi.StringPtrOutput) 401 } 402 403 // Amazon Resource Name (ARN) of destination DataSync Location. 404 func (o TaskOutput) DestinationLocationArn() pulumi.StringOutput { 405 return o.ApplyT(func(v *Task) pulumi.StringOutput { return v.DestinationLocationArn }).(pulumi.StringOutput) 406 } 407 408 // Filter rules that determines which files to exclude from a task. 409 func (o TaskOutput) Excludes() TaskExcludesPtrOutput { 410 return o.ApplyT(func(v *Task) TaskExcludesPtrOutput { return v.Excludes }).(TaskExcludesPtrOutput) 411 } 412 413 // Filter rules that determines which files to include in a task. 414 func (o TaskOutput) Includes() TaskIncludesPtrOutput { 415 return o.ApplyT(func(v *Task) TaskIncludesPtrOutput { return v.Includes }).(TaskIncludesPtrOutput) 416 } 417 418 // Name of the DataSync Task. 419 func (o TaskOutput) Name() pulumi.StringOutput { 420 return o.ApplyT(func(v *Task) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 421 } 422 423 // Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions. 424 func (o TaskOutput) Options() TaskOptionsPtrOutput { 425 return o.ApplyT(func(v *Task) TaskOptionsPtrOutput { return v.Options }).(TaskOptionsPtrOutput) 426 } 427 428 // Specifies a schedule used to periodically transfer files from a source to a destination location. 429 func (o TaskOutput) Schedule() TaskSchedulePtrOutput { 430 return o.ApplyT(func(v *Task) TaskSchedulePtrOutput { return v.Schedule }).(TaskSchedulePtrOutput) 431 } 432 433 // Amazon Resource Name (ARN) of source DataSync Location. 434 func (o TaskOutput) SourceLocationArn() pulumi.StringOutput { 435 return o.ApplyT(func(v *Task) pulumi.StringOutput { return v.SourceLocationArn }).(pulumi.StringOutput) 436 } 437 438 // Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 439 func (o TaskOutput) Tags() pulumi.StringMapOutput { 440 return o.ApplyT(func(v *Task) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 441 } 442 443 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 444 // 445 // Deprecated: Please use `tags` instead. 446 func (o TaskOutput) TagsAll() pulumi.StringMapOutput { 447 return o.ApplyT(func(v *Task) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 448 } 449 450 // Configuration block containing the configuration of a DataSync Task Report. See `taskReportConfig` below. 451 func (o TaskOutput) TaskReportConfig() TaskTaskReportConfigPtrOutput { 452 return o.ApplyT(func(v *Task) TaskTaskReportConfigPtrOutput { return v.TaskReportConfig }).(TaskTaskReportConfigPtrOutput) 453 } 454 455 type TaskArrayOutput struct{ *pulumi.OutputState } 456 457 func (TaskArrayOutput) ElementType() reflect.Type { 458 return reflect.TypeOf((*[]*Task)(nil)).Elem() 459 } 460 461 func (o TaskArrayOutput) ToTaskArrayOutput() TaskArrayOutput { 462 return o 463 } 464 465 func (o TaskArrayOutput) ToTaskArrayOutputWithContext(ctx context.Context) TaskArrayOutput { 466 return o 467 } 468 469 func (o TaskArrayOutput) Index(i pulumi.IntInput) TaskOutput { 470 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Task { 471 return vs[0].([]*Task)[vs[1].(int)] 472 }).(TaskOutput) 473 } 474 475 type TaskMapOutput struct{ *pulumi.OutputState } 476 477 func (TaskMapOutput) ElementType() reflect.Type { 478 return reflect.TypeOf((*map[string]*Task)(nil)).Elem() 479 } 480 481 func (o TaskMapOutput) ToTaskMapOutput() TaskMapOutput { 482 return o 483 } 484 485 func (o TaskMapOutput) ToTaskMapOutputWithContext(ctx context.Context) TaskMapOutput { 486 return o 487 } 488 489 func (o TaskMapOutput) MapIndex(k pulumi.StringInput) TaskOutput { 490 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Task { 491 return vs[0].(map[string]*Task)[vs[1].(string)] 492 }).(TaskOutput) 493 } 494 495 func init() { 496 pulumi.RegisterInputType(reflect.TypeOf((*TaskInput)(nil)).Elem(), &Task{}) 497 pulumi.RegisterInputType(reflect.TypeOf((*TaskArrayInput)(nil)).Elem(), TaskArray{}) 498 pulumi.RegisterInputType(reflect.TypeOf((*TaskMapInput)(nil)).Elem(), TaskMap{}) 499 pulumi.RegisterOutputType(TaskOutput{}) 500 pulumi.RegisterOutputType(TaskArrayOutput{}) 501 pulumi.RegisterOutputType(TaskMapOutput{}) 502 }