MCPcopy Index your code
hub / github.com/docker/cli / nodeNames

Function nodeNames

cli/command/system/completion.go:227–237  ·  view source on GitHub ↗

nodeNames contacts the API to get a list of node names. In case of an error, an empty list is returned.

(dockerCLI completion.APIClientProvider, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

225// nodeNames contacts the API to get a list of node names.
226// In case of an error, an empty list is returned.
227func nodeNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string {
228 res, err := dockerCLI.Client().NodeList(cmd.Context(), client.NodeListOptions{})
229 if err != nil {
230 return []string{}
231 }
232 names := make([]string, 0, len(res.Items))
233 for _, node := range res.Items {
234 names = append(names, node.Description.Hostname)
235 }
236 return names
237}
238
239// pluginNames contacts the API to get a list of plugin names.
240// In case of an error, an empty list is returned.

Callers 2

completeEventFiltersFunction · 0.85
completeObjectNamesFunction · 0.85

Calls 2

ClientMethod · 0.65
NodeListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…