Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Created February 7, 2022 13:28
Show Gist options
  • Save kylebrandt/793bb8637c26f88ed4d3756bccfad3f3 to your computer and use it in GitHub Desktop.
Save kylebrandt/793bb8637c26f88ed4d3756bccfad3f3 to your computer and use it in GitHub Desktop.
Intent API Collab Session 2022_02_04 diff
diff --git a/internal/components/datasource/schema.go b/internal/components/datasource/schema.go
index 98a29197ec..d75330be5c 100644
--- a/internal/components/datasource/schema.go
+++ b/internal/components/datasource/schema.go
@@ -82,6 +82,29 @@ func newDataSourceJSONKernel(lin thema.Lineage) kernel.InputKernel {
return jdk
}
+// TODO:
+// What is the schema (constraints) on []DataSource
+// What are the subsets of of all []Datasource that have constraints (e.g. unique names within an org)
+// How is this expressed in Thema/cue?
+
+// Analog of runtime.Object
+type DatasourceGrafanaObject struct {
+ Metadata GrafanaObjectMetadata
+ SystemMeta GrafanaObjectSystemMetadata
+ Spec DataSource
+}
+
+//Writable by clients
+type GrafanaObjectMetadata struct {
+ Name string
+}
+
+// Writable only by system
+type GrafanaObjectSystemMetadata struct {
+ UID string
+ TenantID int
+}
+
type DataSource struct {
// Omitting these two at least for now, because sequential IDs == :(
// Id int64 `json:"id"`
@@ -104,8 +127,8 @@ type DataSource struct {
// JsonData *simplejson.Json `json:"jsonData,omitempty"`
JsonData map[string]interface{} `json:"jsonData,omitempty"`
SecureJsonFields map[string]bool `json:"secureJsonFields,omitempty"`
- Version int `json:"version"`
- ReadOnly bool `json:"readOnly"`
+ // Version int `json:"version"`
+ // ReadOnly bool `json:"readOnly"`
// AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"`
AccessControl map[string]bool `json:"accessControl,omitempty"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment