listRules method

Future<ListRulesResponse> listRules({
  1. required String instanceId,
  2. EventSourceName? eventSourceName,
  3. int? maxResults,
  4. String? nextToken,
  5. RulePublishStatus? publishStatus,
})

List all rules for the specified Connect Customer instance.

May throw AccessDeniedException. May throw InternalServiceException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter instanceId : The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

Parameter eventSourceName : The name of the event source.

Parameter maxResults : The maximum number of results to return per page.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Parameter publishStatus : The publish status of the rule.

Implementation

Future<ListRulesResponse> listRules({
  required String instanceId,
  EventSourceName? eventSourceName,
  int? maxResults,
  String? nextToken,
  RulePublishStatus? publishStatus,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    200,
  );
  final $query = <String, List<String>>{
    if (eventSourceName != null) 'eventSourceName': [eventSourceName.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (publishStatus != null) 'publishStatus': [publishStatus.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/rules/${Uri.encodeComponent(instanceId)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListRulesResponse.fromJson(response);
}