Unsubscribe() public method

Deletes a subscription. If the subscription requires authentication for deletion, only the owner of the subscription or the topic's owner can unsubscribe, and an AWS signature is required. If the Unsubscribe call does not require authentication and the requester is not the subscription owner, a final cancellation message is delivered to the endpoint, so that the endpoint owner can easily resubscribe to the topic if the Unsubscribe request was unintended.
/// Indicates that the user has been denied access to the requested resource. /// /// Indicates an internal service error. /// /// Indicates that a request parameter does not comply with the associated constraints. /// /// Indicates that the requested resource does not exist. ///
public Unsubscribe ( UnsubscribeRequest request ) : UnsubscribeResponse
request UnsubscribeRequest Container for the necessary parameters to execute the Unsubscribe service method.
return UnsubscribeResponse
        public virtual void DeleteSubscriptions(AmazonSimpleNotificationServiceClient snsClient, string topicArn)
        {
            var listSubscriptionsByTopicRequest = new ListSubscriptionsByTopicRequest
            {
                TopicArn = topicArn
            };

            ListSubscriptionsByTopicResponse listSubscriptionsByTopicResponse =
                snsClient.ListSubscriptionsByTopic(listSubscriptionsByTopicRequest);

            foreach (
                Subscription subscription in
                    listSubscriptionsByTopicResponse.Subscriptions)
            {
                var unsubscribeRequest = new UnsubscribeRequest
                {
                    SubscriptionArn = subscription.SubscriptionArn
                };
                snsClient.Unsubscribe(unsubscribeRequest);
            }
        }
Beispiel #2
0
    public static void SNSUnsubscribe()
    {
      #region SNSUnsubscribe
      var snsClient = new AmazonSimpleNotificationServiceClient();
      var request = new UnsubscribeRequest();

      request.SubscriptionArn =
        "arn:aws:sns:us-east-1:80398EXAMPLE:CodingTestResults:" +
        "2f5671ba-c68e-4231-a94a-e82d3EXAMPLE";

      snsClient.Unsubscribe(request);
      #endregion
    }