mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Cloudwatch: generate types (#61770)
* New pfs impl * Reached codegen parity with old system * Update all models.cue inputs * Rename all models.cue files * Remove unused prefixfs * Changes Queries->DataQuery schema interface * Recodegen * All tests passing, nearly good now * Add SchemaInterface to kindsys props * Add pascal name deriver * Relocate plugin cue files again * Clarify use of injected fields * Remove unnecessary aliasing * Move DataQuery into mudball * Allow forcing ExpandReferences on go type generation * Move DataQuery def into kindsys, add generator to copy it to common * Fix copy generator to replace package name correctly * Setup Cloudwatch data query schema * Add go file * Re-generate types * Re-generate types * Add missing files * Re-generate docs * Add MetricStat * Add CloudWatchAnnotationQuery * Remove DataQuery extension * Fixes * Sync with main * Update report --------- Co-authored-by: sam boyer <sdboyer@grafana.com>
This commit is contained in:
parent
ebe54629e7
commit
84a6671911
@ -0,0 +1,19 @@
|
||||
---
|
||||
keywords:
|
||||
- grafana
|
||||
- schema
|
||||
title: CloudWatchDataQuery kind
|
||||
---
|
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice.
|
||||
|
||||
## CloudWatchDataQuery
|
||||
|
||||
#### Maturity: merged
|
||||
#### Version: 0.0
|
||||
|
||||
|
||||
|
||||
| Property | Type | Required | Description |
|
||||
|----------|------|----------|-------------|
|
||||
|
||||
|
@ -234,7 +234,9 @@
|
||||
},
|
||||
"cloudwatchdataquery": {
|
||||
"category": "composable",
|
||||
"codeowners": [],
|
||||
"codeowners": [
|
||||
"grafana/aws-plugins"
|
||||
],
|
||||
"currentVersion": [
|
||||
0,
|
||||
0
|
||||
@ -242,13 +244,13 @@
|
||||
"grafanaMaturityCount": 0,
|
||||
"lineageIsGroup": false,
|
||||
"links": {
|
||||
"docs": "n/a",
|
||||
"go": "n/a",
|
||||
"schema": "n/a",
|
||||
"ts": "n/a"
|
||||
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/composable/cloudwatchdataquery/schema-reference",
|
||||
"go": "https://github.com/grafana/grafana/tree/main/pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go",
|
||||
"schema": "https://github.com/grafana/grafana/tree/main/public/app/plugins/datasource/cloudwatch/dataquery.cue",
|
||||
"ts": "https://github.com/grafana/grafana/tree/main/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts"
|
||||
},
|
||||
"machineName": "cloudwatchdataquery",
|
||||
"maturity": "planned",
|
||||
"maturity": "merged",
|
||||
"name": "CloudWatchDataQuery",
|
||||
"pluralMachineName": "cloudwatchdataquerys",
|
||||
"pluralName": "CloudWatchDataQuerys",
|
||||
@ -2012,13 +2014,14 @@
|
||||
"items": [
|
||||
"alertgroupspanelcfg",
|
||||
"azuremonitordataquery",
|
||||
"cloudwatchdataquery",
|
||||
"playlist",
|
||||
"preferences",
|
||||
"publicdashboard",
|
||||
"serviceaccount",
|
||||
"team"
|
||||
],
|
||||
"count": 7
|
||||
"count": 8
|
||||
},
|
||||
"planned": {
|
||||
"name": "planned",
|
||||
@ -2028,7 +2031,6 @@
|
||||
"alertmanagerdatasourcecfg",
|
||||
"apikey",
|
||||
"azuremonitordatasourcecfg",
|
||||
"cloudwatchdataquery",
|
||||
"cloudwatchdatasourcecfg",
|
||||
"dashboarddataquery",
|
||||
"dashboarddatasourcecfg",
|
||||
@ -2074,7 +2076,7 @@
|
||||
"zipkindataquery",
|
||||
"zipkindatasourcecfg"
|
||||
],
|
||||
"count": 50
|
||||
"count": 49
|
||||
},
|
||||
"stable": {
|
||||
"name": "stable",
|
||||
|
575
pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go
Normal file
575
pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go
Normal file
@ -0,0 +1,575 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// public/app/plugins/gen.go
|
||||
// Using jennies:
|
||||
// PluginGoTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package dataquery
|
||||
|
||||
// Defines values for CloudWatchAnnotationQueryQueryMode.
|
||||
const (
|
||||
CloudWatchAnnotationQueryQueryModeAnnotations CloudWatchAnnotationQueryQueryMode = "Annotations"
|
||||
|
||||
CloudWatchAnnotationQueryQueryModeLogs CloudWatchAnnotationQueryQueryMode = "Logs"
|
||||
|
||||
CloudWatchAnnotationQueryQueryModeMetrics CloudWatchAnnotationQueryQueryMode = "Metrics"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchLogsQueryQueryMode.
|
||||
const (
|
||||
CloudWatchLogsQueryQueryModeAnnotations CloudWatchLogsQueryQueryMode = "Annotations"
|
||||
|
||||
CloudWatchLogsQueryQueryModeLogs CloudWatchLogsQueryQueryMode = "Logs"
|
||||
|
||||
CloudWatchLogsQueryQueryModeMetrics CloudWatchLogsQueryQueryMode = "Metrics"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQueryMetricEditorMode.
|
||||
const (
|
||||
CloudWatchMetricsQueryMetricEditorModeN0 CloudWatchMetricsQueryMetricEditorMode = 0
|
||||
|
||||
CloudWatchMetricsQueryMetricEditorModeN1 CloudWatchMetricsQueryMetricEditorMode = 1
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQueryMetricQueryType.
|
||||
const (
|
||||
CloudWatchMetricsQueryMetricQueryTypeN0 CloudWatchMetricsQueryMetricQueryType = 0
|
||||
|
||||
CloudWatchMetricsQueryMetricQueryTypeN1 CloudWatchMetricsQueryMetricQueryType = 1
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQueryQueryMode.
|
||||
const (
|
||||
CloudWatchMetricsQueryQueryModeAnnotations CloudWatchMetricsQueryQueryMode = "Annotations"
|
||||
|
||||
CloudWatchMetricsQueryQueryModeLogs CloudWatchMetricsQueryQueryMode = "Logs"
|
||||
|
||||
CloudWatchMetricsQueryQueryModeMetrics CloudWatchMetricsQueryQueryMode = "Metrics"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlGroupByType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlGroupByTypeAnd CloudWatchMetricsQuerySqlGroupByType = "and"
|
||||
|
||||
CloudWatchMetricsQuerySqlGroupByTypeOr CloudWatchMetricsQuerySqlGroupByType = "or"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlOrderByParametersType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlOrderByParametersTypeFunctionParameter CloudWatchMetricsQuerySqlOrderByParametersType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlOrderByType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlOrderByTypeFunction CloudWatchMetricsQuerySqlOrderByType = "function"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlSelectParametersType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlSelectParametersTypeFunctionParameter CloudWatchMetricsQuerySqlSelectParametersType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlSelectType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlSelectTypeFunction CloudWatchMetricsQuerySqlSelectType = "function"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchMetricsQuerySqlWhereType.
|
||||
const (
|
||||
CloudWatchMetricsQuerySqlWhereTypeAnd CloudWatchMetricsQuerySqlWhereType = "and"
|
||||
|
||||
CloudWatchMetricsQuerySqlWhereTypeOr CloudWatchMetricsQuerySqlWhereType = "or"
|
||||
)
|
||||
|
||||
// Defines values for CloudWatchQueryMode.
|
||||
const (
|
||||
CloudWatchQueryModeAnnotations CloudWatchQueryMode = "Annotations"
|
||||
|
||||
CloudWatchQueryModeLogs CloudWatchQueryMode = "Logs"
|
||||
|
||||
CloudWatchQueryModeMetrics CloudWatchQueryMode = "Metrics"
|
||||
)
|
||||
|
||||
// Defines values for MetricEditorMode.
|
||||
const (
|
||||
MetricEditorModeN0 MetricEditorMode = 0
|
||||
|
||||
MetricEditorModeN1 MetricEditorMode = 1
|
||||
)
|
||||
|
||||
// Defines values for MetricQueryType.
|
||||
const (
|
||||
MetricQueryTypeN0 MetricQueryType = 0
|
||||
|
||||
MetricQueryTypeN1 MetricQueryType = 1
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorArrayExpressionType.
|
||||
const (
|
||||
QueryEditorArrayExpressionTypeAnd QueryEditorArrayExpressionType = "and"
|
||||
|
||||
QueryEditorArrayExpressionTypeOr QueryEditorArrayExpressionType = "or"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorExpressionType.
|
||||
const (
|
||||
QueryEditorExpressionTypeAnd QueryEditorExpressionType = "and"
|
||||
|
||||
QueryEditorExpressionTypeFunction QueryEditorExpressionType = "function"
|
||||
|
||||
QueryEditorExpressionTypeFunctionParameter QueryEditorExpressionType = "functionParameter"
|
||||
|
||||
QueryEditorExpressionTypeGroupBy QueryEditorExpressionType = "groupBy"
|
||||
|
||||
QueryEditorExpressionTypeOperator QueryEditorExpressionType = "operator"
|
||||
|
||||
QueryEditorExpressionTypeOr QueryEditorExpressionType = "or"
|
||||
|
||||
QueryEditorExpressionTypeProperty QueryEditorExpressionType = "property"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorFunctionExpressionParametersType.
|
||||
const (
|
||||
QueryEditorFunctionExpressionParametersTypeFunctionParameter QueryEditorFunctionExpressionParametersType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorFunctionExpressionType.
|
||||
const (
|
||||
QueryEditorFunctionExpressionTypeFunction QueryEditorFunctionExpressionType = "function"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorFunctionParameterExpressionType.
|
||||
const (
|
||||
QueryEditorFunctionParameterExpressionTypeFunctionParameter QueryEditorFunctionParameterExpressionType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorGroupByExpressionPropertyType.
|
||||
const (
|
||||
QueryEditorGroupByExpressionPropertyTypeString QueryEditorGroupByExpressionPropertyType = "string"
|
||||
|
||||
QueryEditorGroupByExpressionPropertyTypeTest QueryEditorGroupByExpressionPropertyType = "test"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorGroupByExpressionType.
|
||||
const (
|
||||
QueryEditorGroupByExpressionTypeGroupBy QueryEditorGroupByExpressionType = "groupBy"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorOperatorExpressionPropertyType.
|
||||
const (
|
||||
QueryEditorOperatorExpressionPropertyTypeString QueryEditorOperatorExpressionPropertyType = "string"
|
||||
|
||||
QueryEditorOperatorExpressionPropertyTypeTest QueryEditorOperatorExpressionPropertyType = "test"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorOperatorExpressionType.
|
||||
const (
|
||||
QueryEditorOperatorExpressionTypeOperator QueryEditorOperatorExpressionType = "operator"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorPropertyType.
|
||||
const (
|
||||
QueryEditorPropertyTypeString QueryEditorPropertyType = "string"
|
||||
|
||||
QueryEditorPropertyTypeTest QueryEditorPropertyType = "test"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorPropertyExpressionPropertyType.
|
||||
const (
|
||||
QueryEditorPropertyExpressionPropertyTypeString QueryEditorPropertyExpressionPropertyType = "string"
|
||||
|
||||
QueryEditorPropertyExpressionPropertyTypeTest QueryEditorPropertyExpressionPropertyType = "test"
|
||||
)
|
||||
|
||||
// Defines values for QueryEditorPropertyExpressionType.
|
||||
const (
|
||||
QueryEditorPropertyExpressionTypeProperty QueryEditorPropertyExpressionType = "property"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionGroupByType.
|
||||
const (
|
||||
SQLExpressionGroupByTypeAnd SQLExpressionGroupByType = "and"
|
||||
|
||||
SQLExpressionGroupByTypeOr SQLExpressionGroupByType = "or"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionOrderByParametersType.
|
||||
const (
|
||||
SQLExpressionOrderByParametersTypeFunctionParameter SQLExpressionOrderByParametersType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionOrderByType.
|
||||
const (
|
||||
SQLExpressionOrderByTypeFunction SQLExpressionOrderByType = "function"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionSelectParametersType.
|
||||
const (
|
||||
SQLExpressionSelectParametersTypeFunctionParameter SQLExpressionSelectParametersType = "functionParameter"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionSelectType.
|
||||
const (
|
||||
SQLExpressionSelectTypeFunction SQLExpressionSelectType = "function"
|
||||
)
|
||||
|
||||
// Defines values for SQLExpressionWhereType.
|
||||
const (
|
||||
SQLExpressionWhereTypeAnd SQLExpressionWhereType = "and"
|
||||
|
||||
SQLExpressionWhereTypeOr SQLExpressionWhereType = "or"
|
||||
)
|
||||
|
||||
// CloudWatchAnnotationQuery defines model for CloudWatchAnnotationQuery.
|
||||
type CloudWatchAnnotationQuery struct {
|
||||
AccountId *string `json:"accountId,omitempty"`
|
||||
ActionPrefix *string `json:"actionPrefix,omitempty"`
|
||||
AlarmNamePrefix *string `json:"alarmNamePrefix,omitempty"`
|
||||
Dimensions map[string]interface{} `json:"dimensions,omitempty"`
|
||||
MatchExact *bool `json:"matchExact,omitempty"`
|
||||
MetricName *string `json:"metricName,omitempty"`
|
||||
Namespace string `json:"namespace"`
|
||||
Period *string `json:"period,omitempty"`
|
||||
PrefixMatching *bool `json:"prefixMatching,omitempty"`
|
||||
QueryMode CloudWatchAnnotationQueryQueryMode `json:"queryMode"`
|
||||
Region string `json:"region"`
|
||||
Statistic *string `json:"statistic,omitempty"`
|
||||
|
||||
// @deprecated use statistic
|
||||
Statistics *[]string `json:"statistics,omitempty"`
|
||||
}
|
||||
|
||||
// CloudWatchAnnotationQueryQueryMode defines model for CloudWatchAnnotationQuery.QueryMode.
|
||||
type CloudWatchAnnotationQueryQueryMode string
|
||||
|
||||
// CloudWatchDataQuery defines model for CloudWatchDataQuery.
|
||||
type CloudWatchDataQuery map[string]interface{}
|
||||
|
||||
// CloudWatchLogsQuery defines model for CloudWatchLogsQuery.
|
||||
type CloudWatchLogsQuery 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 *interface{} `json:"datasource,omitempty"`
|
||||
Expression *string `json:"expression,omitempty"`
|
||||
|
||||
// true if query is disabled (ie should not be returned to the dashboard)
|
||||
Hide *bool `json:"hide,omitempty"`
|
||||
Id string `json:"id"`
|
||||
|
||||
// Unique, guid like, string used in explore mode
|
||||
Key *string `json:"key,omitempty"`
|
||||
|
||||
// deprecated, use logGroups instead
|
||||
LogGroupNames *[]string `json:"logGroupNames,omitempty"`
|
||||
LogGroups *[]struct {
|
||||
AccountId *string `json:"accountId,omitempty"`
|
||||
AccountLabel *string `json:"accountLabel,omitempty"`
|
||||
Arn string `json:"arn"`
|
||||
Name string `json:"name"`
|
||||
} `json:"logGroups,omitempty"`
|
||||
QueryMode CloudWatchLogsQueryQueryMode `json:"queryMode"`
|
||||
|
||||
// Specify the query flavor
|
||||
// TODO make this required and give it a default
|
||||
QueryType *string `json:"queryType,omitempty"`
|
||||
|
||||
// A - Z
|
||||
RefId string `json:"refId"`
|
||||
Region string `json:"region"`
|
||||
StatsGroups *[]string `json:"statsGroups,omitempty"`
|
||||
}
|
||||
|
||||
// CloudWatchLogsQueryQueryMode defines model for CloudWatchLogsQuery.QueryMode.
|
||||
type CloudWatchLogsQueryQueryMode string
|
||||
|
||||
// CloudWatchMetricsQuery defines model for CloudWatchMetricsQuery.
|
||||
type CloudWatchMetricsQuery struct {
|
||||
AccountId *string `json:"accountId,omitempty"`
|
||||
Alias *string `json:"alias,omitempty"`
|
||||
Dimensions map[string]interface{} `json:"dimensions,omitempty"`
|
||||
|
||||
// Math expression query
|
||||
Expression *string `json:"expression,omitempty"`
|
||||
|
||||
// common props
|
||||
Id string `json:"id"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
MatchExact *bool `json:"matchExact,omitempty"`
|
||||
MetricEditorMode *CloudWatchMetricsQueryMetricEditorMode `json:"metricEditorMode,omitempty"`
|
||||
MetricName *string `json:"metricName,omitempty"`
|
||||
MetricQueryType *CloudWatchMetricsQueryMetricQueryType `json:"metricQueryType,omitempty"`
|
||||
Namespace string `json:"namespace"`
|
||||
Period *string `json:"period,omitempty"`
|
||||
QueryMode *CloudWatchMetricsQueryQueryMode `json:"queryMode,omitempty"`
|
||||
Region string `json:"region"`
|
||||
Sql *struct {
|
||||
From *interface{} `json:"from,omitempty"`
|
||||
GroupBy *struct {
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
Expressions interface{} `json:"expressions"`
|
||||
|
||||
// TODO this doesn't work
|
||||
Type CloudWatchMetricsQuerySqlGroupByType `json:"type"`
|
||||
} `json:"groupBy,omitempty"`
|
||||
Limit *int64 `json:"limit,omitempty"`
|
||||
OrderBy *struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type CloudWatchMetricsQuerySqlOrderByParametersType `json:"type"`
|
||||
} `json:"parameters,omitempty"`
|
||||
Type CloudWatchMetricsQuerySqlOrderByType `json:"type"`
|
||||
} `json:"orderBy,omitempty"`
|
||||
OrderByDirection *string `json:"orderByDirection,omitempty"`
|
||||
Select *struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type CloudWatchMetricsQuerySqlSelectParametersType `json:"type"`
|
||||
} `json:"parameters,omitempty"`
|
||||
Type CloudWatchMetricsQuerySqlSelectType `json:"type"`
|
||||
} `json:"select,omitempty"`
|
||||
Where *struct {
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
Expressions interface{} `json:"expressions"`
|
||||
|
||||
// TODO this doesn't work
|
||||
Type CloudWatchMetricsQuerySqlWhereType `json:"type"`
|
||||
} `json:"where,omitempty"`
|
||||
} `json:"sql,omitempty"`
|
||||
SqlExpression *string `json:"sqlExpression,omitempty"`
|
||||
Statistic *string `json:"statistic,omitempty"`
|
||||
|
||||
// @deprecated use statistic
|
||||
Statistics *[]string `json:"statistics,omitempty"`
|
||||
}
|
||||
|
||||
// CloudWatchMetricsQueryMetricEditorMode defines model for CloudWatchMetricsQuery.MetricEditorMode.
|
||||
type CloudWatchMetricsQueryMetricEditorMode int
|
||||
|
||||
// CloudWatchMetricsQueryMetricQueryType defines model for CloudWatchMetricsQuery.MetricQueryType.
|
||||
type CloudWatchMetricsQueryMetricQueryType int
|
||||
|
||||
// CloudWatchMetricsQueryQueryMode defines model for CloudWatchMetricsQuery.QueryMode.
|
||||
type CloudWatchMetricsQueryQueryMode string
|
||||
|
||||
// TODO this doesn't work
|
||||
type CloudWatchMetricsQuerySqlGroupByType string
|
||||
|
||||
// CloudWatchMetricsQuerySqlOrderByParametersType defines model for CloudWatchMetricsQuery.Sql.OrderBy.Parameters.Type.
|
||||
type CloudWatchMetricsQuerySqlOrderByParametersType string
|
||||
|
||||
// CloudWatchMetricsQuerySqlOrderByType defines model for CloudWatchMetricsQuery.Sql.OrderBy.Type.
|
||||
type CloudWatchMetricsQuerySqlOrderByType string
|
||||
|
||||
// CloudWatchMetricsQuerySqlSelectParametersType defines model for CloudWatchMetricsQuery.Sql.Select.Parameters.Type.
|
||||
type CloudWatchMetricsQuerySqlSelectParametersType string
|
||||
|
||||
// CloudWatchMetricsQuerySqlSelectType defines model for CloudWatchMetricsQuery.Sql.Select.Type.
|
||||
type CloudWatchMetricsQuerySqlSelectType string
|
||||
|
||||
// TODO this doesn't work
|
||||
type CloudWatchMetricsQuerySqlWhereType string
|
||||
|
||||
// CloudWatchQueryMode defines model for CloudWatchQueryMode.
|
||||
type CloudWatchQueryMode string
|
||||
|
||||
// LogGroup defines model for LogGroup.
|
||||
type LogGroup struct {
|
||||
AccountId *string `json:"accountId,omitempty"`
|
||||
AccountLabel *string `json:"accountLabel,omitempty"`
|
||||
Arn string `json:"arn"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// MetricEditorMode defines model for MetricEditorMode.
|
||||
type MetricEditorMode int
|
||||
|
||||
// MetricQueryType defines model for MetricQueryType.
|
||||
type MetricQueryType int
|
||||
|
||||
// MetricStat defines model for MetricStat.
|
||||
type MetricStat struct {
|
||||
AccountId *string `json:"accountId,omitempty"`
|
||||
Dimensions map[string]interface{} `json:"dimensions,omitempty"`
|
||||
MatchExact *bool `json:"matchExact,omitempty"`
|
||||
MetricName *string `json:"metricName,omitempty"`
|
||||
Namespace string `json:"namespace"`
|
||||
Period *string `json:"period,omitempty"`
|
||||
Region string `json:"region"`
|
||||
Statistic *string `json:"statistic,omitempty"`
|
||||
|
||||
// @deprecated use statistic
|
||||
Statistics *[]string `json:"statistics,omitempty"`
|
||||
}
|
||||
|
||||
// QueryEditorArrayExpression defines model for QueryEditorArrayExpression.
|
||||
type QueryEditorArrayExpression struct {
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
Expressions interface{} `json:"expressions"`
|
||||
|
||||
// TODO this doesn't work
|
||||
Type QueryEditorArrayExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// TODO this doesn't work
|
||||
type QueryEditorArrayExpressionType string
|
||||
|
||||
// QueryEditorExpressionType defines model for QueryEditorExpressionType.
|
||||
type QueryEditorExpressionType string
|
||||
|
||||
// QueryEditorFunctionExpression defines model for QueryEditorFunctionExpression.
|
||||
type QueryEditorFunctionExpression struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorFunctionExpressionParametersType `json:"type"`
|
||||
} `json:"parameters,omitempty"`
|
||||
Type QueryEditorFunctionExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorFunctionExpressionParametersType defines model for QueryEditorFunctionExpression.Parameters.Type.
|
||||
type QueryEditorFunctionExpressionParametersType string
|
||||
|
||||
// QueryEditorFunctionExpressionType defines model for QueryEditorFunctionExpression.Type.
|
||||
type QueryEditorFunctionExpressionType string
|
||||
|
||||
// QueryEditorFunctionParameterExpression defines model for QueryEditorFunctionParameterExpression.
|
||||
type QueryEditorFunctionParameterExpression struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorFunctionParameterExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorFunctionParameterExpressionType defines model for QueryEditorFunctionParameterExpression.Type.
|
||||
type QueryEditorFunctionParameterExpressionType string
|
||||
|
||||
// QueryEditorGroupByExpression defines model for QueryEditorGroupByExpression.
|
||||
type QueryEditorGroupByExpression struct {
|
||||
Property struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorGroupByExpressionPropertyType `json:"type"`
|
||||
} `json:"property"`
|
||||
Type QueryEditorGroupByExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorGroupByExpressionPropertyType defines model for QueryEditorGroupByExpression.Property.Type.
|
||||
type QueryEditorGroupByExpressionPropertyType string
|
||||
|
||||
// QueryEditorGroupByExpressionType defines model for QueryEditorGroupByExpression.Type.
|
||||
type QueryEditorGroupByExpressionType string
|
||||
|
||||
// TODO <T extends QueryEditorOperatorValueType>, extend in veneer
|
||||
type QueryEditorOperator struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Value *interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// QueryEditorOperatorExpression defines model for QueryEditorOperatorExpression.
|
||||
type QueryEditorOperatorExpression struct {
|
||||
// TODO QueryEditorOperator<QueryEditorOperatorValueType>, extend in veneer
|
||||
Operator struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Value *interface{} `json:"value,omitempty"`
|
||||
} `json:"operator"`
|
||||
Property struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorOperatorExpressionPropertyType `json:"type"`
|
||||
} `json:"property"`
|
||||
Type QueryEditorOperatorExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorOperatorExpressionPropertyType defines model for QueryEditorOperatorExpression.Property.Type.
|
||||
type QueryEditorOperatorExpressionPropertyType string
|
||||
|
||||
// QueryEditorOperatorExpressionType defines model for QueryEditorOperatorExpression.Type.
|
||||
type QueryEditorOperatorExpressionType string
|
||||
|
||||
// QueryEditorOperatorType defines model for QueryEditorOperatorType.
|
||||
type QueryEditorOperatorType interface{}
|
||||
|
||||
// QueryEditorOperatorValueType defines model for QueryEditorOperatorValueType.
|
||||
type QueryEditorOperatorValueType interface{}
|
||||
|
||||
// QueryEditorProperty defines model for QueryEditorProperty.
|
||||
type QueryEditorProperty struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorPropertyType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorPropertyType defines model for QueryEditorProperty.Type.
|
||||
type QueryEditorPropertyType string
|
||||
|
||||
// QueryEditorPropertyExpression defines model for QueryEditorPropertyExpression.
|
||||
type QueryEditorPropertyExpression struct {
|
||||
Property struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorPropertyExpressionPropertyType `json:"type"`
|
||||
} `json:"property"`
|
||||
Type QueryEditorPropertyExpressionType `json:"type"`
|
||||
}
|
||||
|
||||
// QueryEditorPropertyExpressionPropertyType defines model for QueryEditorPropertyExpression.Property.Type.
|
||||
type QueryEditorPropertyExpressionPropertyType string
|
||||
|
||||
// QueryEditorPropertyExpressionType defines model for QueryEditorPropertyExpression.Type.
|
||||
type QueryEditorPropertyExpressionType string
|
||||
|
||||
// SQLExpression defines model for SQLExpression.
|
||||
type SQLExpression struct {
|
||||
From *interface{} `json:"from,omitempty"`
|
||||
GroupBy *struct {
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
Expressions interface{} `json:"expressions"`
|
||||
|
||||
// TODO this doesn't work
|
||||
Type SQLExpressionGroupByType `json:"type"`
|
||||
} `json:"groupBy,omitempty"`
|
||||
Limit *int64 `json:"limit,omitempty"`
|
||||
OrderBy *struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type SQLExpressionOrderByParametersType `json:"type"`
|
||||
} `json:"parameters,omitempty"`
|
||||
Type SQLExpressionOrderByType `json:"type"`
|
||||
} `json:"orderBy,omitempty"`
|
||||
OrderByDirection *string `json:"orderByDirection,omitempty"`
|
||||
Select *struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type SQLExpressionSelectParametersType `json:"type"`
|
||||
} `json:"parameters,omitempty"`
|
||||
Type SQLExpressionSelectType `json:"type"`
|
||||
} `json:"select,omitempty"`
|
||||
Where *struct {
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
Expressions interface{} `json:"expressions"`
|
||||
|
||||
// TODO this doesn't work
|
||||
Type SQLExpressionWhereType `json:"type"`
|
||||
} `json:"where,omitempty"`
|
||||
}
|
||||
|
||||
// TODO this doesn't work
|
||||
type SQLExpressionGroupByType string
|
||||
|
||||
// SQLExpressionOrderByParametersType defines model for SQLExpression.OrderBy.Parameters.Type.
|
||||
type SQLExpressionOrderByParametersType string
|
||||
|
||||
// SQLExpressionOrderByType defines model for SQLExpression.OrderBy.Type.
|
||||
type SQLExpressionOrderByType string
|
||||
|
||||
// SQLExpressionSelectParametersType defines model for SQLExpression.Select.Parameters.Type.
|
||||
type SQLExpressionSelectParametersType string
|
||||
|
||||
// SQLExpressionSelectType defines model for SQLExpression.Select.Type.
|
||||
type SQLExpressionSelectType string
|
||||
|
||||
// TODO this doesn't work
|
||||
type SQLExpressionWhereType string
|
172
public/app/plugins/datasource/cloudwatch/dataquery.cue
Normal file
172
public/app/plugins/datasource/cloudwatch/dataquery.cue
Normal file
@ -0,0 +1,172 @@
|
||||
// Copyright 2023 Grafana Labs
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License")
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package grafanaplugin
|
||||
|
||||
import (
|
||||
common "github.com/grafana/grafana/packages/grafana-schema/src/common"
|
||||
"github.com/grafana/grafana/pkg/plugins/pfs"
|
||||
)
|
||||
|
||||
// This file (with its sibling .cue files) implements pfs.GrafanaPlugin
|
||||
pfs.GrafanaPlugin
|
||||
|
||||
composableKinds: DataQuery: {
|
||||
maturity: "merged"
|
||||
|
||||
lineage: {
|
||||
seqs: [
|
||||
{
|
||||
schemas: [
|
||||
{
|
||||
#MetricStat: {
|
||||
region: string
|
||||
namespace: string
|
||||
metricName?: string
|
||||
dimensions?: #Dimensions
|
||||
matchExact?: bool
|
||||
period?: string
|
||||
accountId?: string
|
||||
statistic?: string
|
||||
// @deprecated use statistic
|
||||
statistics?: [...string]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#Dimensions: {[string]: string | [...string]} @cuetsy(kind="type")
|
||||
|
||||
#CloudWatchMetricsQuery: {
|
||||
// TODO extend common.DataQuery when the issues with redundant fields is fixed
|
||||
// common.DataQuery
|
||||
#MetricStat
|
||||
queryMode?: #CloudWatchQueryMode
|
||||
metricQueryType?: #MetricQueryType
|
||||
metricEditorMode?: #MetricEditorMode
|
||||
// common props
|
||||
id: string
|
||||
|
||||
alias?: string
|
||||
label?: string
|
||||
|
||||
// Math expression query
|
||||
expression?: string
|
||||
|
||||
sqlExpression?: string
|
||||
sql?: #SQLExpression
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#CloudWatchQueryMode: "Metrics" | "Logs" | "Annotations" @cuetsy(kind="type")
|
||||
#MetricQueryType: 0 | 1 @cuetsy(kind="enum", memberNames="Search|Query")
|
||||
#MetricEditorMode: 0 | 1 @cuetsy(kind="enum", memberNames="Builder|Code")
|
||||
#SQLExpression: {
|
||||
select?: #QueryEditorFunctionExpression
|
||||
from?: #QueryEditorPropertyExpression | #QueryEditorFunctionExpression
|
||||
where?: #QueryEditorArrayExpression
|
||||
groupBy?: #QueryEditorArrayExpression
|
||||
orderBy?: #QueryEditorFunctionExpression
|
||||
orderByDirection?: string
|
||||
limit?: int64
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorFunctionExpression: {
|
||||
type: #QueryEditorExpressionType & "function"
|
||||
name?: string
|
||||
parameters?: [...#QueryEditorFunctionParameterExpression]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorExpressionType: "property" | "operator" | "or" | "and" | "groupBy" | "function" | "functionParameter" @cuetsy(kind="enum")
|
||||
|
||||
#QueryEditorFunctionParameterExpression: {
|
||||
type: #QueryEditorExpressionType & "functionParameter"
|
||||
name?: string
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorPropertyExpression: {
|
||||
type: #QueryEditorExpressionType & "property"
|
||||
property: #QueryEditorProperty
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorGroupByExpression: {
|
||||
type: #QueryEditorExpressionType & "groupBy"
|
||||
property: #QueryEditorProperty
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorOperatorExpression: {
|
||||
type: #QueryEditorExpressionType & "operator"
|
||||
property: #QueryEditorProperty
|
||||
// TODO QueryEditorOperator<QueryEditorOperatorValueType>, extend in veneer
|
||||
operator: #QueryEditorOperator
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// TODO <T extends QueryEditorOperatorValueType>, extend in veneer
|
||||
#QueryEditorOperator: {
|
||||
name?: string
|
||||
value?: #QueryEditorOperatorType | [...#QueryEditorOperatorType]
|
||||
}
|
||||
|
||||
#QueryEditorOperatorValueType: #QueryEditorOperatorType | [...#QueryEditorOperatorType] @cuetsy(kind="type")
|
||||
#QueryEditorOperatorType: string | bool | int64 @cuetsy(kind="type")
|
||||
|
||||
#QueryEditorProperty: {
|
||||
type: #QueryEditorPropertyType
|
||||
name?: string
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#QueryEditorPropertyType: "string" | "test" @cuetsy(kind="enum")
|
||||
|
||||
#QueryEditorArrayExpression: {
|
||||
// TODO this doesn't work
|
||||
type: (#QueryEditorExpressionType & "and") | (#QueryEditorExpressionType & "or")
|
||||
// TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
expressions: _ // TODO modify this in veneer
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#CloudWatchLogsQuery: {
|
||||
common.DataQuery
|
||||
queryMode: #CloudWatchQueryMode
|
||||
id: string
|
||||
region: string
|
||||
expression?: string
|
||||
statsGroups?: [...string]
|
||||
logGroups?: [...#LogGroup]
|
||||
// deprecated, use logGroups instead
|
||||
logGroupNames?: [...string]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#LogGroup: {
|
||||
arn: string
|
||||
name: string
|
||||
accountId?: string
|
||||
accountLabel?: string
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
#CloudWatchQueryMode: "Metrics" | "Logs" | "Annotations" @cuetsy(kind="type")
|
||||
|
||||
#CloudWatchAnnotationQuery: {
|
||||
// TODO extend common.DataQuery when the issues with redundant fields is fixed
|
||||
//common.DataQuery
|
||||
#MetricStat
|
||||
queryMode: #CloudWatchQueryMode
|
||||
prefixMatching?: bool
|
||||
actionPrefix?: string
|
||||
alarmNamePrefix?: string
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// TODO this doesn't work. Also the type is CloudWatchDefaultQuery = Omit<CloudWatchLogsQuery, 'queryMode'> & CloudWatchMetricsQuery;
|
||||
// #CloudWatchDefaultQuery: #CloudWatchLogsQuery & #CloudWatchMetricsQuery @cuetsy(kind="type")
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
181
public/app/plugins/datasource/cloudwatch/dataquery.gen.ts
Normal file
181
public/app/plugins/datasource/cloudwatch/dataquery.gen.ts
Normal file
@ -0,0 +1,181 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// public/app/plugins/gen.go
|
||||
// Using jennies:
|
||||
// TSTypesJenny
|
||||
// PluginTSTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
import * as common from '@grafana/schema';
|
||||
|
||||
export const DataQueryModelVersion = Object.freeze([0, 0]);
|
||||
|
||||
export interface MetricStat {
|
||||
accountId?: string;
|
||||
dimensions?: Dimensions;
|
||||
matchExact?: boolean;
|
||||
metricName?: string;
|
||||
namespace: string;
|
||||
period?: string;
|
||||
region: string;
|
||||
statistic?: string;
|
||||
/**
|
||||
* @deprecated use statistic
|
||||
*/
|
||||
statistics?: Array<string>;
|
||||
}
|
||||
|
||||
export const defaultMetricStat: Partial<MetricStat> = {
|
||||
statistics: [],
|
||||
};
|
||||
|
||||
export type Dimensions = Record<string, (string | Array<string>)>;
|
||||
|
||||
export interface CloudWatchMetricsQuery extends MetricStat {
|
||||
alias?: string;
|
||||
/**
|
||||
* Math expression query
|
||||
*/
|
||||
expression?: string;
|
||||
/**
|
||||
* common props
|
||||
*/
|
||||
id: string;
|
||||
label?: string;
|
||||
metricEditorMode?: MetricEditorMode;
|
||||
metricQueryType?: MetricQueryType;
|
||||
queryMode?: CloudWatchQueryMode;
|
||||
sql?: SQLExpression;
|
||||
sqlExpression?: string;
|
||||
}
|
||||
|
||||
export type CloudWatchQueryMode = ('Metrics' | 'Logs' | 'Annotations');
|
||||
|
||||
export enum MetricQueryType {
|
||||
Query = 1,
|
||||
Search = 0,
|
||||
}
|
||||
|
||||
export enum MetricEditorMode {
|
||||
Builder = 0,
|
||||
Code = 1,
|
||||
}
|
||||
|
||||
export interface SQLExpression {
|
||||
from?: (QueryEditorPropertyExpression | QueryEditorFunctionExpression);
|
||||
groupBy?: QueryEditorArrayExpression;
|
||||
limit?: number;
|
||||
orderBy?: QueryEditorFunctionExpression;
|
||||
orderByDirection?: string;
|
||||
select?: QueryEditorFunctionExpression;
|
||||
where?: QueryEditorArrayExpression;
|
||||
}
|
||||
|
||||
export interface QueryEditorFunctionExpression {
|
||||
name?: string;
|
||||
parameters?: Array<QueryEditorFunctionParameterExpression>;
|
||||
type: QueryEditorExpressionType.Function;
|
||||
}
|
||||
|
||||
export const defaultQueryEditorFunctionExpression: Partial<QueryEditorFunctionExpression> = {
|
||||
parameters: [],
|
||||
};
|
||||
|
||||
export enum QueryEditorExpressionType {
|
||||
And = 'and',
|
||||
Function = 'function',
|
||||
FunctionParameter = 'functionParameter',
|
||||
GroupBy = 'groupBy',
|
||||
Operator = 'operator',
|
||||
Or = 'or',
|
||||
Property = 'property',
|
||||
}
|
||||
|
||||
export interface QueryEditorFunctionParameterExpression {
|
||||
name?: string;
|
||||
type: QueryEditorExpressionType.FunctionParameter;
|
||||
}
|
||||
|
||||
export interface QueryEditorPropertyExpression {
|
||||
property: QueryEditorProperty;
|
||||
type: QueryEditorExpressionType.Property;
|
||||
}
|
||||
|
||||
export interface QueryEditorGroupByExpression {
|
||||
property: QueryEditorProperty;
|
||||
type: QueryEditorExpressionType.GroupBy;
|
||||
}
|
||||
|
||||
export interface QueryEditorOperatorExpression {
|
||||
/**
|
||||
* TODO QueryEditorOperator<QueryEditorOperatorValueType>, extend in veneer
|
||||
*/
|
||||
operator: {
|
||||
name?: string;
|
||||
value?: (QueryEditorOperatorType | Array<QueryEditorOperatorType>);
|
||||
};
|
||||
property: QueryEditorProperty;
|
||||
type: QueryEditorExpressionType.Operator;
|
||||
}
|
||||
|
||||
export type QueryEditorOperatorValueType = (QueryEditorOperatorType | Array<QueryEditorOperatorType>);
|
||||
|
||||
export type QueryEditorOperatorType = (string | boolean | number);
|
||||
|
||||
export interface QueryEditorProperty {
|
||||
name?: string;
|
||||
type: QueryEditorPropertyType;
|
||||
}
|
||||
|
||||
export enum QueryEditorPropertyType {
|
||||
String = 'string',
|
||||
Test = 'test',
|
||||
}
|
||||
|
||||
export interface QueryEditorArrayExpression {
|
||||
/**
|
||||
* TODO should be QueryEditorExpression[] | QueryEditorArrayExpression[], extend in veneer
|
||||
*/
|
||||
expressions: unknown;
|
||||
/**
|
||||
* TODO this doesn't work
|
||||
*/
|
||||
type: QueryEditorExpressionType;
|
||||
}
|
||||
|
||||
export interface CloudWatchLogsQuery extends common.DataQuery {
|
||||
expression?: string;
|
||||
id: string;
|
||||
/**
|
||||
* deprecated, use logGroups instead
|
||||
*/
|
||||
logGroupNames?: Array<string>;
|
||||
logGroups?: Array<LogGroup>;
|
||||
queryMode: CloudWatchQueryMode;
|
||||
region: string;
|
||||
statsGroups?: Array<string>;
|
||||
}
|
||||
|
||||
export const defaultCloudWatchLogsQuery: Partial<CloudWatchLogsQuery> = {
|
||||
logGroupNames: [],
|
||||
logGroups: [],
|
||||
statsGroups: [],
|
||||
};
|
||||
|
||||
export interface LogGroup {
|
||||
accountId?: string;
|
||||
accountLabel?: string;
|
||||
arn: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CloudWatchAnnotationQuery extends MetricStat {
|
||||
actionPrefix?: string;
|
||||
alarmNamePrefix?: string;
|
||||
prefixMatching?: boolean;
|
||||
queryMode: CloudWatchQueryMode;
|
||||
}
|
||||
|
||||
export interface CloudWatch {}
|
Loading…
Reference in New Issue
Block a user