Search in sources :

Example 1 with DeleteTopicRequest

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

the class DeleteTopic method deleteSNSTopic.

// snippet-start:[sns.java2.DeleteTopic.main]
public static void deleteSNSTopic(SnsClient snsClient, String topicArn) {
    try {
        DeleteTopicRequest request = DeleteTopicRequest.builder().topicArn(topicArn).build();
        DeleteTopicResponse result = snsClient.deleteTopic(request);
        System.out.println("\n\nStatus was " + result.sdkHttpResponse().statusCode());
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : DeleteTopicResponse(software.amazon.awssdk.services.sns.model.DeleteTopicResponse) DeleteTopicRequest(software.amazon.awssdk.services.sns.model.DeleteTopicRequest) SnsException(software.amazon.awssdk.services.sns.model.SnsException)

Aggregations

DeleteTopicRequest (software.amazon.awssdk.services.sns.model.DeleteTopicRequest)1 DeleteTopicResponse (software.amazon.awssdk.services.sns.model.DeleteTopicResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1