updateBandwidthRateLimit method

Future<UpdateBandwidthRateLimitOutput> updateBandwidthRateLimit({
  1. required String gatewayARN,
  2. int? averageDownloadRateLimitInBitsPerSec,
  3. int? averageUploadRateLimitInBitsPerSec,
})

Updates the bandwidth rate limits of a gateway. You can update both the upload and download bandwidth rate limit or specify only one of the two. If you don't set a bandwidth rate limit, the existing rate limit remains. This operation is supported for the stored volume, cached volume, and tape gateway types.

By default, a gateway's bandwidth rate limits are not set. If you don't set any limit, the gateway does not have any limitations on its bandwidth usage and could potentially use the maximum available bandwidth.

To specify which gateway to update, use the Amazon Resource Name (ARN) of the gateway in your request.

May throw InvalidGatewayRequestException. May throw InternalServerError.

Parameter averageDownloadRateLimitInBitsPerSec : The average download bandwidth rate limit in bits per second.

Parameter averageUploadRateLimitInBitsPerSec : The average upload bandwidth rate limit in bits per second.

Implementation

Future<UpdateBandwidthRateLimitOutput> updateBandwidthRateLimit({
  required String gatewayARN,
  int? averageDownloadRateLimitInBitsPerSec,
  int? averageUploadRateLimitInBitsPerSec,
}) async {
  ArgumentError.checkNotNull(gatewayARN, 'gatewayARN');
  _s.validateStringLength(
    'gatewayARN',
    gatewayARN,
    50,
    500,
    isRequired: true,
  );
  _s.validateNumRange(
    'averageDownloadRateLimitInBitsPerSec',
    averageDownloadRateLimitInBitsPerSec,
    102400,
    1152921504606846976,
  );
  _s.validateNumRange(
    'averageUploadRateLimitInBitsPerSec',
    averageUploadRateLimitInBitsPerSec,
    51200,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.UpdateBandwidthRateLimit'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GatewayARN': gatewayARN,
      if (averageDownloadRateLimitInBitsPerSec != null)
        'AverageDownloadRateLimitInBitsPerSec':
            averageDownloadRateLimitInBitsPerSec,
      if (averageUploadRateLimitInBitsPerSec != null)
        'AverageUploadRateLimitInBitsPerSec':
            averageUploadRateLimitInBitsPerSec,
    },
  );

  return UpdateBandwidthRateLimitOutput.fromJson(jsonResponse.body);
}