structure appears to work
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"vctp/components/core"
|
||||
"vctp/components/home"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Home handles the home page.
|
||||
|
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))
|
||||
}
|
21
server/handler/vmUpdate.go
Normal file
21
server/handler/vmUpdate.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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))
|
||||
}
|
Reference in New Issue
Block a user