forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.js
More file actions
37 lines (34 loc) · 1.19 KB
/
hello.js
File metadata and controls
37 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[iotsitewise.JavaScript.Basics.hello]
import {
paginateListAssetModels,
IoTSiteWiseClient,
} from "@aws-sdk/client-iotsitewise";
// Call ListDocuments and display the result.
export const main = async () => {
const client = new IoTSiteWiseClient();
const listAssetModelsPaginated = [];
console.log(
"Hello, AWS Systems Manager! Let's list some of your documents:\n",
);
try {
// The paginate function is a wrapper around the base command.
const paginator = paginateListAssetModels({ client }, { maxResults: 5 });
for await (const page of paginator) {
listAssetModelsPaginated.push(...page.assetModelSummaries);
}
} catch (caught) {
console.error(`There was a problem saying hello: ${caught.message}`);
throw caught;
}
for (const { name, creationDate } of listAssetModelsPaginated) {
console.log(`${name} - ${creationDate}`);
}
};
// Call function if run directly.
import { fileURLToPath } from "node:url";
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main();
}
// snippet-end:[iotsitewise.JavaScript.Basics.hello]