コード例 #1
0
        public static async Task <string> Get(IAmazonSimpleNotificationService sns, string prefix, string eventType)
        {
            var topicName         = $"{prefix}{eventType}";
            var sanitized         = TopicSanitization.GetSanitizedTopicName(topicName);
            var findTopicResponse = await sns.FindTopicAsync(sanitized).ConfigureAwait(false);

            return(findTopicResponse.TopicArn);
        }
コード例 #2
0
        public static async Task <string> Create(IAmazonSimpleNotificationService sns, string prefix, string eventType)
        {
            var topicName = $"{prefix}{eventType}";
            var sanitized = TopicSanitization.GetSanitizedTopicName(topicName);
            await Console.Out.WriteLineAsync($"Creating SNS Topic with name '{sanitized}'.");

            var createTopicResponse = await sns.CreateTopicAsync(sanitized).ConfigureAwait(false);

            await Console.Out.WriteLineAsync($"Created SNS Topic with name '{sanitized}'.");

            return(createTopicResponse.TopicArn);
        }