createTopicRule method

Future<void> createTopicRule({
  1. required String ruleName,
  2. required TopicRulePayload topicRulePayload,
  3. String? tags,
})

Creates a rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule.

May throw SqlParseException. May throw InternalException. May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ServiceUnavailableException. May throw ConflictingResourceUpdateException.

Parameter ruleName : The name of the rule.

Parameter topicRulePayload : The rule payload.

Parameter tags : Metadata which can be used to manage the topic rule.

For the CLI command-line parameter use format: --tags "key1=value1&key2=value2..."

For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

Implementation

Future<void> createTopicRule({
  required String ruleName,
  required TopicRulePayload topicRulePayload,
  String? tags,
}) async {
  ArgumentError.checkNotNull(ruleName, 'ruleName');
  _s.validateStringLength(
    'ruleName',
    ruleName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(topicRulePayload, 'topicRulePayload');
  final headers = <String, String>{
    if (tags != null) 'x-amz-tagging': tags.toString(),
  };
  await _protocol.send(
    payload: topicRulePayload,
    method: 'POST',
    requestUri: '/rules/${Uri.encodeComponent(ruleName)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}