Search in sources :

Example 1 with ListTagsForResourceResponse

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

the class ListTags method listTopicTags.

// snippet-start:[sns.java2.list_tags.main]
public static void listTopicTags(SnsClient snsClient, String topicArn) {
    try {
        ListTagsForResourceRequest tagsForResourceRequest = ListTagsForResourceRequest.builder().resourceArn(topicArn).build();
        ListTagsForResourceResponse response = snsClient.listTagsForResource(tagsForResourceRequest);
        System.out.println(String.format("Tags for topic %s are %s.\n", topicArn, response.tags()));
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : ListTagsForResourceResponse(software.amazon.awssdk.services.sns.model.ListTagsForResourceResponse) ListTagsForResourceRequest(software.amazon.awssdk.services.sns.model.ListTagsForResourceRequest) SnsException(software.amazon.awssdk.services.sns.model.SnsException)

Aggregations

ListTagsForResourceRequest (software.amazon.awssdk.services.sns.model.ListTagsForResourceRequest)1 ListTagsForResourceResponse (software.amazon.awssdk.services.sns.model.ListTagsForResourceResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1