diff --git a/pkg/grizzly/workflow.go b/pkg/grizzly/workflow.go index 8e531be6..85ef4c34 100644 --- a/pkg/grizzly/workflow.go +++ b/pkg/grizzly/workflow.go @@ -73,10 +73,19 @@ func List(registry Registry, resources Resources, format string) error { if err != nil { return err } + + uid := resource.Name() + // Some resources need a custom logic to build their UID (ex: SyntheticMonitoringCheck) + // TODO: we shouldn't need a special case to get a resource's UID. + handlerUID, err := handler.GetUID(resource) + if err == nil { + uid = handlerUID + } + listedResources = append(listedResources, listedResource{ Handler: handler.APIVersion(), Kind: handler.Kind(), - Name: resource.Name(), + Name: uid, Path: resource.Source.Path, Location: resource.Source.Location, Format: resource.Source.Format, diff --git a/pkg/syntheticmonitoring/synthetic-monitoring-handler.go b/pkg/syntheticmonitoring/synthetic-monitoring-handler.go index 1996ca21..b5aab590 100644 --- a/pkg/syntheticmonitoring/synthetic-monitoring-handler.go +++ b/pkg/syntheticmonitoring/synthetic-monitoring-handler.go @@ -91,6 +91,7 @@ func (h *SyntheticMonitoringHandler) GetUID(resource grizzly.Resource) (string, } return fmt.Sprintf("%s.%s", resource.GetMetadata("type"), resource.Name()), nil } + func (h *SyntheticMonitoringHandler) GetSpecUID(resource grizzly.Resource) (string, error) { return "", fmt.Errorf("GetSpecUID not implemented for Synthetic Monitoring") }