MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / ListRuntimes

Method ListRuntimes

pkg/controller/client/rpc.go:109–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109func (c *ControllerClient) ListRuntimes() ([]*rtctrl.RuntimeInfo, error) {
110 rts := make([]*rtctrl.RuntimeInfo, 0)
111 req := fasthttp.AcquireRequest()
112 p := fmt.Sprintf("%s://%s/%s/runtimes", c.scheme, c.host, c.version)
113 req.SetRequestURI(p)
114
115 req.Header.SetHost(c.host)
116 req.Header.SetMethod("GET")
117 req.Header.SetContentType("application/json")
118 resp, err := c.client.Do(req)
119 if err != nil {
120 logs.Errorf("unexpected minikun client error: %s", err)
121 // TODO: handler unexpected error
122 return nil, err
123 }
124 err = json.Unmarshal(resp.Body(), &rts)
125 if err != nil {
126 logs.Errorf("json unmarshal err :%v", err)
127 return nil, err
128 }
129 return rts, nil
130}

Callers

nothing calls this directly

Calls 4

ErrorfFunction · 0.92
SetHostMethod · 0.80
DoMethod · 0.65
BodyMethod · 0.45

Tested by

no test coverage detected