listTunnels method

Future<ListTunnelsResponse> listTunnels({
  1. int? maxResults,
  2. String? nextToken,
  3. String? thingName,
})

List all tunnels for an Amazon Web Services account. Tunnels are listed by creation time in descending order, newer tunnels will be listed before older tunnels.

Requires permission to access the ListTunnels action.

Parameter maxResults : The maximum number of results to return at once.

Parameter nextToken : To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

Parameter thingName : The name of the IoT thing associated with the destination device.

Implementation

Future<ListTunnelsResponse> listTunnels({
  int? maxResults,
  String? nextToken,
  String? thingName,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IoTSecuredTunneling.ListTunnels'
  };
  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,
      if (thingName != null) 'thingName': thingName,
    },
  );

  return ListTunnelsResponse.fromJson(jsonResponse.body);
}