ListSubscriptions() 공개 메소드

Returns a list of the requester's subscriptions. Each call returns a limited list of subscriptions, up to 100. If there are more subscriptions, a NextToken is also returned. Use the NextToken parameter in a new ListSubscriptions 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 ListSubscriptions ( ) : Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse
리턴 Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse
예제 #1
0
    public static void SNSListSubscriptions()
    {
      #region SNSListSubscriptions
      var snsClient = new AmazonSimpleNotificationServiceClient();
      var request = new ListSubscriptionsRequest();
      var response = new ListSubscriptionsResponse();

      do
      {
        response = snsClient.ListSubscriptions(request);

        foreach (var sub in response.Subscriptions)
        {
          Console.WriteLine("Subscription: {0}", sub.SubscriptionArn);
        }

        request.NextToken = response.NextToken;

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

      Console.ReadLine();
    }
예제 #2
0
        public DataTable GetSNSSubscriptions(string aprofile, string Region2Scan)
        {

            DataTable ToReturn = AWSTables.GetSNSSubsTable();
            

            string accountid = GetAccountID(aprofile);

            RegionEndpoint Endpoint2scan = RegionEndpoint.USEast1;
            //Convert the Region2Scan to an AWS Endpoint.
            foreach (var aregion in RegionEndpoint.EnumerableAllRegions)
            {
                if (aregion.DisplayName.Equals(Region2Scan))
                {
                    Endpoint2scan = aregion;
                    continue;
                }
            }
            Amazon.Runtime.AWSCredentials credential;

            try
            {
                credential = new Amazon.Runtime.StoredProfileAWSCredentials(aprofile);

                //SNS testing here
                var snsclient = new AmazonSimpleNotificationServiceClient(credential,Endpoint2scan);
                var subbies = snsclient.ListSubscriptions().Subscriptions;
                //var toppies = snsclient.ListTopics().Topics;

                foreach(var asub in subbies)
                {
                    var myrow = ToReturn.NewRow();
                    myrow["AccountID"] = accountid   ;
                    myrow["Profile"] = aprofile   ;
                    myrow["Region"] = Region2Scan   ;

                    myrow["Endpoint"] = asub.Endpoint   ;
                    myrow["Owner"] = asub.Owner   ;
                    myrow["Protocol"] = asub.Protocol   ;
                    myrow["SubscriptionARN"] = asub.SubscriptionArn   ;
                    myrow["TopicARN"] = asub.TopicArn   ;

                    if (asub.SubscriptionArn.Contains(accountid))
                    {
                        myrow["CrossAccount"] = "No"   ;
                    }
                    else
                    {
                        myrow["CrossAccount"] = "Yup";
                    }
                    var checkker = myrow["CrossAccount"];
                    ToReturn.Rows.Add(myrow);
                }
            }
            catch(Exception ex)
            {
                WriteToEventLog("SNS scan of " + aprofile + " failed\n" + ex.Message.ToString(), EventLogEntryType.Error);
            }
            return ToReturn;
        }