Beispiel #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));
        }
Beispiel #2
0
        public void PricingDescribeServices()
        {
            #region to-retrieve-service-metadata

            var client   = new AmazonPricingClient();
            var response = client.DescribeServices(new DescribeServicesRequest
            {
                FormatVersion = "aws_v1",
                MaxResults    = 1,
                ServiceCode   = "AmazonEC2"
            });

            string         formatVersion = response.FormatVersion;
            string         nextToken     = response.NextToken;
            List <Service> services      = response.Services;

            #endregion
        }