Beispiel #1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonSimpleNotificationServiceConfig config = new AmazonSimpleNotificationServiceConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonSimpleNotificationServiceClient client = new AmazonSimpleNotificationServiceClient(creds, config);

            ListEndpointsByPlatformApplicationResponse resp = new ListEndpointsByPlatformApplicationResponse();

            do
            {
                ListEndpointsByPlatformApplicationRequest req = new ListEndpointsByPlatformApplicationRequest
                {
                    NextToken = resp.NextToken
                };

                resp = client.ListEndpointsByPlatformApplication(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Endpoints)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Beispiel #2
0
        private IEnumerable <Endpoint> ListEndpoints(string applicationarn)
        {
            using (var snsclient = new AmazonSimpleNotificationServiceClient(_accesskey, _secretkey))
            {
                var result = snsclient.ListEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest()
                {
                    PlatformApplicationArn = applicationarn
                });

                return(result.Endpoints);
            }
        }
Beispiel #3
0
        public static void SNSMobilePushAPIsListApplicationsEndpoints()
        {
            #region SNSMobilePushAPIsListApplicationsEndpoints
            var snsClient    = new AmazonSimpleNotificationServiceClient();
            var appsResponse = snsClient.ListPlatformApplications();

            foreach (var app in appsResponse.PlatformApplications)
            {
                Console.WriteLine();

                var appAttrsRequest = new GetPlatformApplicationAttributesRequest
                {
                    PlatformApplicationArn = app.PlatformApplicationArn
                };

                var appAttrsResponse =
                    snsClient.GetPlatformApplicationAttributes(appAttrsRequest);

                var endpointsByAppRequest =
                    new ListEndpointsByPlatformApplicationRequest
                {
                    PlatformApplicationArn = app.PlatformApplicationArn
                };

                var endpointsByAppResponse =
                    snsClient.ListEndpointsByPlatformApplication(
                        endpointsByAppRequest);

                Console.WriteLine("Application: " + app.PlatformApplicationArn);
                Console.WriteLine("  Properties: ");

                foreach (var attr in appAttrsResponse.Attributes)
                {
                    Console.WriteLine("    " + attr.Key + ": " + attr.Value);
                }

                Console.WriteLine("  Endpoints: ");

                foreach (var endpoint in endpointsByAppResponse.Endpoints)
                {
                    Console.WriteLine("     ARN: " + endpoint.EndpointArn);
                    Console.WriteLine("     Attributes: ");

                    foreach (var attr in endpoint.Attributes)
                    {
                        Console.WriteLine("       " + attr.Key + ": " + attr.Value);
                    }
                }
            }
            #endregion

            Console.ReadLine();
        }