37 Star 396 Fork 72

GVPrancher/rancher

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
gke_zones_endpoint.go 689 Bytes
Copy Edit Raw Blame History
Fyery authored 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.4-rc20

Search

Cb406eda 1850385 E526c682 1850385