Back to Aws Sdk Js V3

@aws-sdk/client-amp

clients/client-amp/README.md

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

@aws-sdk/client-amp

Description

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

<p>Amazon Managed Service for Prometheus is a serverless, Prometheus-compatible monitoring service for container metrics that makes it easier to securely monitor container environments at scale. With Amazon Managed Service for Prometheus, you can use the same open-source Prometheus data model and query language that you use today to monitor the performance of your containerized workloads, and also enjoy improved scalability, availability, and security without having to manage the underlying infrastructure.</p> <p>For more information about Amazon Managed Service for Prometheus, see the <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/what-is-Amazon-Managed-Service-Prometheus.html">Amazon Managed Service for Prometheus</a> User Guide.</p> <p>Amazon Managed Service for Prometheus includes two APIs.</p> <ul> <li> <p>Use the Amazon Web Services API described in this guide to manage Amazon Managed Service for Prometheus resources, such as workspaces, rule groups, and alert managers.</p> </li> <li> <p>Use the <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-APIReference.html#AMP-APIReference-Prometheus-Compatible-Apis">Prometheus-compatible API</a> to work within your Prometheus workspace.</p> </li> </ul>

Installing

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

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

Getting Started

Import

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

js
// ES5 example
const { AmpClient, ListScrapersCommand } = require("@aws-sdk/client-amp");
ts
// ES6+ example
import { AmpClient, ListScrapersCommand } from "@aws-sdk/client-amp";

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

const params = { /** input parameters */ };
const command = new ListScrapersCommand(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.

Amp extends AmpClient 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 (AmpClient). More details are in the blog post on modular packages in AWS SDK for JavaScript.

ts
import { Amp } from "@aws-sdk/client-amp";

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

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

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

// callbacks (not recommended).
client.listScrapers(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-amp 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> CreateAlertManagerDefinition </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateAnomalyDetector </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateQueryLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateRuleGroupsNamespace </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateScraper </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateWorkspace </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteAlertManagerDefinition </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteAnomalyDetector </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteQueryLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteResourcePolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteRuleGroupsNamespace </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteScraper </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteScraperLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteWorkspace </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeAlertManagerDefinition </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeAnomalyDetector </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeQueryLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeResourcePolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeRuleGroupsNamespace </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeScraper </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeScraperLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeWorkspace </summary>

Command API Reference / Input / Output

</details> <details> <summary> DescribeWorkspaceConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDefaultScraperConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListAnomalyDetectors </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListRuleGroupsNamespaces </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListScrapers </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListTagsForResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListWorkspaces </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutAlertManagerDefinition </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutAnomalyDetector </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutResourcePolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutRuleGroupsNamespace </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> UpdateLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateQueryLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateScraper </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateScraperLoggingConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateWorkspaceAlias </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateWorkspaceConfiguration </summary>

Command API Reference / Input / Output

</details>