Search in sources :

Example 1 with UntagQueueRequest

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

the class RemoveQueueTag method removeTag.

// snippet-start:[sqs.java2.remove_tag.main]
public static void removeTag(SqsClient sqsClient, String queueName, String tagName) {
    try {
        GetQueueUrlRequest urlRequest = GetQueueUrlRequest.builder().queueName(queueName).build();
        GetQueueUrlResponse getQueueUrlResponse = sqsClient.getQueueUrl(urlRequest);
        String queueUrl = getQueueUrlResponse.queueUrl();
        UntagQueueRequest untagQueueRequest = UntagQueueRequest.builder().queueUrl(queueUrl).tagKeys(tagName).build();
        sqsClient.untagQueue(untagQueueRequest);
        System.out.println("The " + tagName + " tag was removed from  " + queueName);
    } catch (SqsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : GetQueueUrlRequest(software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest) SqsException(software.amazon.awssdk.services.sqs.model.SqsException) UntagQueueRequest(software.amazon.awssdk.services.sqs.model.UntagQueueRequest) GetQueueUrlResponse(software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse)

Aggregations

GetQueueUrlRequest (software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest)1 GetQueueUrlResponse (software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse)1 SqsException (software.amazon.awssdk.services.sqs.model.SqsException)1 UntagQueueRequest (software.amazon.awssdk.services.sqs.model.UntagQueueRequest)1