Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient.DeleteTopicAsync C# (CSharp) Method

DeleteTopicAsync() public method

Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.
/// 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 DeleteTopicAsync ( string topicArn, DeleteTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
topicArn string The ARN of the topic you want to delete.
callback DeleteTopicResponse>.AmazonServiceCallback An Action delegate that is invoked when the operation completes.
options Amazon.Runtime.AsyncOptions /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. ///
return void
        public void DeleteTopicAsync(string topicArn,  AmazonServiceCallback<DeleteTopicRequest, DeleteTopicResponse> callback, AsyncOptions options = null)
        {
            var request = new DeleteTopicRequest();
            request.TopicArn = topicArn;
            DeleteTopicAsync(request, callback, options);
        }

Same methods

AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( DeleteTopicRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( string topicArn, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( DeleteTopicRequest request, DeleteTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

 public void DeleteTopic(string topicName)
 {
     using (var client = new AmazonSimpleNotificationServiceClient(_credentials))
     {
         var topic = client.ListTopicsAsync().Result.Topics.SingleOrDefault(t => t.TopicArn == topicName);
         client.DeleteTopicAsync(topic.TopicArn).Wait();
     }
 }
AmazonSimpleNotificationServiceClient