public void PricingGetProducts()
        {
            #region to-retrieve-available products

            var response = client.GetProducts(new GetProductsRequest
            {
                Filters = new List <Filter> {
                    new Filter {
                        Field = "ServiceCode",
                        Type  = "TERM_MATCH",
                        Value = "AmazonEC2"
                    },
                    new Filter {
                        Field = "volumeType",
                        Type  = "TERM_MATCH",
                        Value = "Provisioned IOPS"
                    }
                },
                FormatVersion = "aws_v1",
                MaxResults    = 1
            });

            string        formatVersion = response.FormatVersion;
            string        nextToken     = response.NextToken;
            List <string> priceList     = response.PriceList;

            #endregion
        }
Ejemplo n.º 2
0
        IEnumerable <GetProductsResponse> IPaginator <GetProductsResponse> .Paginate()
        {
            if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
            {
                throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
            }
            PaginatorUtils.SetUserAgentAdditionOnRequest(_request);
            var nextToken = _request.NextToken;
            GetProductsResponse response;

            do
            {
                _request.NextToken = nextToken;
                response           = _client.GetProducts(_request);
                nextToken          = response.NextToken;
                yield return(response);
            }while (!string.IsNullOrEmpty(nextToken));
        }
 private Amazon.Pricing.Model.GetProductsResponse CallAWSServiceOperation(IAmazonPricing client, Amazon.Pricing.Model.GetProductsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Price List Service", "GetProducts");
     try
     {
         #if DESKTOP
         return(client.GetProducts(request));
         #elif CORECLR
         return(client.GetProductsAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }