updateRateBasedRule method

Future<UpdateRateBasedRuleResponse> updateRateBasedRule({
  1. required String changeToken,
  2. required int rateLimit,
  3. required String ruleId,
  4. required List<RuleUpdate> updates,
})

Implementation

Future<UpdateRateBasedRuleResponse> updateRateBasedRule({
  required String changeToken,
  required int rateLimit,
  required String ruleId,
  required List<RuleUpdate> updates,
}) async {
  ArgumentError.checkNotNull(changeToken, 'changeToken');
  _s.validateStringLength(
    'changeToken',
    changeToken,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(rateLimit, 'rateLimit');
  _s.validateNumRange(
    'rateLimit',
    rateLimit,
    100,
    2000000000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(ruleId, 'ruleId');
  _s.validateStringLength(
    'ruleId',
    ruleId,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(updates, 'updates');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSWAF_Regional_20161128.UpdateRateBasedRule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ChangeToken': changeToken,
      'RateLimit': rateLimit,
      'RuleId': ruleId,
      'Updates': updates,
    },
  );

  return UpdateRateBasedRuleResponse.fromJson(jsonResponse.body);
}