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

DeleteTopicAsync() public method

Initiates the asynchronous execution of the DeleteTopic operation.
public DeleteTopicAsync ( DeleteTopicRequest request, DeleteTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
request Amazon.SimpleNotificationService.Model.DeleteTopicRequest Container for the necessary parameters to execute the DeleteTopic operation on AmazonSimpleNotificationServiceClient.
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(DeleteTopicRequest request, AmazonServiceCallback<DeleteTopicRequest, DeleteTopicResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller = new DeleteTopicRequestMarshaller();
            var unmarshaller = DeleteTopicResponseUnmarshaller.Instance;
            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
            if(callback !=null )
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
                    AmazonServiceResult<DeleteTopicRequest,DeleteTopicResponse> responseObject 
                            = new AmazonServiceResult<DeleteTopicRequest,DeleteTopicResponse>((DeleteTopicRequest)req, (DeleteTopicResponse)res, ex , ao.State);    
                        callback(responseObject); 
                };
            BeginInvoke<DeleteTopicRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }

Same methods

AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( DeleteTopicRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::DeleteTopicAsync ( string topicArn, System cancellationToken = default(CancellationToken) ) : Task
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