@aws-sdk/client-drs
TypeScript icon, indicating that this package has built-in type declarations

3.563.0 • Public • Published

@aws-sdk/client-drs

Description

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

AWS Elastic Disaster Recovery Service.

Installing

To install the this package, simply type add or install @aws-sdk/client-drs using your favorite package manager:

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

Getting Started

Import

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

// ES5 example
const { DrsClient, ListLaunchActionsCommand } = require("@aws-sdk/client-drs");
// ES6+ example
import { DrsClient, ListLaunchActionsCommand } from "@aws-sdk/client-drs";

Usage

To send a request, you:

  • Initiate client with configuration (e.g. credentials, region).
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
  • If you are using a custom http handler, you may call destroy() to close open connections.
// a client can be shared by different commands.
const client = new DrsClient({ region: "REGION" });

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

Async/await

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

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

Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

Promises

You can also use Promise chaining to execute send operation.

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

Promises can also be called using .catch() and .finally() as follows:

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

Callbacks

We do not recommend using callbacks because of callback hell, but they are supported by the send operation.

// callbacks.
client.send(command, (err, data) => {
  // process err and data.
});

v2 compatible style

The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript

import * as AWS from "@aws-sdk/client-drs";
const client = new AWS.Drs({ region: "REGION" });

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

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

// callbacks.
client.listLaunchActions(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).

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;
   * }
   */
}

Getting Help

Please use these community resources for getting help. We use the 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-drs 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)

AssociateSourceNetworkStack

Command API Reference / Input / Output

CreateExtendedSourceServer

Command API Reference / Input / Output

CreateLaunchConfigurationTemplate

Command API Reference / Input / Output

CreateReplicationConfigurationTemplate

Command API Reference / Input / Output

CreateSourceNetwork

Command API Reference / Input / Output

DeleteJob

Command API Reference / Input / Output

DeleteLaunchAction

Command API Reference / Input / Output

DeleteLaunchConfigurationTemplate

Command API Reference / Input / Output

DeleteRecoveryInstance

Command API Reference / Input / Output

DeleteReplicationConfigurationTemplate

Command API Reference / Input / Output

DeleteSourceNetwork

Command API Reference / Input / Output

DeleteSourceServer

Command API Reference / Input / Output

DescribeJobLogItems

Command API Reference / Input / Output

DescribeJobs

Command API Reference / Input / Output

DescribeLaunchConfigurationTemplates

Command API Reference / Input / Output

DescribeRecoveryInstances

Command API Reference / Input / Output

DescribeRecoverySnapshots

Command API Reference / Input / Output

DescribeReplicationConfigurationTemplates

Command API Reference / Input / Output

DescribeSourceNetworks

Command API Reference / Input / Output

DescribeSourceServers

Command API Reference / Input / Output

DisconnectRecoveryInstance

Command API Reference / Input / Output

DisconnectSourceServer

Command API Reference / Input / Output

ExportSourceNetworkCfnTemplate

Command API Reference / Input / Output

GetFailbackReplicationConfiguration

Command API Reference / Input / Output

GetLaunchConfiguration

Command API Reference / Input / Output

GetReplicationConfiguration

Command API Reference / Input / Output

InitializeService

Command API Reference / Input / Output

ListExtensibleSourceServers

Command API Reference / Input / Output

ListLaunchActions

Command API Reference / Input / Output

ListStagingAccounts

Command API Reference / Input / Output

ListTagsForResource

Command API Reference / Input / Output

PutLaunchAction

Command API Reference / Input / Output

RetryDataReplication

Command API Reference / Input / Output

ReverseReplication

Command API Reference / Input / Output

StartFailbackLaunch

Command API Reference / Input / Output

StartRecovery

Command API Reference / Input / Output

StartReplication

Command API Reference / Input / Output

StartSourceNetworkRecovery

Command API Reference / Input / Output

StartSourceNetworkReplication

Command API Reference / Input / Output

StopFailback

Command API Reference / Input / Output

StopReplication

Command API Reference / Input / Output

StopSourceNetworkReplication

Command API Reference / Input / Output

TagResource

Command API Reference / Input / Output

TerminateRecoveryInstances

Command API Reference / Input / Output

UntagResource

Command API Reference / Input / Output

UpdateFailbackReplicationConfiguration

Command API Reference / Input / Output

UpdateLaunchConfiguration

Command API Reference / Input / Output

UpdateLaunchConfigurationTemplate

Command API Reference / Input / Output

UpdateReplicationConfiguration

Command API Reference / Input / Output

UpdateReplicationConfigurationTemplate

Command API Reference / Input / Output

Readme

Keywords

none

Package Sidebar

Install

npm i @aws-sdk/client-drs

Weekly Downloads

90,785

Version

3.563.0

License

Apache-2.0

Unpacked Size

1.09 MB

Total Files

257

Last publish

Collaborators

  • mattsb42-aws
  • kuhe
  • amzn-oss
  • aws-sdk-bot
  • trivikr-aws