use readme

This commit is contained in:
Ryan McKinley
2025-06-19 17:57:05 +03:00
parent 1bedd399d6
commit 90614fcb91
3 changed files with 36 additions and 21 deletions
+20 -6
View File
@@ -24,14 +24,30 @@ type GenericDataSource struct {
// BasicAuthPassword string `json:"-"`
}
type DsAccess string // proxy | direct
// DsAccess represents how the datasource connects to the remote service
// +enum
type DsAccess string
const (
// The frontend can connect directly to the remote URL
// This method is discouraged
DsAccessDirect DsAccess = "direct"
// Connect to the remote datasource through the grafana backend
DsAccessProxy DsAccess = "proxy"
)
func (dsa DsAccess) String() string {
return string(dsa)
}
type GenericDataSourceSpec struct {
// The diplay name (NOTE, this used to be the "name")
// The diplay name (previously saved as the "name" property)
Title string `json:"title"`
// Direct or proxy?
Access DsAccess `json:"access,omitempty"`
Access DsAccess `json:"access,omitempty"`
ReadOnly bool `json:"readOnly,omitempty"`
IsDefault bool `json:"isDefault,omitempty"`
// Server URL
URL string `json:"url,omitempty"`
@@ -41,8 +57,6 @@ type GenericDataSourceSpec struct {
BasicAuth bool `json:"basicAuth,omitempty"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
WithCredentials bool `json:"withCredentials,omitempty"`
IsDefault bool `json:"isDefault,omitempty"`
ReadOnly bool `json:"readOnly,omitempty"`
// Generic unstructured configuration settings
JsonData common.Unstructured `json:"jsonData,omitempty"`
@@ -235,7 +235,7 @@ func schema_pkg_apis_datasource_v0alpha1_GenericDataSourceSpec(ref common.Refere
Properties: map[string]spec.Schema{
"title": {
SchemaProps: spec.SchemaProps{
Description: "The diplay name (NOTE, this used to be the \"name\")",
Description: "The diplay name (previously saved as the \"name\" property)",
Default: "",
Type: []string{"string"},
Format: "",
@@ -243,9 +243,22 @@ func schema_pkg_apis_datasource_v0alpha1_GenericDataSourceSpec(ref common.Refere
},
"access": {
SchemaProps: spec.SchemaProps{
Description: "Direct or proxy?",
Description: "Possible enum values:\n - `\"direct\"` The frontend can connect directly to the remote URL This method is discouraged\n - `\"proxy\"` Connect to the remote datasource through the grafana backend",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"direct", "proxy"},
},
},
"readOnly": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
"isDefault": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
"url": {
@@ -285,18 +298,6 @@ func schema_pkg_apis_datasource_v0alpha1_GenericDataSourceSpec(ref common.Refere
Format: "",
},
},
"isDefault": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
"readOnly": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
"jsonData": {
SchemaProps: spec.SchemaProps{
Description: "Generic unstructured configuration settings",
+1 -1
View File
@@ -122,7 +122,7 @@ func NewDataSourceAPIBuilder(
builder := &DataSourceAPIBuilder{
connectionResourceInfo: datasource.GenericConnectionResourceInfo.WithGroupAndShortName(group, plugin.ID+"-connection"),
datasourceResourceInfo: datasource.GenericDataSourceResourceInfo.WithGroupAndShortName(group, plugin.ID+"-config"),
datasourceResourceInfo: datasource.GenericDataSourceResourceInfo.WithGroupAndShortName(group, plugin.ID),
pluginJSON: plugin,
client: client,
datasources: datasources,