Backend: API handlers, WebSocket manager, K8s client, CRDT, auth
This commit is contained in:
47
server/internal/api/handlers/resources.go
Normal file
47
server/internal/api/handlers/resources.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ResourceResponse struct {
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
UID string `json:"uid"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
func ResourcesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
// Placeholder - will be implemented with actual K8s client
|
||||
resources := []ResourceResponse{
|
||||
{
|
||||
Kind: "Namespace",
|
||||
Name: "default",
|
||||
Namespace: "",
|
||||
UID: "ns-default",
|
||||
CreatedAt: "2024-01-01T00:00:00Z",
|
||||
},
|
||||
}
|
||||
|
||||
json.NewEncoder(w).Encode(resources)
|
||||
}
|
||||
|
||||
func ResourceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
// Placeholder - will be implemented with actual K8s client
|
||||
resource := ResourceResponse{
|
||||
Kind: "Pod",
|
||||
Name: "example-pod",
|
||||
Namespace: "default",
|
||||
UID: "pod-example",
|
||||
CreatedAt: "2024-01-01T00:00:00Z",
|
||||
}
|
||||
|
||||
json.NewEncoder(w).Encode(resource)
|
||||
}
|
||||
Reference in New Issue
Block a user