clientForNode returns the API client for the cluster that hosts nodeName. In single mode it returns the single client; in group mode it resolves via FindNodeByNameInGroup.
(ctx context.Context, nodeName string)
| 90 | // In single mode it returns the single client; in group mode it resolves via |
| 91 | // FindNodeByNameInGroup. |
| 92 | func (s *cliSession) clientForNode(ctx context.Context, nodeName string) (*api.Client, error) { |
| 93 | if s.group != nil { |
| 94 | _, profileName, err := s.group.FindNodeByNameInGroup(ctx, nodeName) |
| 95 | if err != nil { |
| 96 | return nil, err |
| 97 | } |
| 98 | |
| 99 | pc, exists := s.group.GetClient(profileName) |
| 100 | if !exists || pc == nil { |
| 101 | return nil, fmt.Errorf("no client for profile %q", profileName) |
| 102 | } |
| 103 | |
| 104 | return pc.Client, nil |
| 105 | } |
| 106 | |
| 107 | return s.single, nil |
| 108 | } |
| 109 | |
| 110 | // clearNodeInventoryCache invalidates API cache entries that affect guest |
| 111 | // inventory for operations performed outside the Proxmox API client. |
no test coverage detected