Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.
|
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||
|
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
|
||
|
|
#include <iostream>
|
||
|
|
#include <aws/core/Aws.h>
|
||
|
|
#include <aws/medical-imaging/MedicalImagingClient.h>
|
||
|
|
#include <aws/medical-imaging/model/DeleteImageSetRequest.h>
|
||
|
|
#include "medical-imaging_samples.h"
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Before running this C++ code example, set up your development environment, including your credentials.
|
||
|
|
*
|
||
|
|
* For more information, see the following documentation topic:
|
||
|
|
*
|
||
|
|
* https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started.html
|
||
|
|
*
|
||
|
|
* For information on the structure of the code examples and how to build and run the examples, see
|
||
|
|
* https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started-code-examples.html.
|
||
|
|
*
|
||
|
|
**/
|
||
|
|
|
||
|
|
// snippet-start:[cpp.example_code.medical_imaging.DeleteImageSet]
|
||
|
|
//! 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();
|
||
|
|
}
|
||
|
|
// snippet-end:[cpp.example_code.medical_imaging.DeleteImageSet]
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
* main function
|
||
|
|
*
|
||
|
|
* Usage: 'run_delete_image_set <datastore_id> <image_set_id>'
|
||
|
|
*
|
||
|
|
* Prerequisites: A HealthImaging data store and an image set.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
#ifndef TESTING_BUILD
|
||
|
|
|
||
|
|
int main(int argc, char **argv) {
|
||
|
|
if (argc != 3) {
|
||
|
|
std::cout
|
||
|
|
<< "Usage: 'run_delete_image_set <datastore_id> <image_set_id>'"
|
||
|
|
<< std::endl;
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
Aws::SDKOptions options;
|
||
|
|
Aws::InitAPI(options);
|
||
|
|
{
|
||
|
|
Aws::String dataStoreID = argv[1];
|
||
|
|
Aws::String imageSetID = argv[2];
|
||
|
|
|
||
|
|
Aws::Client::ClientConfiguration clientConfig;
|
||
|
|
// Optional: Set to the AWS Region in which the bucket was created (overrides config file).
|
||
|
|
// clientConfig.region = "us-east-1";
|
||
|
|
|
||
|
|
AwsDoc::Medical_Imaging::deleteImageSet(dataStoreID, imageSetID, clientConfig);
|
||
|
|
}
|
||
|
|
Aws::ShutdownAPI(options);
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // TESTING_BUILD
|
||
|
|
|
||
|
|
|