Skip to content

Commit

Permalink
Fix the UID displayed by grr list for SyntheticMonitoringCheck reso…
Browse files Browse the repository at this point in the history
…urces
  • Loading branch information
K-Phoen committed Nov 8, 2024
1 parent 2740861 commit cad9d1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/grizzly/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions pkg/syntheticmonitoring/synthetic-monitoring-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit cad9d1d

Please sign in to comment.