putBucketLifecycleConfiguration method

Future<void> putBucketLifecycleConfiguration({
  1. required String accountId,
  2. required String bucket,
  3. LifecycleConfiguration? lifecycleConfiguration,
})
Creates a new lifecycle configuration for the Outposts bucket or replaces an existing lifecycle configuration. Outposts buckets only support lifecycle configurations that delete/expire objects after a certain period of time and abort incomplete multipart uploads. For more information, see Managing Lifecycle Permissions for Amazon S3 on Outposts.

All Amazon S3 on Outposts REST API requests for this action require an additional parameter of x-amz-outpost-id to be passed with the request and an S3 on Outposts endpoint hostname prefix instead of s3-control. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id derived using the access point ARN, see the Examples section.

The following actions are related to PutBucketLifecycleConfiguration:

Parameter accountId : The AWS account ID of the Outposts bucket.

Parameter bucket : The name of the bucket for which to set the configuration.

Parameter lifecycleConfiguration : Container for lifecycle rules. You can add as many as 1,000 rules.

Implementation

Future<void> putBucketLifecycleConfiguration({
  required String accountId,
  required String bucket,
  LifecycleConfiguration? lifecycleConfiguration,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(bucket, 'bucket');
  _s.validateStringLength(
    'bucket',
    bucket,
    3,
    255,
    isRequired: true,
  );
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  await _protocol.send(
    method: 'PUT',
    requestUri:
        '/v20180820/bucket/${Uri.encodeComponent(bucket)}/lifecycleconfiguration',
    headers: headers,
    payload: lifecycleConfiguration?.toXml('LifecycleConfiguration'),
    exceptionFnMap: _exceptionFns,
  );
}