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

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

            DescribeServicesResponse resp = new DescribeServicesResponse();

            do
            {
                DescribeServicesRequest req = new DescribeServicesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

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

                foreach (var obj in resp.Services)
                {
                    AddObject(obj);
                }

                foreach (var obj in resp.FormatVersion)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        protected IAmazonPricing CreateClient(AWSCredentials credentials, RegionEndpoint region)
        {
            var config = new AmazonPricingConfig {
                RegionEndpoint = region
            };

            Amazon.PowerShell.Utils.Common.PopulateConfig(this, config);
            this.CustomizeClientConfig(config);
            var client = new AmazonPricingClient(credentials, config);

            client.BeforeRequestEvent += RequestEventHandler;
            client.AfterResponseEvent += ResponseEventHandler;
            return(client);
        }