listChannels method

Future<ListChannelsResponse> listChannels({
  1. int? maxResults,
  2. String? nextToken,
})

Lists the channels in the current account, and their source names.

May throw InvalidNextTokenException. May throw OperationNotPermittedException. May throw UnsupportedOperationException.

Parameter maxResults : The maximum number of CloudTrail channels to display on a single page.

Parameter nextToken : The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Implementation

Future<ListChannelsResponse> listChannels({
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.ListChannels'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListChannelsResponse.fromJson(jsonResponse.body);
}