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

Function createNodes

cmd/client/command/create.go:179–198  ·  view source on GitHub ↗
(cli *client, options *CreateOptions)

Source from the content-addressed store, hash-verified

177}
178
179func createNodes(cli *client, options *CreateOptions) error {
180 rsp, err := cli.restyCli.R().
181 SetPathParam("namespace", options.namespace).
182 SetPathParam("cluster", options.cluster).
183 SetPathParam("shard", strconv.Itoa(options.shard)).
184 SetBody(map[string]interface{}{
185 "addr": options.nodes[0],
186 "password": options.password,
187 }).
188 Post("/namespaces/{namespace}/clusters/{cluster}/shards/{shard}/nodes")
189 if err != nil {
190 return err
191 }
192
193 if rsp.IsError() {
194 return unmarshalError(rsp.Body())
195 }
196 printLine("create node: %v successfully.", options.nodes[0])
197 return nil
198}
199
200func init() {
201 CreateCommand.Flags().StringVarP(&createOptions.namespace, "namespace", "n", "", "The namespace")

Callers 1

create.goFile · 0.85

Calls 2

unmarshalErrorFunction · 0.85
printLineFunction · 0.85

Tested by

no test coverage detected