MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / listNamespace

Function listNamespace

cmd/client/command/list.go:84–107  ·  view source on GitHub ↗
(cli *client)

Source from the content-addressed store, hash-verified

82}
83
84func listNamespace(cli *client) error {
85 rsp, err := cli.restyCli.R().Get("/namespaces")
86 if err != nil {
87 return err
88 }
89 if rsp.IsError() {
90 return unmarshalError(rsp.Body())
91 }
92
93 var result struct {
94 Namespaces []string `json:"namespaces"`
95 }
96 if err := unmarshalData(rsp.Body(), &result); err != nil {
97 return err
98 }
99 if len(result.Namespaces) == 0 {
100 printLine("no namespace found.")
101 return nil
102 }
103 for _, ns := range result.Namespaces {
104 printLine(ns)
105 }
106 return nil
107}
108
109func listClusters(cli *client) error {
110 rsp, err := cli.restyCli.R().

Callers 1

list.goFile · 0.85

Calls 4

unmarshalErrorFunction · 0.85
unmarshalDataFunction · 0.85
printLineFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected