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
예제 #1
0
 public void DeleteTopic(string topicName)
 {
     using (var client = new AmazonSimpleNotificationServiceClient())
     {
         var topic = client.FindTopic(topicName);
         client.DeleteTopic(topic.TopicArn);
     }
 }
예제 #2
0
        public Topic CheckSnsTopic(string topicName)
        {
            using (var client = new AmazonSimpleNotificationServiceClient())
            {
                return client.FindTopic(topicName);
            }

        }
예제 #3
0
        private string EnsureTopic(string topicName, AmazonSimpleNotificationServiceClient client)
        {
            var topic = client.FindTopic(topicName);
            if (topic != null)
                return topic.TopicArn;

            _logger.DebugFormat("Topic with name {0} does not exist. Creating new topic", topicName);
            var topicResult = client.CreateTopic(topicName);
            return topicResult.HttpStatusCode == HttpStatusCode.OK ? topicResult.TopicArn : string.Empty;
        }