Search in sources :

Example 1 with ConfirmSubscriptionResponse

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

the class ConfirmSubscription method confirmSub.

// snippet-start:[sns.java2.ConfirmSubscription.main]
public static void confirmSub(SnsClient snsClient, String subscriptionToken, String topicArn) {
    try {
        ConfirmSubscriptionRequest request = ConfirmSubscriptionRequest.builder().token(subscriptionToken).topicArn(topicArn).build();
        ConfirmSubscriptionResponse result = snsClient.confirmSubscription(request);
        System.out.println("\n\nStatus was " + result.sdkHttpResponse().statusCode() + "\n\nSubscription Arn: \n\n" + result.subscriptionArn());
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : ConfirmSubscriptionRequest(software.amazon.awssdk.services.sns.model.ConfirmSubscriptionRequest) ConfirmSubscriptionResponse(software.amazon.awssdk.services.sns.model.ConfirmSubscriptionResponse) SnsException(software.amazon.awssdk.services.sns.model.SnsException)

Aggregations

ConfirmSubscriptionRequest (software.amazon.awssdk.services.sns.model.ConfirmSubscriptionRequest)1 ConfirmSubscriptionResponse (software.amazon.awssdk.services.sns.model.ConfirmSubscriptionResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1