-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathlist-image-set-versions.js
More file actions
60 lines (54 loc) · 1.93 KB
/
list-image-set-versions.js
File metadata and controls
60 lines (54 loc) · 1.93 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { fileURLToPath } from "node:url";
// snippet-start:[medical-imaging.JavaScript.imageset.listImageSetVersionsV3]
import { paginateListImageSetVersions } from "@aws-sdk/client-medical-imaging";
import { medicalImagingClient } from "../libs/medicalImagingClient.js";
/**
* @param {string} datastoreId - The ID of the data store.
* @param {string} imageSetId - The ID of the image set.
*/
export const listImageSetVersions = async (
datastoreId = "xxxxxxxxxxxx",
imageSetId = "xxxxxxxxxxxx",
) => {
const paginatorConfig = {
client: medicalImagingClient,
pageSize: 50,
};
const commandParams = { datastoreId, imageSetId };
const paginator = paginateListImageSetVersions(
paginatorConfig,
commandParams,
);
const imageSetPropertiesList = [];
for await (const page of paginator) {
// Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`.
imageSetPropertiesList.push(...page.imageSetPropertiesList);
console.log(page);
}
// {
// '$metadata': {
// httpStatusCode: 200,
// requestId: '74590b37-a002-4827-83f2-3c590279c742',
// extendedRequestId: undefined,
// cfId: undefined,
// attempts: 1,
// totalRetryDelay: 0
// },
// imageSetPropertiesList: [
// {
// ImageSetWorkflowStatus: 'CREATED',
// createdAt: 2023-09-22T14:49:26.427Z,
// imageSetId: 'xxxxxxxxxxxxxxxxxxxxxxx',
// imageSetState: 'ACTIVE',
// versionId: '1'
// }]
// }
return imageSetPropertiesList;
};
// snippet-end:[medical-imaging.JavaScript.imageset.listImageSetVersionsV3]
// Invoke the following code if this file is being run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
await listImageSetVersions();
}