createRuleGroup method

Future<CreateRuleGroupResponse> createRuleGroup({
  1. required String changeToken,
  2. required String metricName,
  3. required String name,
  4. List<Tag>? tags,
})

Implementation

Future<CreateRuleGroupResponse> createRuleGroup({
  required String changeToken,
  required String metricName,
  required String name,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(changeToken, 'changeToken');
  _s.validateStringLength(
    'changeToken',
    changeToken,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(metricName, 'metricName');
  _s.validateStringLength(
    'metricName',
    metricName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSWAF_Regional_20161128.CreateRuleGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ChangeToken': changeToken,
      'MetricName': metricName,
      'Name': name,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRuleGroupResponse.fromJson(jsonResponse.body);
}