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); }
public void PricingGetAttributeValues() { #region to-retreive-attribute-values var client = new AmazonPricingClient(); var response = client.GetAttributeValues(new GetAttributeValuesRequest { AttributeName = "volumeType", MaxResults = 2, ServiceCode = "AmazonEC2" }); List <AttributeValue> attributeValues = response.AttributeValues; string nextToken = response.NextToken; #endregion }
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 }
public PricingService(RegionEndpoint endPoint) { client = new AmazonPricingClient(endPoint); }