describeMetricFilters method

Future<DescribeMetricFiltersResponse> describeMetricFilters({
  1. String? filterNamePrefix,
  2. int? limit,
  3. String? logGroupName,
  4. String? metricName,
  5. String? metricNamespace,
  6. String? nextToken,
})

Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

Parameter filterNamePrefix : The prefix to match. CloudWatch Logs uses the value you set here only if you also include the logGroupName parameter in your request.

Parameter limit : The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Parameter logGroupName : The name of the log group.

Parameter metricName : Filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the metricNamespace parameter.

Parameter metricNamespace : Filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the metricName parameter.

Parameter nextToken : The token for the next set of items to return. (You received this token from a previous call.)

Implementation

Future<DescribeMetricFiltersResponse> describeMetricFilters({
  String? filterNamePrefix,
  int? limit,
  String? logGroupName,
  String? metricName,
  String? metricNamespace,
  String? nextToken,
}) async {
  _s.validateStringLength(
    'filterNamePrefix',
    filterNamePrefix,
    1,
    512,
  );
  _s.validateNumRange(
    'limit',
    limit,
    1,
    50,
  );
  _s.validateStringLength(
    'logGroupName',
    logGroupName,
    1,
    512,
  );
  _s.validateStringLength(
    'metricName',
    metricName,
    0,
    255,
  );
  _s.validateStringLength(
    'metricNamespace',
    metricNamespace,
    0,
    255,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.DescribeMetricFilters'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filterNamePrefix != null) 'filterNamePrefix': filterNamePrefix,
      if (limit != null) 'limit': limit,
      if (logGroupName != null) 'logGroupName': logGroupName,
      if (metricName != null) 'metricName': metricName,
      if (metricNamespace != null) 'metricNamespace': metricNamespace,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return DescribeMetricFiltersResponse.fromJson(jsonResponse.body);
}