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);
}
}
Aggregations