listRuleNamesByTarget method

Future<ListRuleNamesByTargetResponse> listRuleNamesByTarget({
  1. required String targetArn,
  2. String? eventBusName,
  3. int? limit,
  4. String? nextToken,
})

Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a specific target in your account.

The maximum number of results per page for requests is 100.

May throw InternalException. May throw ResourceNotFoundException.

Parameter targetArn : The Amazon Resource Name (ARN) of the target resource.

Parameter eventBusName : The name or ARN of the event bus to list rules for. If you omit this, the default event bus is used.

Parameter limit : The maximum number of results to return.

Parameter nextToken : The token returned by a previous call, which you can use to retrieve the next set of results.

The value of nextToken is a unique pagination token for each page. To retrieve the next page of results, make the call again using the returned token. Keep all other arguments unchanged.

Using an expired pagination token results in an HTTP 400 InvalidToken error.

Implementation

Future<ListRuleNamesByTargetResponse> listRuleNamesByTarget({
  required String targetArn,
  String? eventBusName,
  int? limit,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.ListRuleNamesByTarget'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TargetArn': targetArn,
      if (eventBusName != null) 'EventBusName': eventBusName,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListRuleNamesByTargetResponse.fromJson(jsonResponse.body);
}