TestConnectionCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, TestConnectionCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, TestConnectionCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // TestConnectionRequest
  ConnectionName: "STRING_VALUE",
  CatalogId: "STRING_VALUE",
  TestConnectionInput: { // TestConnectionInput
    ConnectionType: "JDBC" || "SFTP" || "MONGODB" || "KAFKA" || "NETWORK" || "MARKETPLACE" || "CUSTOM" || "SALESFORCE" || "VIEW_VALIDATION_REDSHIFT" || "VIEW_VALIDATION_ATHENA" || "GOOGLEADS" || "GOOGLESHEETS" || "GOOGLEANALYTICS4" || "SERVICENOW" || "MARKETO" || "SAPODATA" || "ZENDESK" || "JIRACLOUD" || "NETSUITEERP" || "HUBSPOT" || "FACEBOOKADS" || "INSTAGRAMADS" || "ZOHOCRM" || "SALESFORCEPARDOT" || "SALESFORCEMARKETINGCLOUD" || "SLACK" || "STRIPE" || "INTERCOM" || "SNAPCHATADS", // required
    ConnectionProperties: { // ConnectionProperties // required
      "<keys>": "STRING_VALUE",
    },
    AuthenticationConfiguration: { // AuthenticationConfigurationInput
      AuthenticationType: "BASIC" || "OAUTH2" || "CUSTOM" || "IAM",
      OAuth2Properties: { // OAuth2PropertiesInput
        OAuth2GrantType: "AUTHORIZATION_CODE" || "CLIENT_CREDENTIALS" || "JWT_BEARER",
        OAuth2ClientApplication: { // OAuth2ClientApplication
          UserManagedClientApplicationClientId: "STRING_VALUE",
          AWSManagedClientApplicationReference: "STRING_VALUE",
        },
        TokenUrl: "STRING_VALUE",
        TokenUrlParametersMap: { // TokenUrlParametersMap
          "<keys>": "STRING_VALUE",
        },
        AuthorizationCodeProperties: { // AuthorizationCodeProperties
          AuthorizationCode: "STRING_VALUE",
          RedirectUri: "STRING_VALUE",
        },
        OAuth2Credentials: { // OAuth2Credentials
          UserManagedClientApplicationClientSecret: "STRING_VALUE",
          AccessToken: "STRING_VALUE",
          RefreshToken: "STRING_VALUE",
          JwtToken: "STRING_VALUE",
        },
      },
      SecretArn: "STRING_VALUE",
      KmsKeyArn: "STRING_VALUE",
      BasicAuthenticationCredentials: { // BasicAuthenticationCredentials
        Username: "STRING_VALUE",
        Password: "STRING_VALUE",
      },
      CustomAuthenticationCredentials: { // CredentialMap
        "<keys>": "STRING_VALUE",
      },
    },
  },
};
const command = new TestConnectionCommand(input);
const response = await client.send(command);
// {};

TestConnectionCommand Input

See TestConnectionCommandInput for more details

Parameter
Type
Description
CatalogId
string | undefined

The catalog ID where the connection resides.

ConnectionName
string | undefined

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

TestConnectionInput
TestConnectionInput | undefined

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

TestConnectionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AccessDeniedException
client

Access to a resource was denied.

ConflictException
client

The CreatePartitions API was called on a table that has indexes enabled.

EntityNotFoundException
client

A specified entity does not exist

FederationSourceException
client

A federation source failed.

GlueEncryptionException
client

An encryption operation failed.

InternalServiceException
server

An internal service error occurred.

InvalidInputException
client

The input provided was not valid.

OperationTimeoutException
client

The operation timed out.

ResourceNumberLimitExceededException
client

A resource numerical limit was exceeded.

GlueServiceException
Base exception class for all service exceptions from Glue service.