createLocationS3 method
Creates a transfer location for an Amazon S3 bucket. DataSync can use this location as a source or destination for transferring data.
- Storage class considerations with Amazon S3 locations
- Evaluating S3 request costs when using DataSync
May throw InternalException.
May throw InvalidRequestException.
Parameter s3BucketArn :
Specifies the ARN of the S3 bucket that you want to use as a location.
(When creating your DataSync task later, you specify whether this location
is a transfer source or destination.)
If your S3 bucket is located on an Outposts resource, you must specify an Amazon S3 access point. For more information, see Managing data access with Amazon S3 access points in the Amazon S3 User Guide.
Parameter agentArns :
(Amazon S3 on Outposts only) Specifies the Amazon Resource Name (ARN) of
the DataSync agent on your Outpost.
For more information, see Deploy your DataSync agent on Outposts.
Parameter s3StorageClass :
Specifies the storage class that you want your objects to use when Amazon
S3 is a transfer destination.
For buckets in Amazon Web Services Regions, the storage class defaults to
STANDARD. For buckets on Outposts, the storage class defaults
to OUTPOSTS.
For more information, see Storage class considerations with Amazon S3 transfers.
Parameter subdirectory :
Specifies a prefix in the S3 bucket that DataSync reads from or writes to
(depending on whether the bucket is a source or destination location).
-
/photos -
photos//2006/January -
photos/./2006/February -
photos/../2006/March
Parameter tags :
Specifies labels that help you categorize, filter, and search for your
Amazon Web Services resources. We recommend creating at least a name tag
for your transfer location.
Implementation
Future<CreateLocationS3Response> createLocationS3({
required String s3BucketArn,
required S3Config s3Config,
List<String>? agentArns,
S3StorageClass? s3StorageClass,
String? subdirectory,
List<TagListEntry>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'FmrsService.CreateLocationS3'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'S3BucketArn': s3BucketArn,
'S3Config': s3Config,
if (agentArns != null) 'AgentArns': agentArns,
if (s3StorageClass != null) 'S3StorageClass': s3StorageClass.value,
if (subdirectory != null) 'Subdirectory': subdirectory,
if (tags != null) 'Tags': tags,
},
);
return CreateLocationS3Response.fromJson(jsonResponse.body);
}