22 lines
509 B
Go
22 lines
509 B
Go
package handler
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
)
|
|
|
|
// VmCreate receives the CloudEvent for a VM creation
|
|
func (h *Handler) VmCreate(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 create request", "body", string(reqBody))
|
|
w.WriteHeader(http.StatusOK)
|
|
fmt.Fprintf(w, "Create Request (%d): %v\n", len(reqBody), string(reqBody))
|
|
}
|