Search in sources :

Example 1 with UntagResourceRequest

use of software.amazon.awssdk.services.sns.model.UntagResourceRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteTag method removeTag.

// snippet-start:[sns.java2.delete_tags.main]
public static void removeTag(SnsClient snsClient, String topicArn, String tagKey) {
    try {
        UntagResourceRequest resourceRequest = UntagResourceRequest.builder().resourceArn(topicArn).tagKeys(tagKey).build();
        snsClient.untagResource(resourceRequest);
        System.out.println(tagKey + " was deleted from " + topicArn);
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : UntagResourceRequest(software.amazon.awssdk.services.sns.model.UntagResourceRequest) SnsException(software.amazon.awssdk.services.sns.model.SnsException)

Aggregations

SnsException (software.amazon.awssdk.services.sns.model.SnsException)1 UntagResourceRequest (software.amazon.awssdk.services.sns.model.UntagResourceRequest)1