ListTopics() 공개 메소드

Returns a list of the requester's topics. Each call returns a limited list of topics, up to 100. If there are more topics, a NextToken is also returned. Use the NextToken parameter in a new ListTopics call to get further results.
/// 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. ///
public ListTopics ( ) : ListTopicsResponse
리턴 ListTopicsResponse
예제 #1
0
        public static IEnumerable<string> ListTopicArns()
        {
            using (var client = new AmazonSimpleNotificationServiceClient(Settings.AccessKey, Settings.Secret))
            {
                var response = client.ListTopics(new ListTopicsRequest());

                return response.Topics.Select(x => x.TopicArn).ToList();
            }
        }
예제 #2
0
    public static void SNSListTopics()
    {
      #region SNSListTopics
      var snsClient = new AmazonSimpleNotificationServiceClient();
      var request = new ListTopicsRequest();
      var response = new ListTopicsResponse();

      do
      {
        response = snsClient.ListTopics(request);

        foreach (var topic in response.Topics)
        {
          Console.WriteLine("Topic: {0}", topic.TopicArn);

          var attrs = snsClient.GetTopicAttributes(
            new GetTopicAttributesRequest
            {
              TopicArn = topic.TopicArn
            }).Attributes;

          if (attrs.Count > 0)
          {
            foreach (var attr in attrs)
            {
              Console.WriteLine(" -{0} : {1}", attr.Key, attr.Value);
            }
          }

          Console.WriteLine();

        }

        request.NextToken = response.NextToken;

      } while (!string.IsNullOrEmpty(response.NextToken));
      #endregion

      Console.ReadLine();
    }
예제 #3
0
 public virtual bool AppMode_TestSnsAccess(RegionEndpoint regionEndpoint, SessionAWSCredentials credentials)
 {
     try
     {
         var snsClient = new AmazonSimpleNotificationServiceClient(credentials, regionEndpoint);
         snsClient.ListTopics(new ListTopicsRequest());
         return true;
     }
     catch
     {
         return false;
     }
 }
        /// <summary>
        /// Notification configuration window load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NcWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                AmazonAutoScalingConfig config = new AmazonAutoScalingConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonAutoScalingClient client = new AmazonAutoScalingClient(config);
                DescribeAutoScalingNotificationTypesRequest dasntreq = new DescribeAutoScalingNotificationTypesRequest();
                DescribeAutoScalingNotificationTypesResponse dasntresp = client.DescribeAutoScalingNotificationTypes(dasntreq);
                foreach (string asnt in dasntresp.DescribeAutoScalingNotificationTypesResult.AutoScalingNotificationTypes)
                {
                    this.notificationTypes.Add(asnt);
                }

                AmazonSimpleNotificationServiceConfig snsconfig = new AmazonSimpleNotificationServiceConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonSimpleNotificationServiceClient snsclient = new AmazonSimpleNotificationServiceClient(snsconfig);
                ListTopicsRequest ltrequest = new ListTopicsRequest();
                ListTopicsResponse ltresp = snsclient.ListTopics(ltrequest);
                foreach (Topic topic in ltresp.ListTopicsResult.Topics)
                {
                    this.snstopics.Add(topic.TopicArn);
                }

                rlbNcTypes.ItemsSource = this.notificationTypes;
                cboTopics.ItemsSource = this.snstopics;
            }
            catch
            {
                MessageBox.Show(Window.GetWindow(this), "Error occured while loading the notification configuration options.", "Error", MessageBoxButton.OK);
                this.Close();
            }
        }