Back to Aws Sdk Js V3

@aws-sdk/client-pcs

clients/client-pcs/README.md

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

@aws-sdk/client-pcs

Description

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

<p>Parallel Computing Service (PCS) is a managed service that makes it easier for you to run and scale your high performance computing (HPC) workloads, and build scientific and engineering models on Amazon Web Services using Slurm. For more information, see the <a href="https://docs.aws.amazon.com/pcs/latest/userguide">Parallel Computing Service User Guide</a>.</p> <p>This reference describes the actions and data types of the service management API. You can use the Amazon Web Services SDKs to call the API actions in software, or use the Command Line Interface (CLI) to call the API actions manually. These API actions manage the service through an Amazon Web Services account.</p> <p>The API actions operate on PCS resources. A <i>resource</i> is an entity in Amazon Web Services that you can work with. Amazon Web Services services create resources when you use the features of the service. Examples of PCS resources include clusters, compute node groups, and queues. For more information about resources in Amazon Web Services, see <a href="https://docs.aws.amazon.com/resource-explorer/latest/userguide/getting-started-terms-and-concepts.html#term-resource">Resource</a> in the <i>Resource Explorer User Guide</i>. </p> <p>An PCS <i>compute node</i> is an Amazon EC2 instance. You don't launch compute nodes directly. PCS uses configuration information that you provide to launch compute nodes in your Amazon Web Services account. You receive billing charges for your running compute nodes. PCS automatically terminates your compute nodes when you delete the PCS resources related to those compute nodes.</p>

Installing

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

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

Getting Started

Import

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

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

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

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

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

ts
import { PCS } from "@aws-sdk/client-pcs";

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

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

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

// callbacks (not recommended).
client.listClusters(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-pcs 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> CreateCluster </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateComputeNodeGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateQueue </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteCluster </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteComputeNodeGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteQueue </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetCluster </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetComputeNodeGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetQueue </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListClusters </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListComputeNodeGroups </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListQueues </summary>

Command API Reference / Input / Output

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

Command API Reference / Input / Output

</details> <details> <summary> RegisterComputeNodeGroupInstance </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> UpdateCluster </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateComputeNodeGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateQueue </summary>

Command API Reference / Input / Output

</details>