From 3057c93204739bcec81e3d11c705baded27349af Mon Sep 17 00:00:00 2001 From: Eamon Bauman Date: Wed, 7 Jun 2023 11:57:58 -0500 Subject: [PATCH] beginning work on scope crd --- pkg/apis/hobbyfarm.io/v1/types.go | 20 ++++++++++++++++++++ pkg/settingserver/settingserver.go | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/pkg/apis/hobbyfarm.io/v1/types.go b/pkg/apis/hobbyfarm.io/v1/types.go index 9f64972e..9de4bc66 100644 --- a/pkg/apis/hobbyfarm.io/v1/types.go +++ b/pkg/apis/hobbyfarm.io/v1/types.go @@ -510,3 +510,23 @@ type SettingList struct { Items []Setting `json:"items"` } + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type Scope struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + DisplayName string `json:"displayName"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ScopeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Scope `json:"items"` +} diff --git a/pkg/settingserver/settingserver.go b/pkg/settingserver/settingserver.go index f1055190..3349724f 100644 --- a/pkg/settingserver/settingserver.go +++ b/pkg/settingserver/settingserver.go @@ -52,6 +52,7 @@ func (s SettingServer) SetupRoutes(r *mux.Router) { r.HandleFunc("/setting/list/{scope}", s.ListFunc).Methods(http.MethodGet) r.HandleFunc("/setting/update/{setting_id}", s.UpdateFunc).Methods(http.MethodPut) r.HandleFunc("/setting/updatecollection", s.UpdateCollection).Methods(http.MethodPut) + r.HandleFunc("/scope/list", s.ListScopeFunc).Methods(http.MethodGet) } func (s SettingServer) ListFunc(w http.ResponseWriter, r *http.Request) { @@ -213,3 +214,7 @@ func (s SettingServer) update(w http.ResponseWriter, r *http.Request, setting Pr return true } + +func (s SettingServer) ListScopeFunc(w http.ResponseWriter, r *http.Request) { + +}