Files
opencode-krates-connector/server/internal/api/handlers/resources.go

48 lines
1.1 KiB
Go

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)
}