Untagging a resource - AWS HealthImaging

Untagging a resource

Use the UntagResource action to untag data stores and image sets in AWS HealthImaging. The following code examples describe how to use the UntagResource action with the AWS Management Console, AWS CLI, and AWS SDKs. For more information, see Tagging your AWS resources in the AWS General Reference Guide.

To untag a resource

Choose a menu based on your access preference to AWS HealthImaging.

  1. Open the HealthImaging console Data stores page.

  2. Choose a data store.

    The Data store details page opens.

  3. Choose the Details tab.

  4. Under the Tags section, choose Manage tags.

    The Manage tags page opens.

  5. Choose Remove next to the tag you want to remove.

  6. Choose Save changes.

CLI
AWS CLI

Example 1: To untag a data store

The following untag-resource code example untags a data store.

aws medical-imaging untag-resource \ --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012" \ --tag-keys '["Deployment"]'

This command produces no output.

Example 2: To untag an image set

The following untag-resource code example untags an image set.

aws medical-imaging untag-resource \ --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/18f88ac7870584f58d56256646b4d92b" \ --tag-keys '["Deployment"]'

This command produces no output.

  • For API details, see UntagResource in AWS CLI Command Reference.

Java
SDK for Java 2.x
public static void untagMedicalImagingResource(MedicalImagingClient medicalImagingClient, String resourceArn, Collection<String> tagKeys) { try { UntagResourceRequest untagResourceRequest = UntagResourceRequest.builder() .resourceArn(resourceArn) .tagKeys(tagKeys) .build(); medicalImagingClient.untagResource(untagResourceRequest); System.out.println("Tags have been removed from the resource."); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
  • For API details, see UntagResource 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 { UntagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {string[]} tagKeys - The keys of the tags to remove. */ export const untagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tagKeys = [], ) => { const response = await medicalImagingClient.send( new UntagResourceCommand({ resourceArn: resourceArn, tagKeys: tagKeys }), ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };
  • For API details, see UntagResource 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 untag_resource(self, resource_arn, tag_keys): """ Untag a resource. :param resource_arn: The ARN of the resource. :param tag_keys: The tag keys to remove. """ try: self.health_imaging_client.untag_resource( resourceArn=resource_arn, tagKeys=tag_keys ) except ClientError as err: logger.error( "Couldn't untag resource. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise

The following code instantiates the MedicalImagingWrapper object.

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
  • For API details, see UntagResource 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.

Example availability

Can't find what you need? Request a code example using the Provide feedback link on the right sidebar of this page.