listRules method
Lists your Amazon EventBridge rules. You can either list all the rules or you can provide a prefix to match to the rule names.
ListRules does not list the targets of a rule. To see the targets associated with a rule, use ListTargetsByRule.
May throw InternalException. May throw ResourceNotFoundException.
Parameter eventBusName
:
The name or ARN of the event bus to list the rules for. If you omit this,
the default event bus is used.
Parameter limit
:
The maximum number of results to return.
Parameter namePrefix
:
The prefix matching the rule name.
Parameter nextToken
:
The token returned by a previous call to retrieve the next set of results.
Implementation
Future<ListRulesResponse> listRules({
String? eventBusName,
int? limit,
String? namePrefix,
String? nextToken,
}) async {
_s.validateStringLength(
'eventBusName',
eventBusName,
1,
1600,
);
_s.validateNumRange(
'limit',
limit,
1,
100,
);
_s.validateStringLength(
'namePrefix',
namePrefix,
1,
64,
);
_s.validateStringLength(
'nextToken',
nextToken,
1,
2048,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSEvents.ListRules'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (eventBusName != null) 'EventBusName': eventBusName,
if (limit != null) 'Limit': limit,
if (namePrefix != null) 'NamePrefix': namePrefix,
if (nextToken != null) 'NextToken': nextToken,
},
);
return ListRulesResponse.fromJson(jsonResponse.body);
}