Files
vctp2/server/handler/vmUpdate.go
Nathan Coad 18a2b7227e
Some checks failed
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone Build is failing
structure appears to work
2024-09-12 11:59:41 +10:00

22 lines
521 B
Go

package handler
import (
"fmt"
"io"
"net/http"
)
// VmUpdate receives the CloudEvent for a VM modification or move
func (h *Handler) VmUpdate(w http.ResponseWriter, r *http.Request) {
reqBody, err := io.ReadAll(r.Body)
if err != nil {
fmt.Fprintf(w, "Invalid data received")
w.WriteHeader(http.StatusInternalServerError)
return
}
h.Logger.Debug("received update request", "body", string(reqBody))
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "Update Request (%d): %v\n", len(reqBody), string(reqBody))
}