public DeleteTopic ( |
||
request | Container for the necessary parameters to execute the DeleteTopic service method. | |
return | Amazon.SimpleNotificationService.Model.DeleteTopicResponse |
public void DeleteTopic(string topicName) { using (var client = new AmazonSimpleNotificationServiceClient()) { var topic = client.FindTopic(topicName); client.DeleteTopic(topic.TopicArn); } }
public void SetTopicConfigurationTests() { var s3Config = new AmazonS3Config(); using (var s3Client = new AmazonS3Client(s3Config)) using (var snsClient = new AmazonSimpleNotificationServiceClient()) { var snsCreateResponse = snsClient.CreateTopic("events-test-" + DateTime.Now.Ticks); var bucketName = S3TestUtils.CreateBucket(s3Client); try { snsClient.AuthorizeS3ToPublish(snsCreateResponse.TopicArn, bucketName); PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest { BucketName = bucketName, TopicConfigurations = new List<TopicConfiguration> { new TopicConfiguration { Id = "the-topic-test", Topic = snsCreateResponse.TopicArn, Events = new List<EventType>{EventType.ObjectCreatedPut} } } }; s3Client.PutBucketNotification(putRequest); var getResponse = s3Client.GetBucketNotification(bucketName); Assert.AreEqual(1, getResponse.TopicConfigurations.Count); Assert.AreEqual(1, getResponse.TopicConfigurations[0].Events.Count); Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.TopicConfigurations[0].Events[0]); #pragma warning disable 618 Assert.AreEqual("s3:ObjectCreated:Put", getResponse.TopicConfigurations[0].Event); #pragma warning restore 618 Assert.AreEqual("the-topic-test", getResponse.TopicConfigurations[0].Id); Assert.AreEqual(snsCreateResponse.TopicArn, getResponse.TopicConfigurations[0].Topic); } finally { snsClient.DeleteTopic(snsCreateResponse.TopicArn); AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName); } } }
public virtual void DeleteTopic(AmazonSimpleNotificationServiceClient snsClient, string topicArn) { // Create the request var deleteTopicRequest = new DeleteTopicRequest { TopicArn = topicArn }; snsClient.DeleteTopic(deleteTopicRequest); }
public static void SNSDeleteTopic() { #region SNSDeleteTopic var snsClient = new AmazonSimpleNotificationServiceClient(); var request = new DeleteTopicRequest { TopicArn = "arn:aws:sns:us-east-1:80398EXAMPLE:CodingTestResults" }; snsClient.DeleteTopic(request); #endregion }