listAvailableResourceMetrics method

Future<ListAvailableResourceMetricsResponse> listAvailableResourceMetrics({
  1. required String identifier,
  2. required List<String> metricTypes,
  3. required ServiceType serviceType,
  4. int? maxResults,
  5. String? nextToken,
})

Retrieve metrics of the specified types that can be queried for a specified DB instance.

May throw InternalServiceError. May throw InvalidArgumentException. May throw NotAuthorizedException.

Parameter identifier : An immutable identifier for a data source that is unique within an Amazon Web Services Region. Performance Insights gathers metrics from this data source. To use an Amazon RDS DB instance as a data source, specify its DbiResourceId value. For example, specify db-ABCDEFGHIJKLMNOPQRSTU1VWZ.

Parameter metricTypes : The types of metrics to return in the response. Valid values in the array include the following:

  • os (OS counter metrics) - All engines
  • db (DB load metrics) - All engines except for Amazon DocumentDB
  • db.sql.stats (per-SQL metrics) - All engines except for Amazon DocumentDB
  • db.sql_tokenized.stats (per-SQL digest metrics) - All engines except for Amazon DocumentDB

Parameter serviceType : The Amazon Web Services service for which Performance Insights returns metrics.

Parameter maxResults : The maximum number of items to return. If the MaxRecords value is less than the number of existing items, the response includes a pagination token.

Parameter nextToken : An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the token, up to the value specified by MaxRecords.

Implementation

Future<ListAvailableResourceMetricsResponse> listAvailableResourceMetrics({
  required String identifier,
  required List<String> metricTypes,
  required ServiceType serviceType,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    25,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'PerformanceInsightsv20180227.ListAvailableResourceMetrics'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Identifier': identifier,
      'MetricTypes': metricTypes,
      'ServiceType': serviceType.value,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListAvailableResourceMetricsResponse.fromJson(jsonResponse.body);
}