updateLocationS3 method

Future<void> updateLocationS3({
  1. required String locationArn,
  2. S3Config? s3Config,
  3. S3StorageClass? s3StorageClass,
  4. String? subdirectory,
})

Modifies the following configuration parameters of the Amazon S3 transfer location that you're using with DataSync.

May throw InternalException. May throw InvalidRequestException.

Parameter locationArn : Specifies the Amazon Resource Name (ARN) of the Amazon S3 transfer location that you're updating.

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

Implementation

Future<void> updateLocationS3({
  required String locationArn,
  S3Config? s3Config,
  S3StorageClass? s3StorageClass,
  String? subdirectory,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.UpdateLocationS3'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LocationArn': locationArn,
      if (s3Config != null) 'S3Config': s3Config,
      if (s3StorageClass != null) 'S3StorageClass': s3StorageClass.value,
      if (subdirectory != null) 'Subdirectory': subdirectory,
    },
  );
}