openTunnel method

Future<OpenTunnelResponse> openTunnel({
  1. String? description,
  2. DestinationConfig? destinationConfig,
  3. List<Tag>? tags,
  4. TimeoutConfig? timeoutConfig,
})

Creates a new tunnel, and returns two client access tokens for clients to use to connect to the IoT Secure Tunneling proxy server.

Requires permission to access the OpenTunnel action.

May throw LimitExceededException.

Parameter description : A short text description of the tunnel.

Parameter destinationConfig : The destination configuration for the OpenTunnel request.

Parameter tags : A collection of tag metadata.

Parameter timeoutConfig : Timeout configuration for a tunnel.

Implementation

Future<OpenTunnelResponse> openTunnel({
  String? description,
  DestinationConfig? destinationConfig,
  List<Tag>? tags,
  TimeoutConfig? timeoutConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IoTSecuredTunneling.OpenTunnel'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (description != null) 'description': description,
      if (destinationConfig != null) 'destinationConfig': destinationConfig,
      if (tags != null) 'tags': tags,
      if (timeoutConfig != null) 'timeoutConfig': timeoutConfig,
    },
  );

  return OpenTunnelResponse.fromJson(jsonResponse.body);
}