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, System cancellationToken = default(CancellationToken) ) : Task
topicArn string The ARN of the topic you want to delete.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
        public Task<DeleteTopicResponse> DeleteTopicAsync(string topicArn, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var request = new DeleteTopicRequest();
            request.TopicArn = topicArn;
            return DeleteTopicAsync(request, cancellationToken);
        }

Same methods

AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( DeleteTopicRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( DeleteTopicRequest request, DeleteTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( string topicArn, 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