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

Function getCluster

cmd/client/command/get.go:77–97  ·  view source on GitHub ↗
(client *client, options *GetOptions)

Source from the content-addressed store, hash-verified

75}
76
77func getCluster(client *client, options *GetOptions) error {
78 rsp, err := client.restyCli.R().SetPathParams(map[string]string{
79 "namespace": options.namespace,
80 "cluster": options.cluster,
81 }).Get("/namespaces/{namespace}/clusters/{cluster}")
82 if err != nil {
83 return err
84 }
85 if rsp.IsError() {
86 return unmarshalError(rsp.Body())
87 }
88
89 var result struct {
90 Cluster *store.Cluster `json:"cluster"`
91 }
92 if err := unmarshalData(rsp.Body(), &result); err != nil {
93 return err
94 }
95 printCluster(result.Cluster)
96 return nil
97}
98
99func init() {
100 GetCommand.Flags().StringVarP(&getOptions.namespace, "namespace", "n", "", "The namespace of the resource")

Callers 1

get.goFile · 0.85

Calls 4

unmarshalErrorFunction · 0.85
unmarshalDataFunction · 0.85
printClusterFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected