/** * Implementation of https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html */ import type { Statistic } from '../metric-types'; import { Stats } from '../stats'; export type ParsedStatistic = SimpleStatistic | UnparseableStatistic | ExtendedStatisticWithoutParameters | ExtendedStatisticWithThreshold | ExtendedStatisticWithRange; export interface SimpleStatistic { type: 'simple'; statistic: typeof Stats.AVERAGE | typeof Stats.MINIMUM | typeof Stats.MAXIMUM | typeof Stats.SAMPLE_COUNT | typeof Stats.SUM; } export interface UnparseableStatistic { type: 'unparseable'; originalInput: string; } export interface ExtendedStatisticWithoutParameters { type: 'extended'; statistic: 'IQM'; } export interface ExtendedStatisticWithThreshold { type: 'single'; statPrefix: 'p' | 'tm' | 'wm' | 'tc' | 'ts'; value: number; originalInput: string; } export interface ExtendedStatisticWithRange { type: 'range'; statPrefix: 'PR' | 'TM' | 'WM' | 'TC' | 'TS'; originalInput: string; isPercent: boolean; lower?: number; upper?: number; asSingleStatStr?: string; } export declare function singleStatisticToString(parsed: ExtendedStatisticWithThreshold): string; export declare function pairStatisticToString(parsed: ExtendedStatisticWithRange): string; /** * Parse a statistic, returning the type of metric that was used */ export declare function parseStatistic(stat: string): ParsedStatistic; export declare function normalizeStatistic(parsed: ReturnType): string; export declare function normalizeRawStringStatistic(stat: string): string; export interface StatisticFields { readonly statistic?: Statistic; readonly extendedStatistic?: string; } export declare function parseStatisticToFields(statistic: string): StatisticFields;