updateBucketBundle method

Future<UpdateBucketBundleResult> updateBucketBundle({
  1. required String bucketName,
  2. required String bundleId,
})

Updates the bundle, or storage plan, of an existing Amazon Lightsail bucket.

A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. You can update a bucket's bundle only one time within a monthly Amazon Web Services billing cycle. To determine if you can update a bucket's bundle, use the GetBuckets action. The ableToUpdateBundle parameter in the response will indicate whether you can currently update a bucket's bundle.

Update a bucket's bundle if it's consistently going over its storage space or data transfer quota, or if a bucket's usage is consistently in the lower range of its storage space or data transfer quota. Due to the unpredictable usage fluctuations that a bucket might experience, we strongly recommend that you update a bucket's bundle only as a long-term strategy, instead of as a short-term, monthly cost-cutting measure. Choose a bucket bundle that will provide the bucket with ample storage space and data transfer for a long time to come.

May throw AccessDeniedException. May throw InvalidInputException. May throw NotFoundException. May throw RegionSetupInProgressException. May throw ServiceException. May throw UnauthenticatedException.

Parameter bucketName : The name of the bucket for which to update the bundle.

Parameter bundleId : The ID of the new bundle to apply to the bucket.

Use the GetBucketBundles action to get a list of bundle IDs that you can specify.

Implementation

Future<UpdateBucketBundleResult> updateBucketBundle({
  required String bucketName,
  required String bundleId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.UpdateBucketBundle'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'bucketName': bucketName,
      'bundleId': bundleId,
    },
  );

  return UpdateBucketBundleResult.fromJson(jsonResponse.body);
}