structure appears to work
This commit is contained in:
21
server/handler/vmCreate.go
Normal file
21
server/handler/vmCreate.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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))
|
||||
}
|
Reference in New Issue
Block a user