(ctx context.Context, objs ...client.Object)
| 51 | } |
| 52 | |
| 53 | func (c Client) GetObjectsStatus(ctx context.Context, objs ...client.Object) Status { |
| 54 | var rss []ResourceStatus |
| 55 | for _, obj := range objs { |
| 56 | gvk := obj.GetObjectKind().GroupVersionKind() |
| 57 | nn := types.NamespacedName{ |
| 58 | Namespace: obj.GetNamespace(), |
| 59 | Name: obj.GetName(), |
| 60 | } |
| 61 | rs := ResourceStatus{ |
| 62 | NamespacedName: nn, |
| 63 | GVK: gvk, |
| 64 | requestObject: obj, |
| 65 | } |
| 66 | u := unstructured.Unstructured{} |
| 67 | u.SetGroupVersionKind(gvk) |
| 68 | err := c.KubeClient.Get(ctx, nn, &u) |
| 69 | if err != nil { |
| 70 | rs.Error = fmt.Errorf("error getting resource %q with GVK %q: %w", nn, gvk, err) |
| 71 | } |
| 72 | if rs.Error == nil { |
| 73 | rs.Resource = &u |
| 74 | } |
| 75 | rss = append(rss, rs) |
| 76 | } |
| 77 | |
| 78 | return Status{Resources: rss} |
| 79 | } |
| 80 | |
| 81 | // HasInstalledResources only returns true if at least one resource in s |
| 82 | // was returned successfully by the API server. A resource error status |
no test coverage detected