文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListImageSetVersions
搭配 a AWS SDK 或 CLI 使用
下列程式碼範例示範如何使用 ListImageSetVersions
。
- CLI
-
- AWS CLI
-
若要列出映像集版本
下列
list-image-set-versions
程式碼範例會列出映像集的版本歷史記錄。aws medical-imaging list-image-set-versions \ --datastore-id
12345678901234567890123456789012
\ --image-set-idea92b0d8838c72a3f25d00d13616f87e
輸出:
{ "imageSetPropertiesList": [ { "ImageSetWorkflowStatus": "UPDATED", "versionId": "4", "updatedAt": 1680029436.304, "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "ACTIVE", "createdAt": 1680027126.436 }, { "ImageSetWorkflowStatus": "UPDATED", "versionId": "3", "updatedAt": 1680029163.325, "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "ACTIVE", "createdAt": 1680027126.436 }, { "ImageSetWorkflowStatus": "COPY_FAILED", "versionId": "2", "updatedAt": 1680027455.944, "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "ACTIVE", "message": "INVALID_REQUEST: Series of SourceImageSet and DestinationImageSet don't match.", "createdAt": 1680027126.436 }, { "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "ACTIVE", "versionId": "1", "ImageSetWorkflowStatus": "COPIED", "createdAt": 1680027126.436 } ] }
如需詳細資訊,請參閱 AWS HealthImaging 開發人員指南中的列出映像集版本。
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListImageSetVersions
。
-
- Java
-
- Java 2.x 的 SDK
-
public static List<ImageSetProperties> listMedicalImageSetVersions(MedicalImagingClient medicalImagingClient, String datastoreId, String imagesetId) { try { ListImageSetVersionsRequest getImageSetRequest = ListImageSetVersionsRequest.builder() .datastoreId(datastoreId) .imageSetId(imagesetId) .build(); ListImageSetVersionsIterable responses = medicalImagingClient .listImageSetVersionsPaginator(getImageSetRequest); List<ImageSetProperties> imageSetProperties = new ArrayList<>(); responses.stream().forEach(response -> imageSetProperties.addAll(response.imageSetPropertiesList())); return imageSetProperties; } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return null; }
-
如需 API 詳細資訊,請參閱 ListImageSetVersions AWS SDK for Java 2.x 參考中的 API。
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 -
- JavaScript
-
- SDK for JavaScript (v3)
-
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; };
-
如需 API 詳細資訊,請參閱 ListImageSetVersions AWS SDK for JavaScript 參考中的 API。
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 -
- Python
-
- SDK for Python (Boto3)
-
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def list_image_set_versions(self, datastore_id, image_set_id): """ List the image set versions. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :return: The list of image set versions. """ try: paginator = self.health_imaging_client.get_paginator( "list_image_set_versions" ) page_iterator = paginator.paginate( imageSetId=image_set_id, datastoreId=datastore_id ) image_set_properties_list = [] for page in page_iterator: image_set_properties_list.extend(page["imageSetPropertiesList"]) except ClientError as err: logger.error( "Couldn't list image set versions. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return image_set_properties_list
下列程式碼會實例化 MedicalImagingWrapper 物件。
client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
-
如需 API 詳細資訊,請參閱 ListImageSetVersions AWS SDK for Python (Boto3) Word 參考中的 API。
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 -
ListDatastores
ListTagsForResource