2024-02-01 02:36:51 +08:00
|
|
|
package v0alpha1
|
|
|
|
|
|
|
|
import (
|
2025-08-29 22:46:39 +08:00
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
2024-02-01 02:36:51 +08:00
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
|
|
|
2024-08-05 20:38:12 +08:00
|
|
|
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
2024-02-01 02:36:51 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
GROUP = "query.grafana.app"
|
|
|
|
VERSION = "v0alpha1"
|
|
|
|
APIVERSION = GROUP + "/" + VERSION
|
|
|
|
)
|
|
|
|
|
2025-08-29 22:46:39 +08:00
|
|
|
var ConnectionResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
|
|
|
|
"connections", "connection", "DataSourceConnection",
|
|
|
|
func() runtime.Object { return &DataSourceConnection{} },
|
|
|
|
func() runtime.Object { return &DataSourceConnectionList{} },
|
|
|
|
utils.TableColumns{
|
|
|
|
Definition: []metav1.TableColumnDefinition{
|
|
|
|
{Name: "Name", Type: "string", Format: "name"},
|
|
|
|
{Name: "Title", Type: "string", Format: "string", Description: "The datasource title"},
|
|
|
|
{Name: "APIVersion", Type: "string", Format: "string", Description: "API Version"},
|
|
|
|
{Name: "Created At", Type: "date"},
|
|
|
|
},
|
|
|
|
Reader: func(obj any) ([]interface{}, error) {
|
|
|
|
m, ok := obj.(*DataSourceConnection)
|
|
|
|
if !ok {
|
|
|
|
return nil, fmt.Errorf("expected connection")
|
|
|
|
}
|
|
|
|
return []interface{}{
|
|
|
|
m.Name,
|
|
|
|
m.Title,
|
|
|
|
m.APIVersion,
|
|
|
|
m.CreationTimestamp.UTC().Format(time.RFC3339),
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2024-09-04 19:53:14 +08:00
|
|
|
var DataSourceApiServerResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
|
2024-02-01 02:36:51 +08:00
|
|
|
"datasourceapiservers", "datasourceapiserver", "DataSourceApiServer",
|
|
|
|
func() runtime.Object { return &DataSourceApiServer{} },
|
|
|
|
func() runtime.Object { return &DataSourceApiServerList{} },
|
2024-08-05 20:38:12 +08:00
|
|
|
utils.TableColumns{}, // default table converter
|
2024-02-01 02:36:51 +08:00
|
|
|
)
|
|
|
|
|
2024-09-04 19:53:14 +08:00
|
|
|
var QueryTypeDefinitionResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
|
2024-03-09 00:12:59 +08:00
|
|
|
"querytypes", "querytype", "QueryTypeDefinition",
|
|
|
|
func() runtime.Object { return &QueryTypeDefinition{} },
|
|
|
|
func() runtime.Object { return &QueryTypeDefinitionList{} },
|
2024-08-05 20:38:12 +08:00
|
|
|
utils.TableColumns{}, // default table converter
|
2024-03-09 00:12:59 +08:00
|
|
|
)
|
|
|
|
|
2024-02-01 02:36:51 +08:00
|
|
|
var (
|
|
|
|
// SchemeGroupVersion is group version used to register these objects
|
|
|
|
SchemeGroupVersion = schema.GroupVersion{Group: GROUP, Version: VERSION}
|
|
|
|
)
|