There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DeleteImageSet
with an AWS SDK or CLI
The following code examples show how to use DeleteImageSet
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:
- C++
-
- SDK for C++
-
//! Routine which deletes an AWS HealthImaging image set. /*! \param dataStoreID: The HealthImaging data store ID. \param imageSetID: The image set ID. \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::Medical_Imaging::deleteImageSet( const Aws::String &dataStoreID, const Aws::String &imageSetID, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::MedicalImagingClient client(clientConfig); Aws::MedicalImaging::Model::DeleteImageSetRequest request; request.SetDatastoreId(dataStoreID); request.SetImageSetId(imageSetID); Aws::MedicalImaging::Model::DeleteImageSetOutcome outcome = client.DeleteImageSet( request); if (outcome.IsSuccess()) { std::cout << "Successfully deleted image set " << imageSetID << " from data store " << dataStoreID << std::endl; } else { std::cerr << "Error deleting image set " << imageSetID << " from data store " << dataStoreID << ": " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
-
For API details, see DeleteImageSet in AWS SDK for C++ API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- CLI
-
- AWS CLI
-
To delete an image set
The following
delete-image-set
code example deletes an image set.aws medical-imaging delete-image-set \ --datastore-id
12345678901234567890123456789012
\ --image-set-idea92b0d8838c72a3f25d00d13616f87e
Output:
{ "imageSetWorkflowStatus": "DELETING", "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "LOCKED", "datastoreId": "12345678901234567890123456789012" }
For more information, see Deleting an image set in the AWS HealthImaging Developer Guide.
-
For API details, see DeleteImageSet
in AWS CLI Command Reference.
-
- Java
-
- SDK for Java 2.x
-
public static void deleteMedicalImageSet(MedicalImagingClient medicalImagingClient, String datastoreId, String imagesetId) { try { DeleteImageSetRequest deleteImageSetRequest = DeleteImageSetRequest.builder() .datastoreId(datastoreId) .imageSetId(imagesetId) .build(); medicalImagingClient.deleteImageSet(deleteImageSetRequest); System.out.println("The image set was deleted."); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
-
For API details, see DeleteImageSet in AWS SDK for Java 2.x API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- JavaScript
-
- SDK for JavaScript (v3)
-
import { DeleteImageSetCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The data store ID. * @param {string} imageSetId - The image set ID. */ export const deleteImageSet = async ( datastoreId = "xxxxxxxxxxxxxxxx", imageSetId = "xxxxxxxxxxxxxxxx", ) => { const response = await medicalImagingClient.send( new DeleteImageSetCommand({ datastoreId: datastoreId, imageSetId: imageSetId, }), ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '6267bbd2-eaa5-4a50-8ee8-8fddf535cf73', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxx', // imageSetState: 'LOCKED', // imageSetWorkflowStatus: 'DELETING' // } return response; };
-
For API details, see DeleteImageSet in AWS SDK for JavaScript API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- Python
-
- SDK for Python (Boto3)
-
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def delete_image_set(self, datastore_id, image_set_id): """ Delete an image set. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :return: The delete results. """ try: delete_results = self.health_imaging_client.delete_image_set( imageSetId=image_set_id, datastoreId=datastore_id ) except ClientError as err: logger.error( "Couldn't delete image set. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return delete_results
The following code instantiates the MedicalImagingWrapper object.
client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
-
For API details, see DeleteImageSet in AWS SDK for Python (Boto3) API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -