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

3.693.0 • Public • Published

@aws-sdk/client-trustedadvisor

Description

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

TrustedAdvisor Public API

Installing

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

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

Getting Started

Import

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

// ES5 example
const { TrustedAdvisorClient, ListChecksCommand } = require("@aws-sdk/client-trustedadvisor");
// ES6+ example
import { TrustedAdvisorClient, ListChecksCommand } from "@aws-sdk/client-trustedadvisor";

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 TrustedAdvisorClient({ region: "REGION" });

const params = {
  /** input parameters */
};
const command = new ListChecksCommand(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-trustedadvisor";
const client = new AWS.TrustedAdvisor({ region: "REGION" });

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

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

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

BatchUpdateRecommendationResourceExclusion

Command API Reference / Input / Output

GetOrganizationRecommendation

Command API Reference / Input / Output

GetRecommendation

Command API Reference / Input / Output

ListChecks

Command API Reference / Input / Output

ListOrganizationRecommendationAccounts

Command API Reference / Input / Output

ListOrganizationRecommendationResources

Command API Reference / Input / Output

ListOrganizationRecommendations

Command API Reference / Input / Output

ListRecommendationResources

Command API Reference / Input / Output

ListRecommendations

Command API Reference / Input / Output

UpdateOrganizationRecommendationLifecycle

Command API Reference / Input / Output

UpdateRecommendationLifecycle

Command API Reference / Input / Output

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.693.072latest

Version History

VersionDownloads (Last 7 Days)Published
3.693.072
3.692.054
3.691.067
3.687.068
3.686.014
3.682.051
3.679.03
3.678.01
3.677.02
3.675.02
3.670.01
3.669.01
3.668.01
3.667.01
3.666.01
3.665.01
3.664.03
3.662.01
3.658.11
3.658.01
3.654.01
3.651.11
3.650.01
3.649.01
3.645.01
3.637.047
3.635.01
3.632.01
3.631.01
3.629.01
3.624.01
3.623.01
3.622.01
3.621.01
3.620.11
3.620.02
3.616.01
3.614.02
3.613.01
3.609.01
3.606.01
3.600.01
3.598.01
3.596.03
3.592.01
3.590.01
3.588.01
3.587.01
3.583.01
3.582.01
3.577.01
3.576.01
3.575.02
3.574.01
3.572.01
3.569.01
3.568.01
3.567.01
3.565.01
3.564.01
3.563.01
3.556.01
3.554.02
3.552.01
3.549.02
3.540.02
3.535.01
3.533.01
3.529.11
3.529.01
3.525.01
3.523.01
3.521.01
3.515.01
3.514.01
3.513.02
3.511.01
3.509.01
3.507.02
3.504.02
3.503.13
3.503.02
3.502.02
3.501.02
3.499.02
3.496.01
3.495.01
3.490.01
3.489.02
3.485.01
3.484.02
3.481.01
3.478.02
3.477.01
3.476.02
3.474.01
3.473.01
3.470.01
3.468.02
3.465.01
3.462.01
3.461.01
3.460.02
3.458.01
3.454.0209

Package Sidebar

Install

npm i @aws-sdk/client-trustedadvisor

Weekly Downloads

708

Version

3.693.0

License

Apache-2.0

Unpacked Size

400 kB

Total Files

125

Last publish

Collaborators

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