putBucketAbac method

Future<void> putBucketAbac({
  1. required AbacStatus abacStatus,
  2. required String bucket,
  3. ChecksumAlgorithm? checksumAlgorithm,
  4. String? contentMD5,
  5. String? expectedBucketOwner,
})

Sets the attribute-based access control (ABAC) property of the general purpose bucket. You must have s3:PutBucketABAC permission to perform this action. When you enable ABAC, you can use tags for access control on your buckets. Additionally, when ABAC is enabled, you must use the TagResource and UntagResource actions to manage tags on your buckets. You can nolonger use the PutBucketTagging and DeleteBucketTagging actions to tag your bucket. For more information, see Enabling ABAC in general purpose buckets.

Parameter abacStatus : The ABAC status of the general purpose bucket. When ABAC is enabled for the general purpose bucket, you can use tags to manage access to the general purpose buckets as well as for cost tracking purposes. When ABAC is disabled for the general purpose buckets, you can only use tags for cost tracking purposes. For more information, see Using tags with S3 general purpose buckets.

Parameter bucket : The name of the general purpose bucket.

Parameter checksumAlgorithm : Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.

Parameter contentMD5 : The MD5 hash of the PutBucketAbac request body.

For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

Parameter expectedBucketOwner : The Amazon Web Services account ID of the general purpose bucket's owner.

Implementation

Future<void> putBucketAbac({
  required AbacStatus abacStatus,
  required String bucket,
  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)}?abac',
    headers: headers,
    payload: abacStatus.toXml('AbacStatus'),
    exceptionFnMap: _exceptionFns,
  );
}