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
+3 -3
View File
@@ -51,7 +51,7 @@ func (r *standardReferenceResolver) Resolve(ctx context.Context, ref *entity.Ent
return ResolutionInfo{OK: false, Timestamp: getNow()}, fmt.Errorf("ref is nil")
}
switch ref.Kind {
switch ref.Family {
case entity.StandardKindDataSource:
return r.resolveDatasource(ctx, ref)
@@ -74,7 +74,7 @@ func (r *standardReferenceResolver) Resolve(ctx context.Context, ref *entity.Ent
}
func (r *standardReferenceResolver) resolveDatasource(ctx context.Context, ref *entity.EntityExternalReference) (ResolutionInfo, error) {
ds, err := r.ds.getDS(ctx, ref.UID)
ds, err := r.ds.getDS(ctx, ref.Identifier)
if err != nil || ds == nil || ds.UID == "" {
return ResolutionInfo{
OK: false,
@@ -100,7 +100,7 @@ func (r *standardReferenceResolver) resolveDatasource(ctx context.Context, ref *
}
func (r *standardReferenceResolver) resolvePlugin(ctx context.Context, ref *entity.EntityExternalReference) (ResolutionInfo, error) {
p, ok := r.pluginStore.Plugin(ctx, ref.UID)
p, ok := r.pluginStore.Plugin(ctx, ref.Identifier)
if !ok {
return ResolutionInfo{
OK: false,
+10 -10
View File
@@ -58,8 +58,8 @@ func TestResolver(t *testing.T) {
{
name: "Missing datasource without type",
given: &entity.EntityExternalReference{
Kind: entity.StandardKindDataSource,
UID: "xyz",
Family: entity.StandardKindDataSource,
Identifier: "xyz",
},
expect: ResolutionInfo{OK: false},
ctx: ctxOrg1,
@@ -67,9 +67,9 @@ func TestResolver(t *testing.T) {
{
name: "OK datasource",
given: &entity.EntityExternalReference{
Kind: entity.StandardKindDataSource,
Type: "influx",
UID: "influx-uid",
Family: entity.StandardKindDataSource,
Type: "influx",
Identifier: "influx-uid",
},
expect: ResolutionInfo{OK: true, Key: "influx-uid"},
ctx: ctxOrg1,
@@ -77,7 +77,7 @@ func TestResolver(t *testing.T) {
{
name: "Get the default datasource",
given: &entity.EntityExternalReference{
Kind: entity.StandardKindDataSource,
Family: entity.StandardKindDataSource,
},
expect: ResolutionInfo{
OK: true,
@@ -89,8 +89,8 @@ func TestResolver(t *testing.T) {
{
name: "Get the default datasource (with type)",
given: &entity.EntityExternalReference{
Kind: entity.StandardKindDataSource,
Type: "influx",
Family: entity.StandardKindDataSource,
Type: "influx",
},
expect: ResolutionInfo{
OK: true,
@@ -101,8 +101,8 @@ func TestResolver(t *testing.T) {
{
name: "Lookup by name",
given: &entity.EntityExternalReference{
Kind: entity.StandardKindDataSource,
UID: "Influx2",
Family: entity.StandardKindDataSource,
Identifier: "Influx2",
},
expect: ResolutionInfo{
OK: true,