List of usage examples for com.amazonaws.services.sns.model ListSubscriptionsByTopicRequest ListSubscriptionsByTopicRequest
public ListSubscriptionsByTopicRequest()
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);//from w ww. j av a2s . 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
private Tuple listSubsWithTopic(String topic, String nextToken) { ListSubscriptionsByTopicRequest req = new ListSubscriptionsByTopicRequest().withTopicArn(topic); if (!isEmpty(nextToken)) { req.withNextToken(nextToken);// w w w . java 2s . com } ListSubscriptionsByTopicResult res = _svc.getCloud().getSNS().listSubscriptionsByTopic(req); List<com.amazonaws.services.sns.model.Subscription> lst = null; String tkn = null; if (res != null) { lst = res.getSubscriptions(); tkn = res.getNextToken(); } return new Tuple(lst, tkn); }