Search in sources :

Example 1 with ListTopicsRequest

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

the class ListTopics method listSNSTopics.

// snippet-start:[sns.java2.ListTopics.main]
public static void listSNSTopics(SnsClient snsClient) {
    try {
        ListTopicsRequest request = ListTopicsRequest.builder().build();
        ListTopicsResponse result = snsClient.listTopics(request);
        System.out.println("Status was " + result.sdkHttpResponse().statusCode() + "\n\nTopics\n\n" + result.topics());
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : ListTopicsRequest(software.amazon.awssdk.services.sns.model.ListTopicsRequest) SnsException(software.amazon.awssdk.services.sns.model.SnsException) ListTopicsResponse(software.amazon.awssdk.services.sns.model.ListTopicsResponse)

Aggregations

ListTopicsRequest (software.amazon.awssdk.services.sns.model.ListTopicsRequest)1 ListTopicsResponse (software.amazon.awssdk.services.sns.model.ListTopicsResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1