Correlations: Add legacy storage (#112038)
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationCorrelationType string
|
||||
|
||||
const (
|
||||
CorrelationCorrelationTypeQuery CorrelationCorrelationType = "query"
|
||||
CorrelationCorrelationTypeExternal CorrelationCorrelationType = "external"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationDataSourceRef struct {
|
||||
// same as pluginId
|
||||
@@ -33,10 +41,10 @@ type CorrelationTargetSpec map[string]interface{}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationTransformationSpec struct {
|
||||
Type string `json:"type"`
|
||||
Expression string `json:"expression"`
|
||||
Field string `json:"field"`
|
||||
MapValue string `json:"mapValue"`
|
||||
Type CorrelationTransformationSpecType `json:"type"`
|
||||
Expression string `json:"expression"`
|
||||
Field string `json:"field"`
|
||||
MapValue string `json:"mapValue"`
|
||||
}
|
||||
|
||||
// NewCorrelationTransformationSpec creates a new CorrelationTransformationSpec object.
|
||||
@@ -44,29 +52,28 @@ func NewCorrelationTransformationSpec() *CorrelationTransformationSpec {
|
||||
return &CorrelationTransformationSpec{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationCorrelationType string
|
||||
|
||||
const (
|
||||
CorrelationCorrelationTypeQuery CorrelationCorrelationType = "query"
|
||||
CorrelationCorrelationTypeExternal CorrelationCorrelationType = "external"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationSpec struct {
|
||||
SourceDsRef CorrelationDataSourceRef `json:"source_ds_ref"`
|
||||
TargetDsRef *CorrelationDataSourceRef `json:"target_ds_ref,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Config CorrelationConfigSpec `json:"config"`
|
||||
Provisioned bool `json:"provisioned"`
|
||||
Type CorrelationCorrelationType `json:"type"`
|
||||
Source CorrelationDataSourceRef `json:"source"`
|
||||
Target *CorrelationDataSourceRef `json:"target,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Config CorrelationConfigSpec `json:"config"`
|
||||
}
|
||||
|
||||
// NewCorrelationSpec creates a new CorrelationSpec object.
|
||||
func NewCorrelationSpec() *CorrelationSpec {
|
||||
return &CorrelationSpec{
|
||||
SourceDsRef: *NewCorrelationDataSourceRef(),
|
||||
Config: *NewCorrelationConfigSpec(),
|
||||
Source: *NewCorrelationDataSourceRef(),
|
||||
Config: *NewCorrelationConfigSpec(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type CorrelationTransformationSpecType string
|
||||
|
||||
const (
|
||||
CorrelationTransformationSpecTypeRegex CorrelationTransformationSpecType = "regex"
|
||||
CorrelationTransformationSpecTypeLogfmt CorrelationTransformationSpecType = "logfmt"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rawSchemaCorrelationv0alpha1 = []byte(`{"ConfigSpec":{"additionalProperties":false,"description":"there was a deprecated field here called type, we will need to move that for conversion and provisioning","properties":{"field":{"type":"string"},"target":{"$ref":"#/components/schemas/TargetSpec"},"transformations":{"items":{"$ref":"#/components/schemas/TransformationSpec"},"type":"array"}},"required":["field","target"],"type":"object"},"Correlation":{"properties":{"spec":{"$ref":"#/components/schemas/spec"}},"required":["spec"]},"CorrelationType":{"enum":["query","external"],"type":"string"},"DataSourceRef":{"additionalProperties":false,"properties":{"group":{"description":"same as pluginId","type":"string"},"name":{"description":"same as grafana uid","type":"string"}},"required":["group","name"],"type":"object"},"TargetSpec":{"additionalProperties":{"additionalProperties":{},"type":"object"},"type":"object"},"TransformationSpec":{"additionalProperties":false,"properties":{"expression":{"type":"string"},"field":{"type":"string"},"mapValue":{"type":"string"},"type":{"type":"string"}},"required":["type","expression","field","mapValue"],"type":"object"},"spec":{"additionalProperties":false,"properties":{"config":{"$ref":"#/components/schemas/ConfigSpec"},"description":{"type":"string"},"label":{"type":"string"},"provisioned":{"type":"boolean"},"source_ds_ref":{"$ref":"#/components/schemas/DataSourceRef"},"target_ds_ref":{"$ref":"#/components/schemas/DataSourceRef"},"type":{"$ref":"#/components/schemas/CorrelationType"}},"required":["source_ds_ref","label","config","provisioned","type"],"type":"object"}}`)
|
||||
rawSchemaCorrelationv0alpha1 = []byte(`{"ConfigSpec":{"additionalProperties":false,"description":"there was a deprecated field here called type, we will need to move that for conversion and provisioning","properties":{"field":{"type":"string"},"target":{"$ref":"#/components/schemas/TargetSpec"},"transformations":{"items":{"$ref":"#/components/schemas/TransformationSpec"},"type":"array"}},"required":["field","target"],"type":"object"},"Correlation":{"properties":{"spec":{"$ref":"#/components/schemas/spec"}},"required":["spec"]},"CorrelationType":{"enum":["query","external"],"type":"string"},"DataSourceRef":{"additionalProperties":false,"properties":{"group":{"description":"same as pluginId","type":"string"},"name":{"description":"same as grafana uid","type":"string"}},"required":["group","name"],"type":"object"},"TargetSpec":{"additionalProperties":{"additionalProperties":{},"type":"object"},"type":"object"},"TransformationSpec":{"additionalProperties":false,"properties":{"expression":{"type":"string"},"field":{"type":"string"},"mapValue":{"type":"string"},"type":{"enum":["regex","logfmt"],"type":"string"}},"required":["type","expression","field","mapValue"],"type":"object"},"spec":{"additionalProperties":false,"properties":{"config":{"$ref":"#/components/schemas/ConfigSpec"},"description":{"type":"string"},"label":{"type":"string"},"source":{"$ref":"#/components/schemas/DataSourceRef"},"target":{"$ref":"#/components/schemas/DataSourceRef"},"type":{"$ref":"#/components/schemas/CorrelationType"}},"required":["type","source","label","config"],"type":"object"}}`)
|
||||
versionSchemaCorrelationv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaCorrelationv0alpha1, &versionSchemaCorrelationv0alpha1)
|
||||
)
|
||||
@@ -40,6 +40,9 @@ var appManifestData = app.ManifestData{
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Schema: &versionSchemaCorrelationv0alpha1,
|
||||
SelectableFields: []string{
|
||||
"spec.datasource.name",
|
||||
},
|
||||
},
|
||||
},
|
||||
Routes: app.ManifestVersionRoutes{
|
||||
|
||||
Reference in New Issue
Block a user