testConnection method

Future<void> testConnection({
  1. String? catalogId,
  2. String? connectionName,
  3. TestConnectionInput? testConnectionInput,
})

Tests a connection to a service to validate the service credentials that you provide.

You can either provide an existing connection name or a TestConnectionInput for testing a non-existing connection input. Providing both at the same time will cause an error.

If the action is successful, the service sends back an HTTP 200 response.

May throw AccessDeniedException. May throw ConflictException. May throw EntityNotFoundException. May throw FederationSourceException. May throw GlueEncryptionException. May throw InternalServiceException. May throw InvalidInputException. May throw OperationTimeoutException. May throw ResourceNumberLimitExceededException.

Parameter catalogId : The catalog ID where the connection resides.

Parameter connectionName : Optional. The name of the connection to test. If only name is provided, the operation will get the connection and use that for testing.

Parameter testConnectionInput : A structure that is used to specify testing a connection to a service.

Implementation

Future<void> testConnection({
  String? catalogId,
  String? connectionName,
  TestConnectionInput? testConnectionInput,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.TestConnection'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (catalogId != null) 'CatalogId': catalogId,
      if (connectionName != null) 'ConnectionName': connectionName,
      if (testConnectionInput != null)
        'TestConnectionInput': testConnectionInput,
    },
  );
}