37 Star 396 Fork 72

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gke_zones_endpoint.go 689 Bytes
一键复制 编辑 原始数据 按行查看 历史
Fyery 提交于 2019-02-12 16:04 . refactor the code duplication
package capabilities
import (
"net/http"
)
// NewGKEZonesHandler creates a new GKEZonesHandler
func NewGKEZonesHandler() *GKEZonesHandler {
return &GKEZonesHandler{}
}
// GKEZonesHandler for listing available GKE zones
type GKEZonesHandler struct {
Field string
}
func (g *GKEZonesHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
body := preCheck(writer, req)
if body == nil {
return
}
client, err := getComputeServiceClient(req.Context(), body.Credentials)
if err != nil {
writer.WriteHeader(http.StatusInternalServerError)
handleErr(writer, err)
return
}
result, err := client.Zones.List(body.ProjectID).Do()
postCheck(writer, result, err)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.2.2-patch1-rc2

搜索帮助

Cb406eda 1850385 E526c682 1850385