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

3.698.0 • Public • Published

@aws-sdk/client-health

Description

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

Health

The Health API provides access to the Health information that appears in the Health Dashboard. You can use the API operations to get information about events that might affect your Amazon Web Services services and resources.

You must have a Business, Enterprise On-Ramp, or Enterprise Support plan from Amazon Web Services Support to use the Health API. If you call the Health API from an Amazon Web Services account that doesn't have a Business, Enterprise On-Ramp, or Enterprise Support plan, you receive a SubscriptionRequiredException error.

For API access, you need an access key ID and a secret access key. Use temporary credentials instead of long-term access keys when possible. Temporary credentials include an access key ID, a secret access key, and a security token that indicates when the credentials expire. For more information, see Best practices for managing Amazon Web Services access keys in the Amazon Web Services General Reference.

You can use the Health endpoint health.us-east-1.amazonaws.com (HTTPS) to call the Health API operations. Health supports a multi-Region application architecture and has two regional endpoints in an active-passive configuration. You can use the high availability endpoint example to determine which Amazon Web Services Region is active, so that you can get the latest information from the API. For more information, see Accessing the Health API in the Health User Guide.

For authentication of requests, Health uses the Signature Version 4 Signing Process.

If your Amazon Web Services account is part of Organizations, you can use the Health organizational view feature. This feature provides a centralized view of Health events across all accounts in your organization. You can aggregate Health events in real time to identify accounts in your organization that are affected by an operational event or get notified of security vulnerabilities. Use the organizational view API operations to enable this feature and return event information. For more information, see Aggregating Health events in the Health User Guide.

When you use the Health API operations to return Health events, see the following recommendations:

  • Use the eventScopeCode parameter to specify whether to return Health events that are public or account-specific.

  • Use pagination to view all events from the response. For example, if you call the DescribeEventsForOrganization operation to get all events in your organization, you might receive several page results. Specify the nextToken in the next request to return more results.

Installing

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

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

Getting Started

Import

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

// ES5 example
const { HealthClient, DescribeEventsCommand } = require("@aws-sdk/client-health");
// ES6+ example
import { HealthClient, DescribeEventsCommand } from "@aws-sdk/client-health";

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

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

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

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

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

DescribeAffectedAccountsForOrganization

Command API Reference / Input / Output

DescribeAffectedEntities

Command API Reference / Input / Output

DescribeAffectedEntitiesForOrganization

Command API Reference / Input / Output

DescribeEntityAggregates

Command API Reference / Input / Output

DescribeEntityAggregatesForOrganization

Command API Reference / Input / Output

DescribeEventAggregates

Command API Reference / Input / Output

DescribeEventDetails

Command API Reference / Input / Output

DescribeEventDetailsForOrganization

Command API Reference / Input / Output

DescribeEvents

Command API Reference / Input / Output

DescribeEventsForOrganization

Command API Reference / Input / Output

DescribeEventTypes

Command API Reference / Input / Output

DescribeHealthServiceStatusForOrganization

Command API Reference / Input / Output

DisableHealthServiceAccessForOrganization

Command API Reference / Input / Output

EnableHealthServiceAccessForOrganization

Command API Reference / Input / Output

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.0-gamma.110gamma
1.0.0-beta.50beta
1.0.0-alpha.260alpha
3.698.056latest

Version History

VersionDownloads (Last 7 Days)Published
3.698.056
3.696.061
3.693.0144
3.692.08
3.691.034
3.687.019
3.686.045
3.682.00
3.679.05
3.678.00
3.677.01
3.675.017
3.670.00
3.669.00
3.668.00
3.667.00
3.666.00
3.665.00
3.664.00
3.662.011,741
3.658.14
3.658.03
3.654.00
3.651.10
3.650.00
3.649.00
3.645.085
3.637.017,053
3.635.00
3.632.025
3.631.00
3.629.04
3.624.02
3.623.00
3.622.00
3.621.00
3.620.10
3.620.00
3.616.00
3.614.05
3.613.00
3.609.00
3.606.00
3.600.05
3.598.00
3.596.00
3.592.00
3.590.00
3.588.00
3.587.00
3.583.00
3.582.00
3.577.00
3.576.00
3.575.00
3.574.00
3.572.00
3.569.021
3.568.00
3.567.00
3.565.00
3.564.00
3.563.00
3.556.00
3.554.00
3.552.00
3.549.00
3.540.00
3.535.00
3.533.00
3.529.10
3.529.00
3.525.00
3.523.00
3.521.00
3.515.00
3.514.00
3.513.00
3.511.00
3.509.00
3.507.00
3.504.00
3.503.11
3.503.00
3.502.00
3.501.00
3.499.00
3.496.00
3.495.00
3.490.02
3.489.00
3.485.00
3.484.00
3.481.00
3.478.00
3.477.00
3.476.00
3.474.00
3.473.00
3.470.00
3.468.00
3.465.00
3.462.00
3.461.00
3.460.00
3.458.00
3.454.00
3.451.00
3.450.00
3.449.00
3.445.00
3.441.00
3.438.00
3.437.00
3.436.00
3.435.00
3.433.00
3.431.010
3.430.00
3.429.00
3.428.00
3.427.00
3.425.00
3.423.00
3.421.00
3.418.00
3.414.00
3.413.00
3.410.00
3.409.00
3.408.00
3.405.00
3.404.00
3.398.00
3.395.00
3.391.00
3.388.00
3.387.00
3.386.00
3.385.00
3.382.048
3.379.10
3.378.00
3.377.00
3.370.00
3.369.00
3.363.00
3.362.00
3.360.00
3.359.00
3.358.00
3.357.00
3.354.00
3.353.00
3.352.00
3.350.00
3.348.00
3.347.10
3.347.00
3.345.00
3.344.00
3.342.00
3.341.00
3.338.00
3.337.00
3.335.00
3.332.00
3.329.013
3.328.00
3.327.00
3.326.00
3.325.00
3.321.10
3.319.00
3.316.00
3.315.00
3.312.00
3.310.00
3.309.00
3.306.00
3.303.00
3.301.00
3.300.00
3.299.00
3.298.00
3.297.01
3.296.00
3.295.00
3.294.00
3.293.00
3.292.00
3.290.00
3.289.00
3.288.00
3.287.00
3.282.00
3.281.00
3.279.00
3.278.00
3.276.00
3.272.00
3.271.00
3.267.00
3.266.10
3.266.00
3.264.00
3.262.00
3.261.00
3.259.00
3.258.00
3.257.02
3.256.00
3.254.00
3.252.00
3.245.00
3.241.00
3.238.00
3.236.00
3.235.00
3.234.00
3.231.00
3.229.00
3.226.00
3.224.00
3.223.00
3.222.00
3.218.00
3.216.00
3.215.00
3.213.00
3.212.00
3.211.00
3.210.00
3.209.00
3.208.00
3.204.00
3.202.00
3.201.00
3.200.00
3.199.00
3.198.00
3.197.00
3.196.00
3.195.00
3.194.00
3.193.00
3.192.00
3.190.00
3.188.00
3.186.00
3.185.01
3.183.00
3.181.00
3.180.00
3.179.00
3.178.00
3.171.00
3.170.00
3.169.00
3.168.00
3.165.00
3.163.00
3.162.00
3.161.00
3.160.00
3.159.00
3.154.00
3.150.00
3.145.00
3.142.00
3.141.00
3.137.00
3.132.00
3.131.00
3.130.00
3.128.00
3.127.00
3.121.00
3.118.10
3.118.00
3.112.00
3.110.00
3.109.00
3.105.00
3.100.00
3.99.00
3.95.05
3.94.00
3.92.00
3.87.00
3.85.00
3.82.00
3.81.00
3.80.00
3.79.00
3.78.00
3.76.00
3.75.00
3.74.00
3.72.00
3.67.00
3.58.00
3.56.00
3.55.00
3.54.10
3.54.00
3.53.00
3.52.00
3.51.00
3.50.00
3.49.00
3.48.00
3.47.20
3.47.10
3.47.00
3.46.00
3.45.00
3.43.00
3.42.00
3.41.00
3.40.00
3.39.00
3.38.00
3.37.00
3.36.10
3.36.00
3.35.00
3.34.00
3.33.00
3.32.00
3.31.00
3.30.00
3.29.00
3.28.00
3.27.00
3.26.00
3.25.00
3.24.00
3.23.00
3.22.00
3.21.00
3.20.00
3.19.00
3.18.00
3.17.00
3.16.00
3.15.00
3.14.00
3.13.10
3.13.00
3.12.00
3.11.00
3.10.00
3.9.00
3.8.10
3.8.00
3.7.00
3.6.10
3.6.00
3.5.00
3.4.10
3.4.00
3.3.00
3.2.00
3.1.00
3.0.00
1.0.0-rc.100
1.0.0-rc.90
1.0.0-rc.80
1.0.0-rc.70
1.0.0-rc.60
1.0.0-rc.50
1.0.0-rc.40
1.0.0-rc.30
1.0.0-rc.20
1.0.0-rc.10
1.0.0-gamma.110
1.0.0-gamma.100
1.0.0-gamma.90
1.0.0-gamma.80
1.0.0-gamma.70
1.0.0-gamma.60
1.0.0-gamma.50
1.0.0-gamma.40
1.0.0-gamma.30
1.0.0-gamma.20
1.0.0-gamma.10
1.0.0-beta.50
1.0.0-beta.40
1.0.0-beta.30
1.0.0-beta.20
1.0.0-beta.10
1.0.0-alpha.260
1.0.0-alpha.250
1.0.0-alpha.240
1.0.0-alpha.230
1.0.0-alpha.220
1.0.0-alpha.210
1.0.0-alpha.200
1.0.0-alpha.190
1.0.0-alpha.180
1.0.0-alpha.170
1.0.0-alpha.160
1.0.0-alpha.150
1.0.0-alpha.140
1.0.0-alpha.130
1.0.0-alpha.120
1.0.0-alpha.110
1.0.0-alpha.100
1.0.0-alpha.90
1.0.0-alpha.81
1.0.0-alpha.70
1.0.0-alpha.60
1.0.0-alpha.50
1.0.0-alpha.40
1.0.0-alpha.30
1.0.0-alpha.20
1.0.0-alpha.10

Package Sidebar

Install

npm i @aws-sdk/client-health

Weekly Downloads

29,422

Version

3.698.0

License

Apache-2.0

Unpacked Size

453 kB

Total Files

137

Last publish

Collaborators

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