Codegen: Generate Golang code using cog (#98812)

* Use cog for Go types

* Delete old generation code

* Fix plugins generation

* workspaces update

* Update datasources with new generated code

* More fixes

* Update swagger and openapi specs

* Fixes

* More files...

* Update workspace

* More fixes...

* Remove unused functions
This commit is contained in:
Selene
2025-01-14 15:58:38 +01:00
committed by GitHub
parent b96a752db3
commit 7151ea6abc
58 changed files with 4910 additions and 4202 deletions
@@ -7,110 +7,75 @@
//
// Run 'make gen-cue' from repository root to regenerate.
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package dataquery
// Defines values for LokiQueryDirection.
type QueryEditorMode string
const (
LokiQueryDirectionBackward LokiQueryDirection = "backward"
LokiQueryDirectionForward LokiQueryDirection = "forward"
LokiQueryDirectionScan LokiQueryDirection = "scan"
QueryEditorModeCode QueryEditorMode = "code"
QueryEditorModeBuilder QueryEditorMode = "builder"
)
// Defines values for LokiQueryType.
type LokiQueryType string
const (
LokiQueryTypeInstant LokiQueryType = "instant"
LokiQueryTypeRange LokiQueryType = "range"
LokiQueryTypeInstant LokiQueryType = "instant"
LokiQueryTypeStream LokiQueryType = "stream"
)
// Defines values for QueryEditorMode.
const (
QueryEditorModeBuilder QueryEditorMode = "builder"
QueryEditorModeCode QueryEditorMode = "code"
)
type SupportingQueryType string
// Defines values for SupportingQueryType.
const (
SupportingQueryTypeLogsVolume SupportingQueryType = "logsVolume"
SupportingQueryTypeLogsSample SupportingQueryType = "logsSample"
SupportingQueryTypeDataSample SupportingQueryType = "dataSample"
SupportingQueryTypeInfiniteScroll SupportingQueryType = "infiniteScroll"
SupportingQueryTypeLogsSample SupportingQueryType = "logsSample"
SupportingQueryTypeLogsVolume SupportingQueryType = "logsVolume"
)
// These are the common properties available to all queries in all datasources.
// Specific implementations will *extend* this interface, adding the required
// properties for the given context.
type DataQuery struct {
// For mixed data sources the selected datasource is on the query level.
// For non mixed scenarios this is undefined.
// TODO find a better way to do this ^ that's friendly to schema
// TODO this shouldn't be unknown but DataSourceRef | null
Datasource *any `json:"datasource,omitempty"`
type LokiQueryDirection string
// If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.
Hide *bool `json:"hide,omitempty"`
// Specify the query flavor
// TODO make this required and give it a default
QueryType *string `json:"queryType,omitempty"`
const (
LokiQueryDirectionForward LokiQueryDirection = "forward"
LokiQueryDirectionBackward LokiQueryDirection = "backward"
LokiQueryDirectionScan LokiQueryDirection = "scan"
)
type LokiDataQuery struct {
// The LogQL query.
Expr string `json:"expr"`
// Used to override the name of the series.
LegendFormat *string `json:"legendFormat,omitempty"`
// Used to limit the number of log rows returned.
MaxLines *int64 `json:"maxLines,omitempty"`
// @deprecated, now use step.
Resolution *int64 `json:"resolution,omitempty"`
EditorMode *QueryEditorMode `json:"editorMode,omitempty"`
// @deprecated, now use queryType.
Range *bool `json:"range,omitempty"`
// @deprecated, now use queryType.
Instant *bool `json:"instant,omitempty"`
// Used to set step value for range queries.
Step *string `json:"step,omitempty"`
// A unique identifier for the query within the list of targets.
// In server side expressions, the refId is used as a variable name to identify results.
// By default, the UI will assign A->Z; however setting meaningful names may be useful.
RefId string `json:"refId"`
}
// LokiDataQuery defines model for LokiDataQuery.
type LokiDataQuery struct {
// If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.
Hide *bool `json:"hide,omitempty"`
// Specify the query flavor
// TODO make this required and give it a default
QueryType *string `json:"queryType,omitempty"`
// For mixed data sources the selected datasource is on the query level.
// For non mixed scenarios this is undefined.
// TODO find a better way to do this ^ that's friendly to schema
// TODO this shouldn't be unknown but DataSourceRef | null
Datasource *any `json:"datasource,omitempty"`
EditorMode *QueryEditorMode `json:"editorMode,omitempty"`
// The LogQL query.
Expr *string `json:"expr,omitempty"`
// If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.
Hide *bool `json:"hide,omitempty"`
// @deprecated, now use queryType.
Instant *bool `json:"instant,omitempty"`
// Used to override the name of the series.
LegendFormat *string `json:"legendFormat,omitempty"`
// Used to limit the number of log rows returned.
MaxLines *int64 `json:"maxLines,omitempty"`
// Specify the query flavor
// TODO make this required and give it a default
QueryType *string `json:"queryType,omitempty"`
// @deprecated, now use queryType.
Range *bool `json:"range,omitempty"`
// A unique identifier for the query within the list of targets.
// In server side expressions, the refId is used as a variable name to identify results.
// By default, the UI will assign A->Z; however setting meaningful names may be useful.
RefId *string `json:"refId,omitempty"`
// @deprecated, now use step.
Resolution *int64 `json:"resolution,omitempty"`
// Used to set step value for range queries.
Step *string `json:"step,omitempty"`
Datasource any `json:"datasource,omitempty"`
}
// LokiQueryDirection defines model for LokiQueryDirection.
type LokiQueryDirection string
// LokiQueryType defines model for LokiQueryType.
type LokiQueryType string
// QueryEditorMode defines model for QueryEditorMode.
type QueryEditorMode string
// SupportingQueryType defines model for SupportingQueryType.
type SupportingQueryType string
// NewLokiDataQuery creates a new LokiDataQuery object.
func NewLokiDataQuery() *LokiDataQuery {
return &LokiDataQuery{}
}