(cli *client, options *CreateOptions)
| 177 | } |
| 178 | |
| 179 | func 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 | |
| 200 | func init() { |
| 201 | CreateCommand.Flags().StringVarP(&createOptions.namespace, "namespace", "n", "", "The namespace") |
no test coverage detected