getBucketLifecycle method

  1. @Deprecated('Deprecated')
Future<GetBucketLifecycleOutput> getBucketLifecycle({
  1. required String bucket,
  2. String? expectedBucketOwner,
})
Returns the lifecycle configuration information set on the bucket. For information about lifecycle configuration, see Object Lifecycle Management.

To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration action. The bucket owner has this permission by default. The bucket owner can grant this permission to others. For more information about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access Permissions to Your Amazon S3 Resources.

GetBucketLifecycle has the following special error:

  • Error code: NoSuchLifecycleConfiguration
    • Description: The lifecycle configuration does not exist.
    • HTTP Status Code: 404 Not Found
    • SOAP Fault Code Prefix: Client
The following operations are related to GetBucketLifecycle:

Parameter bucket : The name of the bucket for which to get the lifecycle information.

Parameter expectedBucketOwner : The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Implementation

@Deprecated('Deprecated')
Future<GetBucketLifecycleOutput> getBucketLifecycle({
  required String bucket,
  String? expectedBucketOwner,
}) async {
  ArgumentError.checkNotNull(bucket, 'bucket');
  final headers = <String, String>{
    if (expectedBucketOwner != null)
      'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
  };
  final $result = await _protocol.send(
    method: 'GET',
    requestUri: '/${Uri.encodeComponent(bucket)}?lifecycle',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetBucketLifecycleOutput.fromXml($result.body);
}