listPriceLists method

Future<ListPriceListsResponse> listPriceLists({
  1. required String currencyCode,
  2. required DateTime effectiveDate,
  3. required String serviceCode,
  4. int? maxResults,
  5. String? nextToken,
  6. String? regionCode,
})

This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the Amazon Web Services Service Terms (Section 1.10).

This returns a list of Price List references that the requester if authorized to view, given a ServiceCode, CurrencyCode, and an EffectiveDate. Use without a RegionCode filter to list Price List references from all available Amazon Web Services Regions. Use with a RegionCode filter to get the Price List reference that's specific to a specific Amazon Web Services Region. You can use the PriceListArn from the response to get your preferred Price List files through the GetPriceListFileUrl API.

May throw AccessDeniedException. May throw ExpiredNextTokenException. May throw InternalErrorException. May throw InvalidNextTokenException. May throw InvalidParameterException. May throw NotFoundException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter currencyCode : The three alphabetical character ISO-4217 currency code that the Price List files are denominated in.

Parameter effectiveDate : The date that the Price List file prices are effective from.

Parameter serviceCode : The service code or the Savings Plans service code for the attributes that you want to retrieve. For example, to get the list of applicable Amazon EC2 price lists, use AmazonEC2. For a full list of service codes containing On-Demand and Reserved Instance (RI) pricing, use the DescribeServices API.

To retrieve the Reserved Instance and Compute Savings Plans price lists, use ComputeSavingsPlans.

To retrieve Machine Learning Savings Plans price lists, use MachineLearningSavingsPlans.

Parameter maxResults : The maximum number of results to return in the response.

Parameter nextToken : The pagination token that indicates the next set of results that you want to retrieve.

Parameter regionCode : This is used to filter the Price List by Amazon Web Services Region. For example, to get the price list only for the US East (N. Virginia) Region, use us-east-1. If nothing is specified, you retrieve price lists for all applicable Regions. The available RegionCode list can be retrieved from GetAttributeValues API.

Implementation

Future<ListPriceListsResponse> listPriceLists({
  required String currencyCode,
  required DateTime effectiveDate,
  required String serviceCode,
  int? maxResults,
  String? nextToken,
  String? regionCode,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSPriceListService.ListPriceLists'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CurrencyCode': currencyCode,
      'EffectiveDate': unixTimestampToJson(effectiveDate),
      'ServiceCode': serviceCode,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (regionCode != null) 'RegionCode': regionCode,
    },
  );

  return ListPriceListsResponse.fromJson(jsonResponse.body);
}