putBucketLifecycleConfiguration method

Future<void> putBucketLifecycleConfiguration({
  1. required String accountId,
  2. required String bucket,
  3. LifecycleConfiguration? lifecycleConfiguration,
})
Creates a new lifecycle configuration for the S3 on 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.

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. In addition, you must use 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 by using the access point ARN, see the Examples section.

The following actions are related to PutBucketLifecycleConfiguration:

Parameter accountId : The Amazon Web Services 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 {
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  await _protocol.send(
    method: 'PUT',
    requestUri: '/v20180820/bucket/lifecycleconfiguration',
    headers: headers,
    payload: lifecycleConfiguration?.toXml('LifecycleConfiguration'),
    endpoint: _resolveEndpoint(
      requiresAccountId: true,
      accountId: accountId,
      bucket: bucket,
    ),
    hostPrefix: '{AccountId}.',
    exceptionFnMap: _exceptionFns,
  );
}