Back to Aws Sdk Js V3

@aws-sdk/client-direct-connect

clients/client-direct-connect/README.md

3.1043.038.3 KB
Original Source
<!-- generated file, do not edit directly -->

@aws-sdk/client-direct-connect

Description

AWS SDK for JavaScript DirectConnect Client for Node.js, Browser and React Native.

<p>Direct Connect links your internal network to an Direct Connect location over a standard Ethernet fiber-optic cable. One end of the cable is connected to your router, the other to an Direct Connect router. With this connection in place, you can create virtual interfaces directly to the Amazon Web Services Cloud (for example, to Amazon EC2 and Amazon S3) and to Amazon VPC, bypassing Internet service providers in your network path. A connection provides access to all Amazon Web Services Regions except the China (Beijing) and (China) Ningxia Regions. Amazon Web Services resources in the China Regions can only be accessed through locations associated with those Regions.</p>

Installing

To install this package, use the CLI of your favorite package manager:

  • npm install @aws-sdk/client-direct-connect
  • yarn add @aws-sdk/client-direct-connect
  • pnpm add @aws-sdk/client-direct-connect

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the DirectConnectClient and the commands you need, for example ListVirtualInterfaceTestHistoryCommand:

js
// ES5 example
const { DirectConnectClient, ListVirtualInterfaceTestHistoryCommand } = require("@aws-sdk/client-direct-connect");
ts
// ES6+ example
import { DirectConnectClient, ListVirtualInterfaceTestHistoryCommand } from "@aws-sdk/client-direct-connect";

Usage

To send a request:

  • Instantiate a client with configuration (e.g. credentials, region).
  • Instantiate a command with input parameters.
  • Call the send operation on the client, providing the command object as input.
js
const client = new DirectConnectClient({ region: "REGION" });

const params = { /** input parameters */ };
const command = new ListVirtualInterfaceTestHistoryCommand(params);

Async/await

We recommend using the await operator to wait for the promise returned by send operation as follows:

js
// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Promises

You can also use Promise chaining.

js
client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Aggregated client

The aggregated client class is exported from the same package, but without the "Client" suffix.

DirectConnect extends DirectConnectClient and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.

If you are bundling the AWS SDK, we recommend using only the bare-bones client (DirectConnectClient). More details are in the blog post on modular packages in AWS SDK for JavaScript.

ts
import { DirectConnect } from "@aws-sdk/client-direct-connect";

const client = new DirectConnect({ region: "REGION" });

// async/await.
try {
  const data = await client.listVirtualInterfaceTestHistory(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listVirtualInterfaceTestHistory(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.listVirtualInterfaceTestHistory(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

js
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-direct-connect package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

<details> <summary> AcceptDirectConnectGatewayAssociationProposal </summary>

Command API Reference / Input / Output

</details> <details> <summary> AllocateConnectionOnInterconnect </summary>

Command API Reference / Input / Output

</details> <details> <summary> AllocateHostedConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> AllocatePrivateVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> AllocatePublicVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> AllocateTransitVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> AssociateConnectionWithLag </summary>

Command API Reference / Input / Output

</details> <details> <summary> AssociateHostedConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> AssociateMacSecKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> AssociateVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> ConfirmConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> ConfirmCustomerAgreement </summary>

Command API Reference / Input / Output

</details> <details> <summary> ConfirmPrivateVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> ConfirmPublicVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> ConfirmTransitVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateBGPPeer </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDirectConnectGateway </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDirectConnectGatewayAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDirectConnectGatewayAssociationProposal </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateInterconnect </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateLag </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreatePrivateVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreatePublicVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateTransitVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteBGPPeer </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDirectConnectGateway </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDirectConnectGatewayAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDirectConnectGatewayAssociationProposal </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteInterconnect </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteLag </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteVirtualInterface </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeConnectionLoa </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeConnections </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeConnectionsOnInterconnect </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeCustomerMetadata </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeDirectConnectGatewayAssociationProposals </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeDirectConnectGatewayAssociations </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeDirectConnectGatewayAttachments </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeDirectConnectGateways </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeHostedConnections </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeInterconnectLoa </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeInterconnects </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeLags </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeLoa </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeLocations </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeRouterConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeTags </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeVirtualGateways </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeVirtualInterfaces </summary>

Command API Reference / Input / Output

</details> <details> <summary> DisassociateConnectionFromLag </summary>

Command API Reference / Input / Output

</details> <details> <summary> DisassociateMacSecKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListVirtualInterfaceTestHistory </summary>

Command API Reference / Input / Output

</details> <details> <summary> StartBgpFailoverTest </summary>

Command API Reference / Input / Output

</details> <details> <summary> StopBgpFailoverTest </summary>

Command API Reference / Input / Output

</details> <details> <summary> TagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UntagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDirectConnectGateway </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDirectConnectGatewayAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateLag </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateVirtualInterfaceAttributes </summary>

Command API Reference / Input / Output

</details>