Use code-generator to generate clientset/informer/lister (#1492)
To reduce maintenance effort and avoid writing duplicate informer code, use code-generator to generate clientset/informer/lister code.
This commit is contained in:
@@ -60,7 +60,7 @@ func RegisterCanaryConfigRoute(ws *restful.WebService) {
|
||||
Produces(restful.MIME_JSON).
|
||||
Reads(fv1.CanaryConfig{}).
|
||||
Writes(metav1.ObjectMeta{}).
|
||||
Returns(http.StatusCreated, "Metadata of created canaryConfig", metav1.ObjectMeta{}))
|
||||
Returns(http.StatusCreated, "ObjectMeta of created canaryConfig", metav1.ObjectMeta{}))
|
||||
|
||||
ws.Route(
|
||||
ws.GET("/v2/canaryconfigs/{canaryConfig}").
|
||||
@@ -86,7 +86,7 @@ func RegisterCanaryConfigRoute(ws *restful.WebService) {
|
||||
Produces(restful.MIME_JSON).
|
||||
Reads(fv1.CanaryConfig{}).
|
||||
Writes(metav1.ObjectMeta{}). // on the response
|
||||
Returns(http.StatusOK, "Metadata of updated canaryConfig", metav1.ObjectMeta{}))
|
||||
Returns(http.StatusOK, "ObjectMeta of updated canaryConfig", metav1.ObjectMeta{}))
|
||||
|
||||
ws.Route(
|
||||
ws.DELETE("/v2/canaryconfigs/{canaryConfig}").
|
||||
@@ -122,13 +122,13 @@ func (a *API) CanaryConfigApiCreate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
canaryCfgNew, err := a.fissionClient.CanaryConfigs(canaryCfg.Metadata.Namespace).Create(&canaryCfg)
|
||||
canaryCfgNew, err := a.fissionClient.V1().CanaryConfigs(canaryCfg.ObjectMeta.Namespace).Create(&canaryCfg)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := json.Marshal(canaryCfgNew.Metadata)
|
||||
resp, err := json.Marshal(canaryCfgNew.ObjectMeta)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -153,7 +153,7 @@ func (a *API) CanaryConfigApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
canaryCfg, err := a.fissionClient.CanaryConfigs(ns).Get(name)
|
||||
canaryCfg, err := a.fissionClient.V1().CanaryConfigs(ns).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -180,7 +180,7 @@ func (a *API) CanaryConfigApiList(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
canaryCfgs, err := a.fissionClient.CanaryConfigs(ns).List(metav1.ListOptions{})
|
||||
canaryCfgs, err := a.fissionClient.V1().CanaryConfigs(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -215,13 +215,13 @@ func (a *API) CanaryConfigApiUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
canayCfgNew, err := a.fissionClient.CanaryConfigs(c.Metadata.Namespace).Update(&c)
|
||||
canayCfgNew, err := a.fissionClient.V1().CanaryConfigs(c.ObjectMeta.Namespace).Update(&c)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := json.Marshal(canayCfgNew.Metadata)
|
||||
resp, err := json.Marshal(canayCfgNew.ObjectMeta)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -244,7 +244,7 @@ func (a *API) CanaryConfigApiDelete(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
err := a.fissionClient.CanaryConfigs(ns).Delete(name, &metav1.DeleteOptions{})
|
||||
err := a.fissionClient.V1().CanaryConfigs(ns).Delete(name, &metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user