MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / clientForNode

Method clientForNode

internal/cli/cli_helpers.go:92–108  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

90// In single mode it returns the single client; in group mode it resolves via
91// FindNodeByNameInGroup.
92func (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.

Callers 13

runStorageListFunction · 0.80
runStorageShowFunction · 0.80
runStorageContentListFunction · 0.80
runStorageContentDeleteFunction · 0.80
runStorageDownloadURLFunction · 0.80
runStorageDownloadOCIFunction · 0.80
runStorageRestoreFunction · 0.80
completeStorageNamesFunction · 0.80
completeTemplateNamesFunction · 0.80
runGuestsCreateVMFunction · 0.80

Calls 2

FindNodeByNameInGroupMethod · 0.80
GetClientMethod · 0.80

Tested by

no test coverage detected