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`.
|
||||
|
||||
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 = {
|
||||
/** 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: string;
|
||||
metadata: ObjectMeta;
|
||||
|
@ -1730,7 +1730,7 @@ export type RoutingTreeStatus = {
|
|||
};
|
||||
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?: 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: string;
|
||||
metadata: ObjectMeta;
|
||||
|
@ -1779,7 +1779,7 @@ export type TemplateGroupStatus = {
|
|||
};
|
||||
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?: 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: string;
|
||||
metadata: ObjectMeta;
|
||||
|
@ -1840,7 +1840,7 @@ export type TimeIntervalStatus = {
|
|||
};
|
||||
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?: 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: string;
|
||||
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 */
|
||||
uid?: string;
|
||||
};
|
||||
export type AlertRuleSpec = {
|
||||
annotations?: {
|
||||
[key: string]: string;
|
||||
export type AlertRuleTemplateString = string;
|
||||
export type AlertRuleDatasourceUid = string;
|
||||
export type AlertRulePromDurationWMillis = string;
|
||||
export type AlertRuleRelativeTimeRange = {
|
||||
from: AlertRulePromDurationWMillis;
|
||||
to: AlertRulePromDurationWMillis;
|
||||
};
|
||||
data: {
|
||||
[key: string]: {
|
||||
datasourceUID: string;
|
||||
model: any;
|
||||
queryType: string;
|
||||
relativeTimeRange?: {
|
||||
from: string;
|
||||
to: string;
|
||||
export type AlertRuleExpression = {
|
||||
datasourceUID?: AlertRuleDatasourceUid;
|
||||
model: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/** 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;
|
||||
};
|
||||
export type AlertRuleExpressionMap = {
|
||||
[key: string]: AlertRuleExpression;
|
||||
};
|
||||
execErrState: 'Error' | 'Ok' | 'Alerting' | 'KeepLast';
|
||||
for?: any & any;
|
||||
keepFiringFor?: any & any;
|
||||
export type AlertRuleTimeIntervalRef = string;
|
||||
export type AlertRulePromDuration = string;
|
||||
export type AlertRuleIntervalTrigger = {
|
||||
interval: AlertRulePromDuration;
|
||||
};
|
||||
export type AlertRuleSpec = {
|
||||
annotations?: {
|
||||
[key: string]: AlertRuleTemplateString;
|
||||
};
|
||||
execErrState: string;
|
||||
expressions: AlertRuleExpressionMap;
|
||||
for?: string;
|
||||
keepFiringFor?: string;
|
||||
labels?: {
|
||||
[key: string]: string;
|
||||
[key: string]: AlertRuleTemplateString;
|
||||
};
|
||||
missingSeriesEvalsToResolve?: number;
|
||||
noDataState: 'NoData' | 'Ok' | 'Alerting' | 'KeepLast';
|
||||
noDataState: string;
|
||||
notificationSettings?: {
|
||||
activeTimeIntervals?: string[];
|
||||
activeTimeIntervals?: AlertRuleTimeIntervalRef[];
|
||||
groupBy?: string[];
|
||||
groupInterval?: any & any;
|
||||
groupWait?: any & any;
|
||||
muteTimeIntervals?: string[];
|
||||
groupInterval?: AlertRulePromDuration;
|
||||
groupWait?: AlertRulePromDuration;
|
||||
muteTimeIntervals?: AlertRuleTimeIntervalRef[];
|
||||
receiver: string;
|
||||
repeatInterval?: any & any;
|
||||
repeatInterval?: AlertRulePromDuration;
|
||||
};
|
||||
panelRef?: {
|
||||
dashboardUID: string;
|
||||
|
@ -881,41 +899,43 @@ export type AlertRuleSpec = {
|
|||
};
|
||||
paused?: boolean;
|
||||
title: string;
|
||||
trigger: {
|
||||
interval: any & any;
|
||||
trigger: AlertRuleIntervalTrigger;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
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]: {
|
||||
export type AlertRuleOperatorState = {
|
||||
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
||||
descriptiveState?: string;
|
||||
/** details contains any extra information that is operator-specific */
|
||||
details?: {
|
||||
[key: string]: {
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
/** lastEvaluation is the ResourceVersion last evaluated */
|
||||
lastEvaluation: string;
|
||||
/** state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation. */
|
||||
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 = {
|
||||
/** 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?: string;
|
||||
metadata?: ObjectMeta;
|
||||
spec?: AlertRuleSpec;
|
||||
kind: string;
|
||||
metadata: ObjectMeta;
|
||||
spec: AlertRuleSpec;
|
||||
status?: AlertRuleStatus;
|
||||
};
|
||||
export type ListMeta = {
|
||||
|
@ -981,61 +1001,80 @@ export type Status = {
|
|||
status?: string;
|
||||
};
|
||||
export type Patch = object;
|
||||
export type RecordingRuleSpec = {
|
||||
data: {
|
||||
[key: string]: {
|
||||
datasourceUID: string;
|
||||
model: any;
|
||||
queryType: string;
|
||||
relativeTimeRange?: {
|
||||
from: string;
|
||||
to: string;
|
||||
export type RecordingRuleDatasourceUid = string;
|
||||
export type RecordingRulePromDurationWMillis = string;
|
||||
export type RecordingRuleRelativeTimeRange = {
|
||||
from: RecordingRulePromDurationWMillis;
|
||||
to: RecordingRulePromDurationWMillis;
|
||||
};
|
||||
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;
|
||||
};
|
||||
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?: {
|
||||
[key: string]: string;
|
||||
[key: string]: RecordingRuleTemplateString;
|
||||
};
|
||||
metric: string;
|
||||
paused?: boolean;
|
||||
targetDatasourceUID: string;
|
||||
title: string;
|
||||
trigger: {
|
||||
interval: any & any;
|
||||
trigger: RecordingRuleIntervalTrigger;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
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]: {
|
||||
export type RecordingRuleOperatorState = {
|
||||
/** descriptiveState is an optional more descriptive state field which has no requirements on format */
|
||||
descriptiveState?: string;
|
||||
/** details contains any extra information that is operator-specific */
|
||||
details?: {
|
||||
[key: string]: {
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
/** lastEvaluation is the ResourceVersion last evaluated */
|
||||
lastEvaluation: string;
|
||||
/** state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation. */
|
||||
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 = {
|
||||
/** 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?: string;
|
||||
metadata?: ObjectMeta;
|
||||
spec?: RecordingRuleSpec;
|
||||
kind: string;
|
||||
metadata: ObjectMeta;
|
||||
spec: RecordingRuleSpec;
|
||||
status?: RecordingRuleStatus;
|
||||
};
|
||||
export type RecordingRuleList = {
|
||||
|
|
Loading…
Reference in New Issue