use of software.amazon.awssdk.services.sns.model.UnsubscribeRequest in project aws-doc-sdk-examples by awsdocs.
the class Unsubscribe method unSub.
// snippet-start:[sns.java2.Unsubscribe.main]
public static void unSub(SnsClient snsClient, String subscriptionArn) {
try {
UnsubscribeRequest request = UnsubscribeRequest.builder().subscriptionArn(subscriptionArn).build();
UnsubscribeResponse result = snsClient.unsubscribe(request);
System.out.println("\n\nStatus was " + result.sdkHttpResponse().statusCode() + "\n\nSubscription was removed for " + request.subscriptionArn());
} catch (SnsException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations