2022-04-27 12:41:48 +02:00
import { AnnotationQuery } from '@grafana/data' ;
2021-11-30 10:53:31 +01:00
2022-04-27 12:41:48 +02:00
import { CloudWatchAnnotationQuery , CloudWatchLogsQuery , CloudWatchMetricsQuery , CloudWatchQuery } from './types' ;
export const isCloudWatchLogsQuery = ( cloudwatchQuery : CloudWatchQuery ) : cloudwatchQuery is CloudWatchLogsQuery = >
cloudwatchQuery . queryMode === 'Logs' ;
export const isCloudWatchMetricsQuery = ( cloudwatchQuery : CloudWatchQuery ) : cloudwatchQuery is CloudWatchMetricsQuery = >
2022-05-02 10:09:24 +02:00
cloudwatchQuery . queryMode === 'Metrics' || ! cloudwatchQuery . hasOwnProperty ( 'queryMode' ) ; // in early versions of this plugin, queryMode wasn't defined in a CloudWatchMetricsQuery
2022-04-27 12:41:48 +02:00
export const isCloudWatchAnnotationQuery = (
cloudwatchQuery : CloudWatchQuery
) : cloudwatchQuery is CloudWatchAnnotationQuery = > cloudwatchQuery . queryMode === 'Annotations' ;
export const isCloudWatchAnnotation = ( query : unknown ) : query is AnnotationQuery < CloudWatchAnnotationQuery > = >
( query as AnnotationQuery < CloudWatchAnnotationQuery > ) . target ? . queryMode === 'Annotations' ;