putBucketLogging method

Future<void> putBucketLogging({
  1. required String bucket,
  2. required BucketLoggingStatus bucketLoggingStatus,
  3. ChecksumAlgorithm? checksumAlgorithm,
  4. String? contentMD5,
  5. String? expectedBucketOwner,
})

Implementation

Future<void> putBucketLogging({
  required String bucket,
  required BucketLoggingStatus bucketLoggingStatus,
  ChecksumAlgorithm? checksumAlgorithm,
  String? contentMD5,
  String? expectedBucketOwner,
}) async {
  final headers = <String, String>{
    if (checksumAlgorithm != null)
      'x-amz-sdk-checksum-algorithm': checksumAlgorithm.value,
    if (contentMD5 != null) 'Content-MD5': contentMD5.toString(),
    if (expectedBucketOwner != null)
      'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
  };
  await _protocol.send(
    method: 'PUT',
    requestUri: '/${Uri.encodeComponent(bucket)}?logging',
    headers: headers,
    payload: bucketLoggingStatus.toXml('BucketLoggingStatus'),
    exceptionFnMap: _exceptionFns,
  );
}