describeServices method

Future<DescribeServicesResponse> describeServices({
  1. String? formatVersion,
  2. int? maxResults,
  3. String? nextToken,
  4. String? serviceCode,
})

Returns the metadata for one service or a list of the metadata for all services. Use this without a service code to get the service codes for all services. Use it with a service code, such as AmazonEC2, to get information specific to that service, such as the attribute names available for that service. For example, some of the attribute names available for EC2 are volumeType, maxIopsVolume, operation, locationType, and instanceCapacity10xlarge.

May throw InternalErrorException. May throw InvalidParameterException. May throw NotFoundException. May throw InvalidNextTokenException. May throw ExpiredNextTokenException.

Parameter formatVersion : The format version that you want the response to be in.

Valid values are: aws_v1

Parameter maxResults : The maximum number of results that you want returned in the response.

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

Parameter serviceCode : The code for the service whose information you want to retrieve, such as AmazonEC2. You can use the ServiceCode to filter the results in a GetProducts call. To retrieve a list of all services, leave this blank.

Implementation

Future<DescribeServicesResponse> describeServices({
  String? formatVersion,
  int? maxResults,
  String? nextToken,
  String? serviceCode,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSPriceListService.DescribeServices'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (formatVersion != null) 'FormatVersion': formatVersion,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (serviceCode != null) 'ServiceCode': serviceCode,
    },
  );

  return DescribeServicesResponse.fromJson(jsonResponse.body);
}