DeleteTopic() 공개 메소드

Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.
/// Indicates that the user has been denied access to the requested resource. /// /// Indicates an internal service error. /// /// Indicates that a request parameter does not comply with the associated constraints. /// /// Indicates that the requested resource does not exist. ///
public DeleteTopic ( DeleteTopicRequest request ) : Amazon.SimpleNotificationService.Model.DeleteTopicResponse
request Amazon.SimpleNotificationService.Model.DeleteTopicRequest Container for the necessary parameters to execute the DeleteTopic service method.
리턴 Amazon.SimpleNotificationService.Model.DeleteTopicResponse
예제 #1
0
 public void DeleteTopic(string topicName)
 {
     using (var client = new AmazonSimpleNotificationServiceClient())
     {
         var topic = client.FindTopic(topicName);
         client.DeleteTopic(topic.TopicArn);
     }
 }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        public virtual void DeleteTopic(AmazonSimpleNotificationServiceClient snsClient, string topicArn)
        {
            // Create the request
            var deleteTopicRequest = new DeleteTopicRequest
            {
                TopicArn = topicArn
            };

            snsClient.DeleteTopic(deleteTopicRequest);
        }
예제 #4
0
    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
    }