public ListSubscriptions ( ) : Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse | ||
return | Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse |
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(); }
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; }