Example usage for com.amazonaws.services.sns.model UnsubscribeRequest UnsubscribeRequest

List of usage examples for com.amazonaws.services.sns.model UnsubscribeRequest UnsubscribeRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.sns.model UnsubscribeRequest UnsubscribeRequest.

Prototype

public UnsubscribeRequest() 

Source Link

Document

Default constructor for UnsubscribeRequest object.

Usage

From source file:awslabs.lab31.SolutionCode.java

License:Open Source License

@Override
public void deleteSubscriptions(AmazonSNSClient snsClient, String topicArn) {
    // TODO: Construct a ListSubscriptionsByTopicRequest object using the provided topic ARN.
    ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest = new ListSubscriptionsByTopicRequest()
            .withTopicArn(topicArn);/*  w w w  .jav  a 2s.  c om*/

    // TODO: Submit the request using the listSubscriptionsByTopic method of the snsClient object.
    ListSubscriptionsByTopicResult listSubscriptionsByTopicResult = snsClient
            .listSubscriptionsByTopic(listSubscriptionsByTopicRequest);

    // TODO: Iterate over the subscriptions in the request result.
    // TODO: For each subscription, construct an UnsubscribeRequest object using the subscription ARN.
    // TODO: For each unsubscribe request, submit it using the unsubscribe method of the snsClient object.
    for (Subscription subscription : listSubscriptionsByTopicResult.getSubscriptions()) {
        UnsubscribeRequest unsubscribeRequest = new UnsubscribeRequest()
                .withSubscriptionArn(subscription.getSubscriptionArn());
        snsClient.unsubscribe(unsubscribeRequest);
    }
}

From source file:com.zotoh.cloudapi.aws.SNS.java

License:Open Source License

@Override
public void unsubscribe(String subscription) throws CloudException, InternalException {
    tstEStrArg("subscription-name", subscription);
    _svc.getCloud().getSNS().unsubscribe(new UnsubscribeRequest().withSubscriptionArn(subscription));
}