private void CreateTopic(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { TopicArn = helper.CreateTopic(TopicName); Log.LogMessage(MessageImportance.Normal, "Created Sns TopicAssociated {0}, Topic Arn {1}", TopicName, TopicArn); } }
private void Unsubscribe(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { helper.Unsubscribe(SubscriptionArn); Log.LogMessage(MessageImportance.Normal, "Unsubscribed from SubscriptionArn {0}", SubscriptionArn); } }
private void DeleteTopic(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { helper.DeleteTopic(TopicArn); Log.LogMessage(MessageImportance.Normal, "Deleted SNS Topic {0}", TopicArn); } }
private void PublishNotifiation(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { MessageId = helper.Publish(TopicArn, Subject, Message); Log.LogMessage(MessageImportance.Normal, "Published SNS Notification {0}", Subject); } }
private void Subscribe(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { SubscriptionArn = helper.Subscribe(TopicArn, Protocol, Endpoint); Log.LogMessage(MessageImportance.Normal, "Subscribed to Topic {0}, SubscriptionArn {1}", TopicArn, SubscriptionArn); } }
private void AddPermissions(AwsClientDetails clientDetails) { using (var helper = new SNSHelper(clientDetails)) { helper.AddPermission(ActionNames, AwsAccountIds, Label, TopicArn); Log.LogMessage(MessageImportance.Normal, "Set permissiosn for AWS Accounts {0} to Topic Arn {1}", Join(AwsAccountIds), TopicArn); } }
public void ListTopics_Should_ReturnTopics() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string[] topics = helper.ListTopics(""); Assert.AreEqual(2, topics.Length); }
public void CreateTopicTwice_Should_Succeed_WithMatchingArns() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicArn = helper.CreateTopic("TestTopic2"); string topicArn2 = helper.CreateTopic("TestTopic2"); Assert.AreEqual(topicArn, topicArn2, "Topic Arn's should match"); }
public void Publish_Should_PublishANotification() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); const string topicArn = "arn:aws:sns:us-east-1:167532394791:TestTopic"; string messageId = helper.Publish(topicArn, "Test", "This is a test of Publish..."); Assert.IsNotEmpty(messageId); }
public void CreateTopic_Should_CreateTopic() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicId = helper.CreateTopic("TestTopic"); System.Diagnostics.Debug.WriteLine("Topic Id: " + topicId); Assert.IsNotEmpty(topicId); }
public void TestAddPermission_Sets_PermissionsOnTopic() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicArn = helper.CreateTopic("TestSetPermissionsTopic"); // TODO: Replace this with a valid AWS account Id. string[] awsAccountIds = new[] { "123456789012" }; string[] actionNames = new[] { "*" }; const string label = "Test Topic Permissions"; // There appears to be an issue with the AWS SDK 1.0.8.1 which failes validation // for action names and aws account ids whilst they are valid. helper.AddPermission(actionNames, awsAccountIds, label, topicArn); // Now clean up and delete the topic. helper.DeleteTopic(topicArn); }
public void TestUnSubscribe_Doesnt_Fail() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); // TODO: Replace this with the valid subscription Arn const string subscriptionArn = "arn:aws:sns:us-east-1:167532394791:TestTopic:37be7a47-7e3f-418f-961e-2ef68af1749c"; helper.Unsubscribe(subscriptionArn); }
public void TestSubscrive_Should_Subscribe() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); const string topicArn = "arn:aws:sns:us-east-1:167532394791:TestTopic"; const string protocol = "email"; const string endpoint = "*****@*****.**"; string subscriptionArn = helper.Subscribe(topicArn, protocol, endpoint); Assert.IsNotEmpty(subscriptionArn); }