mirror of https://github.com/grafana/grafana.git
Update RTKQ endpoint(s) and update README
This commit is contained in:
parent
7db96fb27c
commit
118bbdad7b
|
@ -1,4 +1,23 @@
|
||||||
These files are built using the `yarn run codegen` command.
|
# Re-generate the clients
|
||||||
|
|
||||||
|
⚠️ This guide assumes the Backend definitions have been updated in `apps/alerting`.
|
||||||
|
|
||||||
|
## Re-create OpenAPI specification
|
||||||
|
|
||||||
|
Start with re-generating the OpenAPI snapshots by running the test in `pkg/tests/apis/openapi_test.go`.
|
||||||
|
|
||||||
|
This will output the OpenAPI JSON spec file(s) in `pkg/tests/apis/openapi_snapshots`.
|
||||||
|
|
||||||
|
## Process OpenAPI specifications
|
||||||
|
|
||||||
|
Next up run the post-processing of the snapshots with `yarn run process-specs`, this will copy processed specifications to `./data/openapi/`.
|
||||||
|
|
||||||
|
## Generate RTKQ files
|
||||||
|
|
||||||
|
These files are built using the `yarn run codegen` command, make sure to run that in the Grafana Alerting package working directory.
|
||||||
|
|
||||||
|
`yarn --cwd ./packages/grafana-alerting run codegen`.
|
||||||
|
|
||||||
API clients will be written to `src/grafana/api/<version>/api.gen.ts`.
|
API clients will be written to `src/grafana/api/<version>/api.gen.ts`.
|
||||||
|
|
||||||
Make sure to create a versioned API client for each API version – see `src/grafana/api/v0alpha1/api.ts` as an example.
|
Make sure to create a versioned API client for each API version – see `src/grafana/api/v0alpha1/api.ts` as an example.
|
||||||
|
|
|
@ -1602,7 +1602,7 @@ export type ReceiverStatus = {
|
||||||
};
|
};
|
||||||
export type Receiver = {
|
export type Receiver = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind: string;
|
kind: string;
|
||||||
metadata: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
|
@ -1730,7 +1730,7 @@ export type RoutingTreeStatus = {
|
||||||
};
|
};
|
||||||
export type RoutingTree = {
|
export type RoutingTree = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind: string;
|
kind: string;
|
||||||
metadata: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
|
@ -1779,7 +1779,7 @@ export type TemplateGroupStatus = {
|
||||||
};
|
};
|
||||||
export type TemplateGroup = {
|
export type TemplateGroup = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind: string;
|
kind: string;
|
||||||
metadata: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
|
@ -1840,7 +1840,7 @@ export type TimeIntervalStatus = {
|
||||||
};
|
};
|
||||||
export type TimeInterval = {
|
export type TimeInterval = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind: string;
|
kind: string;
|
||||||
metadata: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
|
|
|
@ -842,38 +842,56 @@ export type ObjectMeta = {
|
||||||
Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids */
|
Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids */
|
||||||
uid?: string;
|
uid?: string;
|
||||||
};
|
};
|
||||||
export type AlertRuleSpec = {
|
export type AlertRuleTemplateString = string;
|
||||||
annotations?: {
|
export type AlertRuleDatasourceUid = string;
|
||||||
[key: string]: string;
|
export type AlertRulePromDurationWMillis = string;
|
||||||
|
export type AlertRuleRelativeTimeRange = {
|
||||||
|
from: AlertRulePromDurationWMillis;
|
||||||
|
to: AlertRulePromDurationWMillis;
|
||||||
};
|
};
|
||||||
data: {
|
export type AlertRuleExpression = {
|
||||||
[key: string]: {
|
datasourceUID?: AlertRuleDatasourceUid;
|
||||||
datasourceUID: string;
|
model: {
|
||||||
model: any;
|
[key: string]: any;
|
||||||
queryType: string;
|
|
||||||
relativeTimeRange?: {
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
};
|
};
|
||||||
|
/** The type of query if this is a query expression */
|
||||||
|
queryType?: string;
|
||||||
|
relativeTimeRange?: AlertRuleRelativeTimeRange;
|
||||||
|
/** Used to mark the expression to be used as the final source for the rule evaluation
|
||||||
|
Only one expression in a rule can be marked as the source
|
||||||
|
For AlertRules, this is the expression that will be evaluated against the alerting condition
|
||||||
|
For RecordingRules, this is the expression that will be recorded */
|
||||||
source?: boolean;
|
source?: boolean;
|
||||||
};
|
};
|
||||||
|
export type AlertRuleExpressionMap = {
|
||||||
|
[key: string]: AlertRuleExpression;
|
||||||
};
|
};
|
||||||
execErrState: 'Error' | 'Ok' | 'Alerting' | 'KeepLast';
|
export type AlertRuleTimeIntervalRef = string;
|
||||||
for?: any & any;
|
export type AlertRulePromDuration = string;
|
||||||
keepFiringFor?: any & any;
|
export type AlertRuleIntervalTrigger = {
|
||||||
|
interval: AlertRulePromDuration;
|
||||||
|
};
|
||||||
|
export type AlertRuleSpec = {
|
||||||
|
annotations?: {
|
||||||
|
[key: string]: AlertRuleTemplateString;
|
||||||
|
};
|
||||||
|
execErrState: string;
|
||||||
|
expressions: AlertRuleExpressionMap;
|
||||||
|
for?: string;
|
||||||
|
keepFiringFor?: string;
|
||||||
labels?: {
|
labels?: {
|
||||||
[key: string]: string;
|
[key: string]: AlertRuleTemplateString;
|
||||||
};
|
};
|
||||||
missingSeriesEvalsToResolve?: number;
|
missingSeriesEvalsToResolve?: number;
|
||||||
noDataState: 'NoData' | 'Ok' | 'Alerting' | 'KeepLast';
|
noDataState: string;
|
||||||
notificationSettings?: {
|
notificationSettings?: {
|
||||||
activeTimeIntervals?: string[];
|
activeTimeIntervals?: AlertRuleTimeIntervalRef[];
|
||||||
groupBy?: string[];
|
groupBy?: string[];
|
||||||
groupInterval?: any & any;
|
groupInterval?: AlertRulePromDuration;
|
||||||
groupWait?: any & any;
|
groupWait?: AlertRulePromDuration;
|
||||||
muteTimeIntervals?: string[];
|
muteTimeIntervals?: AlertRuleTimeIntervalRef[];
|
||||||
receiver: string;
|
receiver: string;
|
||||||
repeatInterval?: any & any;
|
repeatInterval?: AlertRulePromDuration;
|
||||||
};
|
};
|
||||||
panelRef?: {
|
panelRef?: {
|
||||||
dashboardUID: string;
|
dashboardUID: string;
|
||||||
|
@ -881,41 +899,43 @@ export type AlertRuleSpec = {
|
||||||
};
|
};
|
||||||
paused?: boolean;
|
paused?: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
trigger: {
|
trigger: AlertRuleIntervalTrigger;
|
||||||
interval: any & any;
|
|
||||||
};
|
};
|
||||||
[key: string]: any;
|
export type AlertRuleOperatorState = {
|
||||||
};
|
|
||||||
export type AlertRuleStatus = {
|
|
||||||
/** additionalFields is reserved for future use */
|
|
||||||
additionalFields?: {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
/** operatorStates is a map of operator ID to operator state evaluations.
|
|
||||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field. */
|
|
||||||
operatorStates?: {
|
|
||||||
[key: string]: {
|
|
||||||
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
||||||
descriptiveState?: string;
|
descriptiveState?: string;
|
||||||
/** details contains any extra information that is operator-specific */
|
/** details contains any extra information that is operator-specific */
|
||||||
details?: {
|
details?: {
|
||||||
|
[key: string]: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
/** lastEvaluation is the ResourceVersion last evaluated */
|
/** lastEvaluation is the ResourceVersion last evaluated */
|
||||||
lastEvaluation: string;
|
lastEvaluation: string;
|
||||||
/** state describes the state of the lastEvaluation.
|
/** state describes the state of the lastEvaluation.
|
||||||
It is limited to three possible states for machine evaluation. */
|
It is limited to three possible states for machine evaluation. */
|
||||||
state: 'success' | 'in_progress' | 'failed';
|
state: 'success' | 'in_progress' | 'failed';
|
||||||
};
|
};
|
||||||
|
export type AlertRuleStatus = {
|
||||||
|
/** additionalFields is reserved for future use */
|
||||||
|
additionalFields?: {
|
||||||
|
[key: string]: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** operatorStates is a map of operator ID to operator state evaluations.
|
||||||
|
Any operator which consumes this kind SHOULD add its state evaluation information to this field. */
|
||||||
|
operatorStates?: {
|
||||||
|
[key: string]: AlertRuleOperatorState;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export type AlertRule = {
|
export type AlertRule = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind?: string;
|
kind: string;
|
||||||
metadata?: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
spec?: AlertRuleSpec;
|
spec: AlertRuleSpec;
|
||||||
status?: AlertRuleStatus;
|
status?: AlertRuleStatus;
|
||||||
};
|
};
|
||||||
export type ListMeta = {
|
export type ListMeta = {
|
||||||
|
@ -981,61 +1001,80 @@ export type Status = {
|
||||||
status?: string;
|
status?: string;
|
||||||
};
|
};
|
||||||
export type Patch = object;
|
export type Patch = object;
|
||||||
export type RecordingRuleSpec = {
|
export type RecordingRuleDatasourceUid = string;
|
||||||
data: {
|
export type RecordingRulePromDurationWMillis = string;
|
||||||
[key: string]: {
|
export type RecordingRuleRelativeTimeRange = {
|
||||||
datasourceUID: string;
|
from: RecordingRulePromDurationWMillis;
|
||||||
model: any;
|
to: RecordingRulePromDurationWMillis;
|
||||||
queryType: string;
|
|
||||||
relativeTimeRange?: {
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
};
|
};
|
||||||
|
export type RecordingRuleExpression = {
|
||||||
|
datasourceUID?: RecordingRuleDatasourceUid;
|
||||||
|
model: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
/** The type of query if this is a query expression */
|
||||||
|
queryType?: string;
|
||||||
|
relativeTimeRange?: RecordingRuleRelativeTimeRange;
|
||||||
|
/** Used to mark the expression to be used as the final source for the rule evaluation
|
||||||
|
Only one expression in a rule can be marked as the source
|
||||||
|
For AlertRules, this is the expression that will be evaluated against the alerting condition
|
||||||
|
For RecordingRules, this is the expression that will be recorded */
|
||||||
source?: boolean;
|
source?: boolean;
|
||||||
};
|
};
|
||||||
|
export type RecordingRuleExpressionMap = {
|
||||||
|
[key: string]: RecordingRuleExpression;
|
||||||
};
|
};
|
||||||
|
export type RecordingRuleTemplateString = string;
|
||||||
|
export type RecordingRulePromDuration = string;
|
||||||
|
export type RecordingRuleIntervalTrigger = {
|
||||||
|
interval: RecordingRulePromDuration;
|
||||||
|
};
|
||||||
|
export type RecordingRuleSpec = {
|
||||||
|
expressions: RecordingRuleExpressionMap;
|
||||||
labels?: {
|
labels?: {
|
||||||
[key: string]: string;
|
[key: string]: RecordingRuleTemplateString;
|
||||||
};
|
};
|
||||||
metric: string;
|
metric: string;
|
||||||
paused?: boolean;
|
paused?: boolean;
|
||||||
targetDatasourceUID: string;
|
targetDatasourceUID: string;
|
||||||
title: string;
|
title: string;
|
||||||
trigger: {
|
trigger: RecordingRuleIntervalTrigger;
|
||||||
interval: any & any;
|
|
||||||
};
|
};
|
||||||
[key: string]: any;
|
export type RecordingRuleOperatorState = {
|
||||||
};
|
|
||||||
export type RecordingRuleStatus = {
|
|
||||||
/** additionalFields is reserved for future use */
|
|
||||||
additionalFields?: {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
/** operatorStates is a map of operator ID to operator state evaluations.
|
|
||||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field. */
|
|
||||||
operatorStates?: {
|
|
||||||
[key: string]: {
|
|
||||||
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
||||||
descriptiveState?: string;
|
descriptiveState?: string;
|
||||||
/** details contains any extra information that is operator-specific */
|
/** details contains any extra information that is operator-specific */
|
||||||
details?: {
|
details?: {
|
||||||
|
[key: string]: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
/** lastEvaluation is the ResourceVersion last evaluated */
|
/** lastEvaluation is the ResourceVersion last evaluated */
|
||||||
lastEvaluation: string;
|
lastEvaluation: string;
|
||||||
/** state describes the state of the lastEvaluation.
|
/** state describes the state of the lastEvaluation.
|
||||||
It is limited to three possible states for machine evaluation. */
|
It is limited to three possible states for machine evaluation. */
|
||||||
state: 'success' | 'in_progress' | 'failed';
|
state: 'success' | 'in_progress' | 'failed';
|
||||||
};
|
};
|
||||||
|
export type RecordingRuleStatus = {
|
||||||
|
/** additionalFields is reserved for future use */
|
||||||
|
additionalFields?: {
|
||||||
|
[key: string]: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** operatorStates is a map of operator ID to operator state evaluations.
|
||||||
|
Any operator which consumes this kind SHOULD add its state evaluation information to this field. */
|
||||||
|
operatorStates?: {
|
||||||
|
[key: string]: RecordingRuleOperatorState;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export type RecordingRule = {
|
export type RecordingRule = {
|
||||||
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
/** APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */
|
||||||
apiVersion?: string;
|
apiVersion: string;
|
||||||
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
/** Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */
|
||||||
kind?: string;
|
kind: string;
|
||||||
metadata?: ObjectMeta;
|
metadata: ObjectMeta;
|
||||||
spec?: RecordingRuleSpec;
|
spec: RecordingRuleSpec;
|
||||||
status?: RecordingRuleStatus;
|
status?: RecordingRuleStatus;
|
||||||
};
|
};
|
||||||
export type RecordingRuleList = {
|
export type RecordingRuleList = {
|
||||||
|
|
Loading…
Reference in New Issue