listArchives method

Future<ListArchivesResponse> listArchives({
  1. String? eventSourceArn,
  2. int? limit,
  3. String? namePrefix,
  4. String? nextToken,
  5. ArchiveState? state,
})

Lists your archives. You can either list all the archives or you can provide a prefix to match to the archive names. Filter parameters are exclusive.

May throw InternalException. May throw ResourceNotFoundException.

Parameter eventSourceArn : The ARN of the event source associated with the archive.

Parameter limit : The maximum number of results to return.

Parameter namePrefix : A name prefix to filter the archives returned. Only archives with name that match the prefix are returned.

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.

Parameter state : The state of the archive.

Implementation

Future<ListArchivesResponse> listArchives({
  String? eventSourceArn,
  int? limit,
  String? namePrefix,
  String? nextToken,
  ArchiveState? state,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.ListArchives'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (eventSourceArn != null) 'EventSourceArn': eventSourceArn,
      if (limit != null) 'Limit': limit,
      if (namePrefix != null) 'NamePrefix': namePrefix,
      if (nextToken != null) 'NextToken': nextToken,
      if (state != null) 'State': state.value,
    },
  );

  return ListArchivesResponse.fromJson(jsonResponse.body);
}