listTargetsByRule method

Future<ListTargetsByRuleResponse> listTargetsByRule({
  1. required String rule,
  2. String? eventBusName,
  3. int? limit,
  4. String? nextToken,
})

Lists the targets assigned to the specified rule.

May throw ResourceNotFoundException. May throw InternalException.

Parameter rule : 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 limit : The maximum number of results to return.

Parameter nextToken : The token returned by a previous call to retrieve the next set of results.

Implementation

Future<ListTargetsByRuleResponse> listTargetsByRule({
  required String rule,
  String? eventBusName,
  int? limit,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(rule, 'rule');
  _s.validateStringLength(
    'rule',
    rule,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'eventBusName',
    eventBusName,
    1,
    1600,
  );
  _s.validateNumRange(
    'limit',
    limit,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.ListTargetsByRule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Rule': rule,
      if (eventBusName != null) 'EventBusName': eventBusName,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListTargetsByRuleResponse.fromJson(jsonResponse.body);
}