getWarnMetricsStatus method

Future<MmStatusOK?> getWarnMetricsStatus()

Get the warn metrics status (enabled or disabled)

Get the status of a set of metrics (enabled or disabled) from the Systems table. The returned JSON contains the metrics that we need to warn the admin on with regard to their status (we return the ones whose status is "true", which means that they are in a "warnable" state - e.g. a threshold has been crossed or some other condition has been fulfilled). Minimum server version: 5.26 ##### Permissions Must have manage_system permission.

Implementation

Future<MmStatusOK?> getWarnMetricsStatus() async {
  final response = await getWarnMetricsStatusWithHttpInfo();
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'MmStatusOK',
    ) as MmStatusOK;
  }
  return null;
}