deleteRule method
Deletes the specified rule.
Before you can delete the rule, you must remove all targets, using RemoveTargets.
When you delete a rule, incoming events might continue to match to the deleted rule. Allow a short period of time for changes to take effect.
Managed rules are rules created and managed by another AWS service on your
behalf. These rules are created by those other AWS services to support
functionality in those services. You can delete these rules using the
Force
option, but you should do so only if you are sure the
other service is not still using that rule.
May throw ConcurrentModificationException. May throw ManagedRuleException. May throw InternalException. May throw ResourceNotFoundException.
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.
Parameter force
:
If this is a managed rule, created by an AWS service on your behalf, you
must specify Force
as True
to delete the rule.
This parameter is ignored for rules that are not managed rules. You can
check whether a rule is a managed rule by using DescribeRule
or ListRules
and checking the ManagedBy
field of
the response.
Implementation
Future<void> deleteRule({
required String name,
String? eventBusName,
bool? force,
}) 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.DeleteRule'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
if (eventBusName != null) 'EventBusName': eventBusName,
if (force != null) 'Force': force,
},
);
}