mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 04:51:39 +02:00
Start implementing nodestate rest api
This commit is contained in:
@@ -7,6 +7,9 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/internal/repository"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
@@ -27,4 +30,12 @@ func (api *RestApi) updateNodeStates(rw http.ResponseWriter, r *http.Request) {
|
||||
handleError(fmt.Errorf("parsing request body failed: %w", err), http.StatusBadRequest, rw)
|
||||
return
|
||||
}
|
||||
repo := repository.GetNodeRepository()
|
||||
|
||||
for _, node := range req.Nodes {
|
||||
state := schema.NodeStateUnknown
|
||||
// TODO: Determine valid node state
|
||||
repo.UpdateNodeState(node.Name, req.Cluster, &state)
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user