示例#1
0
 /// <summary>
 /// Creates a topic if doesn't already exists and return the topic arn
 /// </summary>
 /// <param name="name">The name of the topic</param>
 /// <returns>The topic arn</returns>
 public string CreateTopicIfDoesntExist(string name)
 {
     try
     {
         return(sns.FindTopic(name).TopicArn);
     }
     catch
     {
         var creationResult = sns.CreateTopic(name);
         return(creationResult.TopicArn);
     }
 }
示例#2
0
 private Amazon.SimpleNotificationService.Model.CreateTopicResponse CallAWSServiceOperation(IAmazonSimpleNotificationService client, Amazon.SimpleNotificationService.Model.CreateTopicRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Notification Service (SNS)", "CreateTopic");
     try
     {
         #if DESKTOP
         return(client.CreateTopic(request));
         #elif CORECLR
         return(client.CreateTopicAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
示例#3
0
        /// <summary>
        /// Creates a topic with the given name
        /// </summary>
        /// <param name="topicName">Topic name</param>
        /// <returns>Created topic ARN</returns>
        private string CreateTopic(string topicName)
        {
            CreateTopicResponse response = _sns.CreateTopic(topicName);

            return(response.TopicArn);
        }