@grafana/alerting
Version:
Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution
1 lines • 234 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../../src/grafana/rules/utils/labels.ts","../../src/grafana/rules/components/labels/AlertLabel.tsx","../../src/grafana/rules/components/labels/AlertLabels.tsx","../../src/grafana/api/util.ts","../../src/grafana/api/notifications/v0alpha1/const.ts","../../src/grafana/api/notifications/v0alpha1/api.ts","../../src/grafana/api/notifications/v0alpha1/notifications.api.gen.ts","../../src/grafana/notificationPolicies/consts.ts","../../src/grafana/matchers/utils.ts","../../src/grafana/notificationPolicies/utils.ts","../../src/grafana/notificationPolicies/hooks/useMatchPolicies.ts"],"sourcesContent":["export const GRAFANA_ORIGIN_LABEL = '__grafana_origin';\n\nexport function isPrivateLabelKey(labelKey: string) {\n return (labelKey.startsWith('__') && labelKey.endsWith('__')) || labelKey === GRAFANA_ORIGIN_LABEL;\n}\n\nexport const isPrivateLabel = ([key, _]: [string, string]) => isPrivateLabelKey(key);\n\n/**\n * Returns a map labels that are common to the given label sets.\n */\nexport function findCommonLabels(labelSets: Array<Record<string, string>>): Record<string, string> {\n if (!Array.isArray(labelSets) || labelSets.length === 0) {\n return {};\n }\n return labelSets.reduce(\n (acc, labels) => {\n if (!labels) {\n throw new Error('Need parsed labels to find common labels.');\n }\n // Remove incoming labels that are missing or not matching in value\n Object.keys(labels).forEach((key) => {\n if (acc[key] === undefined || acc[key] !== labels[key]) {\n delete acc[key];\n }\n });\n // Remove common labels that are missing from incoming label set\n Object.keys(acc).forEach((key) => {\n if (labels[key] === undefined) {\n delete acc[key];\n }\n });\n return acc;\n },\n { ...labelSets[0] }\n );\n}\n","import { css, cx } from '@emotion/css';\nimport { CSSProperties, HTMLAttributes, useMemo } from 'react';\nimport tinycolor2 from 'tinycolor2';\nimport { MergeExclusive } from 'type-fest';\n\nimport { GrafanaTheme2, IconName } from '@grafana/data';\nimport { Icon, Stack, getTagColorsFromName, useStyles2 } from '@grafana/ui';\n\nexport type LabelSize = 'md' | 'sm' | 'xs';\n\ninterface BaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'className'> {\n icon?: IconName;\n labelKey?: string;\n value?: string;\n size?: LabelSize;\n onClick?: ([value, key]: [string | undefined, string | undefined]) => void;\n}\n\ntype Props = BaseProps & MergeExclusive<{ color?: string }, { colorBy?: 'key' | 'value' | 'both' }>;\n\nconst AlertLabel = (props: Props) => {\n const { labelKey, value, icon, color, colorBy, size = 'md', onClick, ...rest } = props;\n const theColor = getColorFromProps({ color, colorBy, labelKey, value });\n const styles = useStyles2(getStyles, theColor, size);\n\n const ariaLabel = `${labelKey}: ${value}`;\n const keyless = !Boolean(labelKey);\n\n const innerLabel = useMemo(\n () => (\n <Stack direction=\"row\" gap={0} alignItems=\"stretch\">\n {labelKey && (\n <div className={styles.label}>\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\">\n {icon && <Icon name={icon} />}\n {labelKey && (\n <span className={styles.labelText} title={labelKey.toString()}>\n {labelKey ?? ''}\n </span>\n )}\n </Stack>\n </div>\n )}\n <div className={cx(styles.value, keyless && styles.valueWithoutKey)} title={value?.toString()}>\n {value ?? '-'}\n </div>\n </Stack>\n ),\n [labelKey, styles.label, styles.labelText, styles.value, styles.valueWithoutKey, icon, keyless, value]\n );\n\n return (\n <div className={styles.wrapper} aria-label={ariaLabel} data-testid=\"label-value\" {...rest}>\n {onClick && (labelKey || value) ? (\n <button\n type=\"button\"\n className={styles.clickable}\n key={`${labelKey ?? ''}${value ?? ''}`}\n onClick={() => onClick?.([value ?? '', labelKey ?? ''])}\n >\n {innerLabel}\n </button>\n ) : (\n innerLabel\n )}\n </div>\n );\n};\n\nfunction getAccessibleTagColor(name?: string): string | undefined {\n if (!name) {\n return;\n }\n const attempts = Array.from({ length: 6 }, (_, i) => name + '-'.repeat(i));\n const readableAttempt = attempts.find((attempt) => {\n const candidate = getTagColorsFromName(attempt).color;\n return (\n tinycolor2.isReadable(candidate, '#000', { level: 'AA', size: 'small' }) ||\n tinycolor2.isReadable(candidate, '#fff', { level: 'AA', size: 'small' })\n );\n });\n const chosen = readableAttempt ?? name;\n return getTagColorsFromName(chosen).color;\n}\n\nfunction getColorFromProps({\n color,\n colorBy,\n labelKey,\n value,\n}: Pick<Props, 'color' | 'colorBy' | 'labelKey' | 'value'>) {\n if (color) {\n return getAccessibleTagColor(color);\n }\n\n if (colorBy === 'key') {\n return getAccessibleTagColor(labelKey);\n }\n\n if (colorBy === 'value') {\n return getAccessibleTagColor(value);\n }\n\n if (colorBy === 'both' && labelKey && value) {\n return getAccessibleTagColor(labelKey + value);\n }\n\n return;\n}\n\nfunction getReadableFontColor(bg: string, fallback: string): string {\n // First: explicitly check black\n if (tinycolor2.isReadable(bg, '#000', { level: 'AA', size: 'small' })) {\n return '#000';\n }\n\n // Then: explicitly check white\n if (tinycolor2.isReadable(bg, '#fff', { level: 'AA', size: 'small' })) {\n return '#fff';\n }\n\n // Then: try fallback if it’s readable\n if (tinycolor2.isReadable(bg, fallback, { level: 'AA', size: 'small' })) {\n return tinycolor2(fallback).toHexString();\n }\n\n // Last resort: pick the \"most readable\", even if not AA-compliant\n return tinycolor2\n .mostReadable(bg, ['#000', '#fff', fallback], {\n includeFallbackColors: true,\n })\n .toHexString();\n}\n\nconst getStyles = (theme: GrafanaTheme2, color?: string, size?: string) => {\n const backgroundColor = color ?? theme.colors.secondary.main;\n\n const borderColor = theme.isDark\n ? tinycolor2(backgroundColor).lighten(5).toString()\n : tinycolor2(backgroundColor).darken(5).toString();\n\n const valueBackgroundColor = theme.isDark\n ? tinycolor2(backgroundColor).darken(5).toString()\n : tinycolor2(backgroundColor).lighten(5).toString();\n\n const labelFontColor = color\n ? getReadableFontColor(backgroundColor, theme.colors.text.primary)\n : theme.colors.text.primary;\n\n const valueFontColor = color\n ? getReadableFontColor(valueBackgroundColor, theme.colors.text.primary)\n : theme.colors.text.primary;\n\n let padding: CSSProperties['padding'] = theme.spacing(0.33, 1);\n\n switch (size) {\n case 'sm':\n padding = theme.spacing(0.2, 0.6);\n break;\n case 'xs':\n padding = theme.spacing(0, 0.5);\n break;\n default:\n break;\n }\n\n return {\n wrapper: css({\n fontSize: theme.typography.bodySmall.fontSize,\n borderRadius: theme.shape.borderRadius(2),\n }),\n labelText: css({\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '300px',\n }),\n label: css({\n display: 'flex',\n alignItems: 'center',\n color: labelFontColor,\n\n padding: padding,\n background: backgroundColor,\n\n border: `solid 1px ${borderColor}`,\n borderTopLeftRadius: theme.shape.borderRadius(2),\n borderBottomLeftRadius: theme.shape.borderRadius(2),\n }),\n clickable: css({\n border: 'none',\n background: 'none',\n outline: 'none',\n boxShadow: 'none',\n\n padding: 0,\n margin: 0,\n\n '&:hover': {\n opacity: 0.8,\n cursor: 'pointer',\n },\n }),\n value: css({\n color: valueFontColor,\n padding: padding,\n background: valueBackgroundColor,\n border: `solid 1px ${borderColor}`,\n borderLeft: 'none',\n borderTopRightRadius: theme.shape.borderRadius(2),\n borderBottomRightRadius: theme.shape.borderRadius(2),\n whiteSpace: 'pre',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '300px',\n }),\n valueWithoutKey: css({\n borderTopLeftRadius: theme.shape.borderRadius(2),\n borderBottomLeftRadius: theme.shape.borderRadius(2),\n borderLeft: `solid 1px ${borderColor}`,\n }),\n };\n};\n\nexport { AlertLabel };\nexport type AlertLabelProps = Props;\n","import { css } from '@emotion/css';\nimport { chain } from 'lodash';\nimport { useMemo, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Trans, t } from '@grafana/i18n';\nimport { Button, Stack, Toggletip, useStyles2 } from '@grafana/ui';\n\nimport { findCommonLabels, isPrivateLabel } from '../../utils/labels';\n\nimport { AlertLabel, LabelSize } from './AlertLabel';\n\nexport interface AlertLabelsProps {\n labels: Record<string, string>;\n displayCommonLabels?: boolean;\n labelSets?: Array<Record<string, string>>;\n size?: LabelSize;\n onClick?: ([value, key]: [string | undefined, string | undefined]) => void;\n commonLabelsMode?: 'expand' | 'tooltip';\n}\n\nexport const AlertLabels = ({\n labels,\n displayCommonLabels,\n labelSets,\n size,\n onClick,\n commonLabelsMode = 'expand',\n}: AlertLabelsProps) => {\n const styles = useStyles2(getStyles, size);\n const [showCommonLabels, setShowCommonLabels] = useState(false);\n\n const computedCommonLabels = useMemo(\n () => (displayCommonLabels && Array.isArray(labelSets) && labelSets.length > 1 ? findCommonLabels(labelSets) : {}),\n [displayCommonLabels, labelSets]\n );\n\n const labelsToShow = chain(labels)\n .toPairs()\n .reject(isPrivateLabel)\n .reject(([key]) => (showCommonLabels ? false : key in computedCommonLabels))\n .value();\n\n const commonLabelsCount = Object.keys(computedCommonLabels).length;\n const hasCommonLabels = commonLabelsCount > 0;\n const tooltip = t('alert-labels.button.show.tooltip', 'Show common labels');\n\n const commonLabelsTooltip = useMemo(\n () => (\n <Stack data-testid=\"common-labels-tooltip-content\" role=\"list\" direction=\"row\" wrap=\"wrap\" gap={1} width={48}>\n {Object.entries(computedCommonLabels).map(([label, value]) => (\n <AlertLabel key={label + value} size={size} labelKey={label} value={value} colorBy=\"key\" role=\"listitem\" />\n ))}\n </Stack>\n ),\n [computedCommonLabels, size]\n );\n\n return (\n <div className={styles.wrapper} role=\"list\" aria-label={t('alerting.alert-labels.aria-label-labels', 'Labels')}>\n {labelsToShow.map(([label, value]) => {\n return (\n <AlertLabel\n key={label + value}\n size={size}\n labelKey={label}\n value={value}\n colorBy=\"key\"\n onClick={onClick}\n role=\"listitem\"\n />\n );\n })}\n\n {!showCommonLabels && hasCommonLabels && (\n <div role=\"listitem\">\n {commonLabelsMode === 'expand' ? (\n <Button\n variant=\"secondary\"\n fill=\"text\"\n onClick={() => setShowCommonLabels(true)}\n tooltip={tooltip}\n tooltipPlacement=\"top\"\n size=\"sm\"\n >\n <Trans i18nKey=\"alerting.alert-labels.common-labels-count\" count={commonLabelsCount}>\n +{'{{count}}'} common labels\n </Trans>\n </Button>\n ) : (\n <Toggletip content={commonLabelsTooltip} closeButton={false} fitContent={true}>\n <Button data-testid=\"common-labels-tooltip-trigger\" variant=\"secondary\" fill=\"text\" size=\"sm\">\n <Trans i18nKey=\"alerting.alert-labels.common-labels-count\" count={commonLabelsCount}>\n +{'{{count}}'} common labels\n </Trans>\n </Button>\n </Toggletip>\n )}\n </div>\n )}\n {showCommonLabels && hasCommonLabels && (\n <div role=\"listitem\">\n <Button\n variant=\"secondary\"\n fill=\"text\"\n onClick={() => setShowCommonLabels(false)}\n tooltipPlacement=\"top\"\n size=\"sm\"\n >\n <Trans i18nKey=\"alert-labels.button.hide\">Hide common labels</Trans>\n </Button>\n </div>\n )}\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2, size?: LabelSize) => {\n return {\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n\n gap: size === 'md' ? theme.spacing() : theme.spacing(0.5),\n }),\n };\n};\n","/**\n * @TODO move this to some shared package, currently copied from Grafana core (app/api/utils)\n */\n\nimport { config } from '@grafana/runtime';\n\nexport const getAPINamespace = () => config.namespace;\n\nexport const getAPIBaseURL = (group: string, version: string) => {\n const subPath = config.appSubUrl || '';\n return `${subPath}/apis/${group}/${version}/namespaces/${getAPINamespace()}` as const;\n};\n\n// By including the version in the reducer path we can prevent cache bugs when different versions of the API are used for the same entities\nexport const getAPIReducerPath = (group: string, version: string) => `${group}/${version}` as const;\n\n/**\n * Check if a string is well-formed UTF-16 (no lone surrogates).\n * encodeURIComponent() throws an error for lone surrogates\n */\nexport const isWellFormed = (str: string): boolean => {\n try {\n encodeURIComponent(str);\n return true;\n } catch (error) {\n return false;\n }\n};\n\n/**\n * Base64URL encode a string using native browser APIs.\n * Handles Unicode characters correctly by using TextEncoder.\n * Converts standard base64 to base64url by replacing + with -, / with _, and removing padding.\n * @throws Error if the input string contains lone surrogates (malformed UTF-16)\n */\nexport const base64UrlEncode = (value: string): string => {\n // Check if the string is well-formed UTF-16\n if (!isWellFormed(value)) {\n throw new Error(`Cannot encode malformed UTF-16 string with lone surrogates: ${value}`);\n }\n\n // Encode UTF-8 string to bytes\n const bytes = new TextEncoder().encode(value);\n\n // Convert bytes to base64\n const binString = String.fromCodePoint(...bytes);\n const base64 = btoa(binString);\n\n // Convert to base64url format\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\n","export const VERSION = 'v0alpha1' as const;\nexport const GROUP = 'notifications.alerting.grafana.app' as const;\n","import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';\n\nimport { getAPIBaseURL, getAPIReducerPath } from '../../util';\n\nimport { GROUP, VERSION } from './const';\n\nconst baseUrl = getAPIBaseURL(GROUP, VERSION);\nconst reducerPath = getAPIReducerPath(GROUP, VERSION);\n\nexport const api = createApi({\n reducerPath,\n baseQuery: fetchBaseQuery({\n // Set URL correctly so MSW can intercept requests\n // https://mswjs.io/docs/runbook#rtk-query-requests-are-not-intercepted\n baseUrl: new URL(baseUrl, globalThis.location.origin).href,\n }),\n endpoints: () => ({}),\n});\n","import { api } from './api';\nexport const addTagTypes = ['API Discovery', 'Receiver', 'RoutingTree', 'TemplateGroup', 'TimeInterval'] as const;\nconst injectedRtkApi = api\n .enhanceEndpoints({\n addTagTypes,\n })\n .injectEndpoints({\n endpoints: (build) => ({\n getApiResources: build.query<GetApiResourcesApiResponse, GetApiResourcesApiArg>({\n query: () => ({ url: `/apis/notifications.alerting.grafana.app/v0alpha1/` }),\n providesTags: ['API Discovery'],\n }),\n listReceiver: build.query<ListReceiverApiResponse, ListReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers`,\n params: {\n pretty: queryArg.pretty,\n allowWatchBookmarks: queryArg.allowWatchBookmarks,\n continue: queryArg['continue'],\n fieldSelector: queryArg.fieldSelector,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n watch: queryArg.watch,\n },\n }),\n providesTags: ['Receiver'],\n }),\n createReceiver: build.mutation<CreateReceiverApiResponse, CreateReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers`,\n method: 'POST',\n body: queryArg.receiver,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n deletecollectionReceiver: build.mutation<DeletecollectionReceiverApiResponse, DeletecollectionReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n continue: queryArg['continue'],\n dryRun: queryArg.dryRun,\n fieldSelector: queryArg.fieldSelector,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n getReceiver: build.query<GetReceiverApiResponse, GetReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['Receiver'],\n }),\n replaceReceiver: build.mutation<ReplaceReceiverApiResponse, ReplaceReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}`,\n method: 'PUT',\n body: queryArg.receiver,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n deleteReceiver: build.mutation<DeleteReceiverApiResponse, DeleteReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n updateReceiver: build.mutation<UpdateReceiverApiResponse, UpdateReceiverApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n getReceiverStatus: build.query<GetReceiverStatusApiResponse, GetReceiverStatusApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}/status`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['Receiver'],\n }),\n replaceReceiverStatus: build.mutation<ReplaceReceiverStatusApiResponse, ReplaceReceiverStatusApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}/status`,\n method: 'PUT',\n body: queryArg.receiver,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n updateReceiverStatus: build.mutation<UpdateReceiverStatusApiResponse, UpdateReceiverStatusApiArg>({\n query: (queryArg) => ({\n url: `/receivers/${queryArg.name}/status`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['Receiver'],\n }),\n listRoutingTree: build.query<ListRoutingTreeApiResponse, ListRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees`,\n params: {\n pretty: queryArg.pretty,\n allowWatchBookmarks: queryArg.allowWatchBookmarks,\n continue: queryArg['continue'],\n fieldSelector: queryArg.fieldSelector,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n watch: queryArg.watch,\n },\n }),\n providesTags: ['RoutingTree'],\n }),\n createRoutingTree: build.mutation<CreateRoutingTreeApiResponse, CreateRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees`,\n method: 'POST',\n body: queryArg.routingTree,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n deletecollectionRoutingTree: build.mutation<\n DeletecollectionRoutingTreeApiResponse,\n DeletecollectionRoutingTreeApiArg\n >({\n query: (queryArg) => ({\n url: `/routingtrees`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n continue: queryArg['continue'],\n dryRun: queryArg.dryRun,\n fieldSelector: queryArg.fieldSelector,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n getRoutingTree: build.query<GetRoutingTreeApiResponse, GetRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['RoutingTree'],\n }),\n replaceRoutingTree: build.mutation<ReplaceRoutingTreeApiResponse, ReplaceRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}`,\n method: 'PUT',\n body: queryArg.routingTree,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n deleteRoutingTree: build.mutation<DeleteRoutingTreeApiResponse, DeleteRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n updateRoutingTree: build.mutation<UpdateRoutingTreeApiResponse, UpdateRoutingTreeApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n getRoutingTreeStatus: build.query<GetRoutingTreeStatusApiResponse, GetRoutingTreeStatusApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}/status`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['RoutingTree'],\n }),\n replaceRoutingTreeStatus: build.mutation<ReplaceRoutingTreeStatusApiResponse, ReplaceRoutingTreeStatusApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}/status`,\n method: 'PUT',\n body: queryArg.routingTree,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n updateRoutingTreeStatus: build.mutation<UpdateRoutingTreeStatusApiResponse, UpdateRoutingTreeStatusApiArg>({\n query: (queryArg) => ({\n url: `/routingtrees/${queryArg.name}/status`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['RoutingTree'],\n }),\n listTemplateGroup: build.query<ListTemplateGroupApiResponse, ListTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups`,\n params: {\n pretty: queryArg.pretty,\n allowWatchBookmarks: queryArg.allowWatchBookmarks,\n continue: queryArg['continue'],\n fieldSelector: queryArg.fieldSelector,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n watch: queryArg.watch,\n },\n }),\n providesTags: ['TemplateGroup'],\n }),\n createTemplateGroup: build.mutation<CreateTemplateGroupApiResponse, CreateTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups`,\n method: 'POST',\n body: queryArg.templateGroup,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n deletecollectionTemplateGroup: build.mutation<\n DeletecollectionTemplateGroupApiResponse,\n DeletecollectionTemplateGroupApiArg\n >({\n query: (queryArg) => ({\n url: `/templategroups`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n continue: queryArg['continue'],\n dryRun: queryArg.dryRun,\n fieldSelector: queryArg.fieldSelector,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n getTemplateGroup: build.query<GetTemplateGroupApiResponse, GetTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['TemplateGroup'],\n }),\n replaceTemplateGroup: build.mutation<ReplaceTemplateGroupApiResponse, ReplaceTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}`,\n method: 'PUT',\n body: queryArg.templateGroup,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n deleteTemplateGroup: build.mutation<DeleteTemplateGroupApiResponse, DeleteTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n updateTemplateGroup: build.mutation<UpdateTemplateGroupApiResponse, UpdateTemplateGroupApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n getTemplateGroupStatus: build.query<GetTemplateGroupStatusApiResponse, GetTemplateGroupStatusApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}/status`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['TemplateGroup'],\n }),\n replaceTemplateGroupStatus: build.mutation<\n ReplaceTemplateGroupStatusApiResponse,\n ReplaceTemplateGroupStatusApiArg\n >({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}/status`,\n method: 'PUT',\n body: queryArg.templateGroup,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n updateTemplateGroupStatus: build.mutation<UpdateTemplateGroupStatusApiResponse, UpdateTemplateGroupStatusApiArg>({\n query: (queryArg) => ({\n url: `/templategroups/${queryArg.name}/status`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['TemplateGroup'],\n }),\n listTimeInterval: build.query<ListTimeIntervalApiResponse, ListTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals`,\n params: {\n pretty: queryArg.pretty,\n allowWatchBookmarks: queryArg.allowWatchBookmarks,\n continue: queryArg['continue'],\n fieldSelector: queryArg.fieldSelector,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n watch: queryArg.watch,\n },\n }),\n providesTags: ['TimeInterval'],\n }),\n createTimeInterval: build.mutation<CreateTimeIntervalApiResponse, CreateTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals`,\n method: 'POST',\n body: queryArg.timeInterval,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n deletecollectionTimeInterval: build.mutation<\n DeletecollectionTimeIntervalApiResponse,\n DeletecollectionTimeIntervalApiArg\n >({\n query: (queryArg) => ({\n url: `/timeintervals`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n continue: queryArg['continue'],\n dryRun: queryArg.dryRun,\n fieldSelector: queryArg.fieldSelector,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n labelSelector: queryArg.labelSelector,\n limit: queryArg.limit,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n resourceVersion: queryArg.resourceVersion,\n resourceVersionMatch: queryArg.resourceVersionMatch,\n sendInitialEvents: queryArg.sendInitialEvents,\n timeoutSeconds: queryArg.timeoutSeconds,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n getTimeInterval: build.query<GetTimeIntervalApiResponse, GetTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['TimeInterval'],\n }),\n replaceTimeInterval: build.mutation<ReplaceTimeIntervalApiResponse, ReplaceTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}`,\n method: 'PUT',\n body: queryArg.timeInterval,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n deleteTimeInterval: build.mutation<DeleteTimeIntervalApiResponse, DeleteTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}`,\n method: 'DELETE',\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n gracePeriodSeconds: queryArg.gracePeriodSeconds,\n ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,\n orphanDependents: queryArg.orphanDependents,\n propagationPolicy: queryArg.propagationPolicy,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n updateTimeInterval: build.mutation<UpdateTimeIntervalApiResponse, UpdateTimeIntervalApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n getTimeIntervalStatus: build.query<GetTimeIntervalStatusApiResponse, GetTimeIntervalStatusApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}/status`,\n params: {\n pretty: queryArg.pretty,\n },\n }),\n providesTags: ['TimeInterval'],\n }),\n replaceTimeIntervalStatus: build.mutation<ReplaceTimeIntervalStatusApiResponse, ReplaceTimeIntervalStatusApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}/status`,\n method: 'PUT',\n body: queryArg.timeInterval,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n updateTimeIntervalStatus: build.mutation<UpdateTimeIntervalStatusApiResponse, UpdateTimeIntervalStatusApiArg>({\n query: (queryArg) => ({\n url: `/timeintervals/${queryArg.name}/status`,\n method: 'PATCH',\n body: queryArg.patch,\n params: {\n pretty: queryArg.pretty,\n dryRun: queryArg.dryRun,\n fieldManager: queryArg.fieldManager,\n fieldValidation: queryArg.fieldValidation,\n force: queryArg.force,\n },\n }),\n invalidatesTags: ['TimeInterval'],\n }),\n }),\n overrideExisting: false,\n });\nexport { injectedRtkApi as notificationsAPI };\nexport type GetApiResourcesApiResponse = /** status 200 OK */ ApiResourceList;\nexport type GetApiResourcesApiArg = void;\nexport type ListReceiverApiResponse = /** status 200 OK */ ReceiverList;\nexport type ListReceiverApiArg = {\n /** If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget). */\n pretty?: string;\n /** allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. */\n allowWatchBookmarks?: boolean;\n /** The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n \n This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. */\n continue?: string;\n /** A selector to restrict the list of returned objects by their fields. Defaults to everything. */\n fieldSelector?: string;\n /** A selector to restrict the list of returned objects by their labels. Defaults to everything. */\n labelSelector?: string;\n /** limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n \n The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. */\n limit?: number;\n /** resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n \n Defaults to unset */\n resourceVersion?: string;\n /** resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n \n Defaults to unset */\n resourceVersionMatch?: string;\n /** `sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n \n When `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n - `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n \n Defaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise. */\n sendInitialEvents?: boolean;\n /** Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. */\n timeoutSeconds?: number;\n /** Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. */\n watch?: boolean;\n};\nexport type CreateReceiverApiResponse = /** status 200 OK */\n | Receiver\n | /** status 201 Created */ Receiver\n | /** status 202 Accepted */ Receiver;\nexport type CreateReceiverApiArg = {\n /** If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget). */\n pretty?: string;\n /** When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed */\n dryRun?: string;\n /** fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. */\n fieldManager?: string;\n /** fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. */\n fieldValidation?: string;\n receiver: Receiver;\n};\nexport type DeletecollectionReceiverApiResponse = /** status 200 OK */ Status;\nexport type DeletecollectionReceiverApiArg = {\n /** If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget). */\n pretty?: string;\n /** The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n \n This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. */\n cont