github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/datasync/s3location.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 S3 Location within AWS DataSync. 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.NewS3Location(ctx, "example", &datasync.S3LocationArgs{ 34 // S3BucketArn: pulumi.Any(exampleAwsS3Bucket.Arn), 35 // Subdirectory: pulumi.String("/example/prefix"), 36 // S3Config: &datasync.S3LocationS3ConfigArgs{ 37 // BucketAccessRoleArn: pulumi.Any(exampleAwsIamRole.Arn), 38 // }, 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // return nil 44 // }) 45 // } 46 // 47 // ``` 48 // <!--End PulumiCodeChooser --> 49 // 50 // ## Import 51 // 52 // Using `pulumi import`, import `aws_datasync_location_s3` using the DataSync Task Amazon Resource Name (ARN). For example: 53 // 54 // ```sh 55 // $ pulumi import aws:datasync/s3Location:S3Location example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567 56 // ``` 57 type S3Location struct { 58 pulumi.CustomResourceState 59 60 // A list of DataSync Agent ARNs with which this location will be associated. 61 AgentArns pulumi.StringArrayOutput `pulumi:"agentArns"` 62 // Amazon Resource Name (ARN) of the DataSync Location. 63 Arn pulumi.StringOutput `pulumi:"arn"` 64 // Amazon Resource Name (ARN) of the S3 Bucket. 65 S3BucketArn pulumi.StringOutput `pulumi:"s3BucketArn"` 66 // Configuration block containing information for connecting to S3. 67 S3Config S3LocationS3ConfigOutput `pulumi:"s3Config"` 68 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 69 S3StorageClass pulumi.StringOutput `pulumi:"s3StorageClass"` 70 // Prefix to perform actions as source or destination. 71 Subdirectory pulumi.StringOutput `pulumi:"subdirectory"` 72 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 73 Tags pulumi.StringMapOutput `pulumi:"tags"` 74 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 75 // 76 // Deprecated: Please use `tags` instead. 77 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 78 Uri pulumi.StringOutput `pulumi:"uri"` 79 } 80 81 // NewS3Location registers a new resource with the given unique name, arguments, and options. 82 func NewS3Location(ctx *pulumi.Context, 83 name string, args *S3LocationArgs, opts ...pulumi.ResourceOption) (*S3Location, error) { 84 if args == nil { 85 return nil, errors.New("missing one or more required arguments") 86 } 87 88 if args.S3BucketArn == nil { 89 return nil, errors.New("invalid value for required argument 'S3BucketArn'") 90 } 91 if args.S3Config == nil { 92 return nil, errors.New("invalid value for required argument 'S3Config'") 93 } 94 if args.Subdirectory == nil { 95 return nil, errors.New("invalid value for required argument 'Subdirectory'") 96 } 97 opts = internal.PkgResourceDefaultOpts(opts) 98 var resource S3Location 99 err := ctx.RegisterResource("aws:datasync/s3Location:S3Location", name, args, &resource, opts...) 100 if err != nil { 101 return nil, err 102 } 103 return &resource, nil 104 } 105 106 // GetS3Location gets an existing S3Location resource's state with the given name, ID, and optional 107 // state properties that are used to uniquely qualify the lookup (nil if not required). 108 func GetS3Location(ctx *pulumi.Context, 109 name string, id pulumi.IDInput, state *S3LocationState, opts ...pulumi.ResourceOption) (*S3Location, error) { 110 var resource S3Location 111 err := ctx.ReadResource("aws:datasync/s3Location:S3Location", name, id, state, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // Input properties used for looking up and filtering S3Location resources. 119 type s3locationState struct { 120 // A list of DataSync Agent ARNs with which this location will be associated. 121 AgentArns []string `pulumi:"agentArns"` 122 // Amazon Resource Name (ARN) of the DataSync Location. 123 Arn *string `pulumi:"arn"` 124 // Amazon Resource Name (ARN) of the S3 Bucket. 125 S3BucketArn *string `pulumi:"s3BucketArn"` 126 // Configuration block containing information for connecting to S3. 127 S3Config *S3LocationS3Config `pulumi:"s3Config"` 128 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 129 S3StorageClass *string `pulumi:"s3StorageClass"` 130 // Prefix to perform actions as source or destination. 131 Subdirectory *string `pulumi:"subdirectory"` 132 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 133 Tags map[string]string `pulumi:"tags"` 134 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 135 // 136 // Deprecated: Please use `tags` instead. 137 TagsAll map[string]string `pulumi:"tagsAll"` 138 Uri *string `pulumi:"uri"` 139 } 140 141 type S3LocationState struct { 142 // A list of DataSync Agent ARNs with which this location will be associated. 143 AgentArns pulumi.StringArrayInput 144 // Amazon Resource Name (ARN) of the DataSync Location. 145 Arn pulumi.StringPtrInput 146 // Amazon Resource Name (ARN) of the S3 Bucket. 147 S3BucketArn pulumi.StringPtrInput 148 // Configuration block containing information for connecting to S3. 149 S3Config S3LocationS3ConfigPtrInput 150 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 151 S3StorageClass pulumi.StringPtrInput 152 // Prefix to perform actions as source or destination. 153 Subdirectory pulumi.StringPtrInput 154 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 155 Tags pulumi.StringMapInput 156 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 157 // 158 // Deprecated: Please use `tags` instead. 159 TagsAll pulumi.StringMapInput 160 Uri pulumi.StringPtrInput 161 } 162 163 func (S3LocationState) ElementType() reflect.Type { 164 return reflect.TypeOf((*s3locationState)(nil)).Elem() 165 } 166 167 type s3locationArgs struct { 168 // A list of DataSync Agent ARNs with which this location will be associated. 169 AgentArns []string `pulumi:"agentArns"` 170 // Amazon Resource Name (ARN) of the S3 Bucket. 171 S3BucketArn string `pulumi:"s3BucketArn"` 172 // Configuration block containing information for connecting to S3. 173 S3Config S3LocationS3Config `pulumi:"s3Config"` 174 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 175 S3StorageClass *string `pulumi:"s3StorageClass"` 176 // Prefix to perform actions as source or destination. 177 Subdirectory string `pulumi:"subdirectory"` 178 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 179 Tags map[string]string `pulumi:"tags"` 180 } 181 182 // The set of arguments for constructing a S3Location resource. 183 type S3LocationArgs struct { 184 // A list of DataSync Agent ARNs with which this location will be associated. 185 AgentArns pulumi.StringArrayInput 186 // Amazon Resource Name (ARN) of the S3 Bucket. 187 S3BucketArn pulumi.StringInput 188 // Configuration block containing information for connecting to S3. 189 S3Config S3LocationS3ConfigInput 190 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 191 S3StorageClass pulumi.StringPtrInput 192 // Prefix to perform actions as source or destination. 193 Subdirectory pulumi.StringInput 194 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 195 Tags pulumi.StringMapInput 196 } 197 198 func (S3LocationArgs) ElementType() reflect.Type { 199 return reflect.TypeOf((*s3locationArgs)(nil)).Elem() 200 } 201 202 type S3LocationInput interface { 203 pulumi.Input 204 205 ToS3LocationOutput() S3LocationOutput 206 ToS3LocationOutputWithContext(ctx context.Context) S3LocationOutput 207 } 208 209 func (*S3Location) ElementType() reflect.Type { 210 return reflect.TypeOf((**S3Location)(nil)).Elem() 211 } 212 213 func (i *S3Location) ToS3LocationOutput() S3LocationOutput { 214 return i.ToS3LocationOutputWithContext(context.Background()) 215 } 216 217 func (i *S3Location) ToS3LocationOutputWithContext(ctx context.Context) S3LocationOutput { 218 return pulumi.ToOutputWithContext(ctx, i).(S3LocationOutput) 219 } 220 221 // S3LocationArrayInput is an input type that accepts S3LocationArray and S3LocationArrayOutput values. 222 // You can construct a concrete instance of `S3LocationArrayInput` via: 223 // 224 // S3LocationArray{ S3LocationArgs{...} } 225 type S3LocationArrayInput interface { 226 pulumi.Input 227 228 ToS3LocationArrayOutput() S3LocationArrayOutput 229 ToS3LocationArrayOutputWithContext(context.Context) S3LocationArrayOutput 230 } 231 232 type S3LocationArray []S3LocationInput 233 234 func (S3LocationArray) ElementType() reflect.Type { 235 return reflect.TypeOf((*[]*S3Location)(nil)).Elem() 236 } 237 238 func (i S3LocationArray) ToS3LocationArrayOutput() S3LocationArrayOutput { 239 return i.ToS3LocationArrayOutputWithContext(context.Background()) 240 } 241 242 func (i S3LocationArray) ToS3LocationArrayOutputWithContext(ctx context.Context) S3LocationArrayOutput { 243 return pulumi.ToOutputWithContext(ctx, i).(S3LocationArrayOutput) 244 } 245 246 // S3LocationMapInput is an input type that accepts S3LocationMap and S3LocationMapOutput values. 247 // You can construct a concrete instance of `S3LocationMapInput` via: 248 // 249 // S3LocationMap{ "key": S3LocationArgs{...} } 250 type S3LocationMapInput interface { 251 pulumi.Input 252 253 ToS3LocationMapOutput() S3LocationMapOutput 254 ToS3LocationMapOutputWithContext(context.Context) S3LocationMapOutput 255 } 256 257 type S3LocationMap map[string]S3LocationInput 258 259 func (S3LocationMap) ElementType() reflect.Type { 260 return reflect.TypeOf((*map[string]*S3Location)(nil)).Elem() 261 } 262 263 func (i S3LocationMap) ToS3LocationMapOutput() S3LocationMapOutput { 264 return i.ToS3LocationMapOutputWithContext(context.Background()) 265 } 266 267 func (i S3LocationMap) ToS3LocationMapOutputWithContext(ctx context.Context) S3LocationMapOutput { 268 return pulumi.ToOutputWithContext(ctx, i).(S3LocationMapOutput) 269 } 270 271 type S3LocationOutput struct{ *pulumi.OutputState } 272 273 func (S3LocationOutput) ElementType() reflect.Type { 274 return reflect.TypeOf((**S3Location)(nil)).Elem() 275 } 276 277 func (o S3LocationOutput) ToS3LocationOutput() S3LocationOutput { 278 return o 279 } 280 281 func (o S3LocationOutput) ToS3LocationOutputWithContext(ctx context.Context) S3LocationOutput { 282 return o 283 } 284 285 // A list of DataSync Agent ARNs with which this location will be associated. 286 func (o S3LocationOutput) AgentArns() pulumi.StringArrayOutput { 287 return o.ApplyT(func(v *S3Location) pulumi.StringArrayOutput { return v.AgentArns }).(pulumi.StringArrayOutput) 288 } 289 290 // Amazon Resource Name (ARN) of the DataSync Location. 291 func (o S3LocationOutput) Arn() pulumi.StringOutput { 292 return o.ApplyT(func(v *S3Location) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 293 } 294 295 // Amazon Resource Name (ARN) of the S3 Bucket. 296 func (o S3LocationOutput) S3BucketArn() pulumi.StringOutput { 297 return o.ApplyT(func(v *S3Location) pulumi.StringOutput { return v.S3BucketArn }).(pulumi.StringOutput) 298 } 299 300 // Configuration block containing information for connecting to S3. 301 func (o S3LocationOutput) S3Config() S3LocationS3ConfigOutput { 302 return o.ApplyT(func(v *S3Location) S3LocationS3ConfigOutput { return v.S3Config }).(S3LocationS3ConfigOutput) 303 } 304 305 // The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) 306 func (o S3LocationOutput) S3StorageClass() pulumi.StringOutput { 307 return o.ApplyT(func(v *S3Location) pulumi.StringOutput { return v.S3StorageClass }).(pulumi.StringOutput) 308 } 309 310 // Prefix to perform actions as source or destination. 311 func (o S3LocationOutput) Subdirectory() pulumi.StringOutput { 312 return o.ApplyT(func(v *S3Location) pulumi.StringOutput { return v.Subdirectory }).(pulumi.StringOutput) 313 } 314 315 // Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 316 func (o S3LocationOutput) Tags() pulumi.StringMapOutput { 317 return o.ApplyT(func(v *S3Location) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 318 } 319 320 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 321 // 322 // Deprecated: Please use `tags` instead. 323 func (o S3LocationOutput) TagsAll() pulumi.StringMapOutput { 324 return o.ApplyT(func(v *S3Location) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 325 } 326 327 func (o S3LocationOutput) Uri() pulumi.StringOutput { 328 return o.ApplyT(func(v *S3Location) pulumi.StringOutput { return v.Uri }).(pulumi.StringOutput) 329 } 330 331 type S3LocationArrayOutput struct{ *pulumi.OutputState } 332 333 func (S3LocationArrayOutput) ElementType() reflect.Type { 334 return reflect.TypeOf((*[]*S3Location)(nil)).Elem() 335 } 336 337 func (o S3LocationArrayOutput) ToS3LocationArrayOutput() S3LocationArrayOutput { 338 return o 339 } 340 341 func (o S3LocationArrayOutput) ToS3LocationArrayOutputWithContext(ctx context.Context) S3LocationArrayOutput { 342 return o 343 } 344 345 func (o S3LocationArrayOutput) Index(i pulumi.IntInput) S3LocationOutput { 346 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *S3Location { 347 return vs[0].([]*S3Location)[vs[1].(int)] 348 }).(S3LocationOutput) 349 } 350 351 type S3LocationMapOutput struct{ *pulumi.OutputState } 352 353 func (S3LocationMapOutput) ElementType() reflect.Type { 354 return reflect.TypeOf((*map[string]*S3Location)(nil)).Elem() 355 } 356 357 func (o S3LocationMapOutput) ToS3LocationMapOutput() S3LocationMapOutput { 358 return o 359 } 360 361 func (o S3LocationMapOutput) ToS3LocationMapOutputWithContext(ctx context.Context) S3LocationMapOutput { 362 return o 363 } 364 365 func (o S3LocationMapOutput) MapIndex(k pulumi.StringInput) S3LocationOutput { 366 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *S3Location { 367 return vs[0].(map[string]*S3Location)[vs[1].(string)] 368 }).(S3LocationOutput) 369 } 370 371 func init() { 372 pulumi.RegisterInputType(reflect.TypeOf((*S3LocationInput)(nil)).Elem(), &S3Location{}) 373 pulumi.RegisterInputType(reflect.TypeOf((*S3LocationArrayInput)(nil)).Elem(), S3LocationArray{}) 374 pulumi.RegisterInputType(reflect.TypeOf((*S3LocationMapInput)(nil)).Elem(), S3LocationMap{}) 375 pulumi.RegisterOutputType(S3LocationOutput{}) 376 pulumi.RegisterOutputType(S3LocationArrayOutput{}) 377 pulumi.RegisterOutputType(S3LocationMapOutput{}) 378 }