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

Function importCluster

cmd/client/command/import.go:77–94  ·  view source on GitHub ↗
(client *client, options *ImportOptions)

Source from the content-addressed store, hash-verified

75}
76
77func importCluster(client *client, options *ImportOptions) error {
78 rsp, err := client.restyCli.R().
79 SetPathParam("namespace", options.namespace).
80 SetPathParam("cluster", options.cluster).
81 SetBody(map[string]interface{}{
82 "nodes": options.nodes,
83 "password": options.password,
84 }).
85 Post("/namespaces/{namespace}/clusters/{cluster}/import")
86 if err != nil {
87 return err
88 }
89 if rsp.IsError() {
90 return errors.New(rsp.String())
91 }
92 printLine("import cluster: %s successfully.", options.cluster)
93 return nil
94}
95
96func init() {
97 ImportCommand.Flags().StringVarP(&importOptions.namespace, "namespace", "n", "", "The namespace of the cluster")

Callers 1

import.goFile · 0.70

Calls 2

printLineFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected