EntityAPI: Rename references from kind to family (#62044)

This commit is contained in:
Ryan McKinley
2023-01-25 23:42:04 +00:00
committed by GitHub
parent f3aa058886
commit 46c828c2d8
16 changed files with 256 additions and 250 deletions
+10 -5
View File
@@ -117,14 +117,19 @@ type EntitySummary struct {
// This message is derived from the object body and can be used to search for references.
// This does not represent a method to declare a reference to another object.
type EntityExternalReference struct {
// datasource (instance), dashboard (instance),
Kind string `json:"kind,omitempty"`
// Category of dependency
// eg: datasource, plugin, runtime
Family string `json:"family,omitempty"`
// prometheus / heatmap, heatamp|prometheus
// datasource > prometheus|influx|...
// plugin > panel | datasource
// runtime > transformer
Type string `json:"type,omitempty"` // flavor
// Unique ID for this object
UID string `json:"UID,omitempty"`
// datasource > UID
// plugin > plugin identifier
// runtime > name lookup
Identifier string `json:"ID,omitempty"`
}
// EntitySummaryBuilder will read an object, validate it, and return a summary, sanitized payload, or an error
@@ -532,10 +532,10 @@ func (s *sqlEntityServer) writeSearchInfo(
return err
}
_, err = tx.Exec(ctx, `INSERT INTO entity_ref (`+
"grn, parent_grn, kind, type, uid, "+
"grn, parent_grn, family, type, id, "+
"resolved_ok, resolved_to, resolved_warning, resolved_time) "+
`VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
grn, parent_grn, ref.Kind, ref.Type, ref.UID,
grn, parent_grn, ref.Family, ref.Type, ref.Identifier,
resolved.OK, resolved.Key, resolved.Warning, resolved.Timestamp,
)
if err != nil {