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

Function createCluster

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

Source from the content-addressed store, hash-verified

135}
136
137func createCluster(cli *client, options *CreateOptions) error {
138 rsp, err := cli.restyCli.R().
139 SetPathParam("namespace", options.namespace).
140 SetBody(map[string]interface{}{
141 "name": options.cluster,
142 "replicas": options.replica,
143 "nodes": options.nodes,
144 "password": options.password,
145 }).
146 Post("/namespaces/{namespace}/clusters")
147 if err != nil {
148 return err
149 }
150
151 if rsp.IsError() {
152 return unmarshalError(rsp.Body())
153 }
154 printLine("create cluster: %s successfully.", options.cluster)
155 return nil
156}
157
158func createShard(cli *client, options *CreateOptions) error {
159 rsp, err := cli.restyCli.R().

Callers 1

create.goFile · 0.70

Calls 2

unmarshalErrorFunction · 0.85
printLineFunction · 0.85

Tested by

no test coverage detected