disableRule method

Future<void> disableRule({
  1. required String name,
  2. String? eventBusName,
})

Disables the specified rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.

When you disable a rule, incoming events might continue to match to the disabled rule. Allow a short period of time for changes to take effect.

May throw ResourceNotFoundException. May throw ConcurrentModificationException. May throw ManagedRuleException. May throw InternalException.

Parameter name : The name of the rule.

Parameter eventBusName : The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.

Implementation

Future<void> disableRule({
  required String name,
  String? eventBusName,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'eventBusName',
    eventBusName,
    1,
    1600,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.DisableRule'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (eventBusName != null) 'EventBusName': eventBusName,
    },
  );
}