Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient.FindTopic C# (CSharp) Метод

FindTopic() публичный Метод

Finds an existing Amazon SNS topic by iterating all SNS topics until a match is found.

The ListTopics method is used to fetch upto 100 SNS topics at a time until a SNS topic with an TopicArn that matches topicName is found.

public FindTopic ( string topicName ) : Topic
topicName string The name of the topic find
Результат Amazon.SimpleNotificationService.Model.Topic
        public Topic FindTopic(string topicName)
        {
            var nextToken = string.Empty;

            do
            {
                var response = this.ListTopics(new ListTopicsRequest { NextToken = nextToken });

                var matchedTopic = response.Topics.FirstOrDefault(x => TopicNameMatcher(x.TopicArn, topicName));

                if (matchedTopic != null)
                {
                    return matchedTopic;
                }

                nextToken = response.NextToken;

            } while (!string.IsNullOrEmpty(nextToken));

            return null;
        }
        #endregion

Usage Example

Пример #1
0
 public void DeleteTopic(string topicName)
 {
     using (var client = new AmazonSimpleNotificationServiceClient())
     {
         var topic = client.FindTopic(topicName);
         client.DeleteTopic(topic.TopicArn);
     }
 }
All Usage Examples Of Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient::FindTopic
AmazonSimpleNotificationServiceClient