store event type
This commit is contained in:
@@ -68,6 +68,7 @@ func (h *Handler) VmCleanup(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
} else {
|
||||
// Successful cleanup
|
||||
h.Logger.Debug("VM successfully removed from inventory", "vm_name", vm.Name, "iid", vm.Iid, "vm_id", vmId, "datacenter_name", datacenterName)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
|
@@ -14,8 +14,8 @@ import (
|
||||
models "vctp/server/models"
|
||||
)
|
||||
|
||||
// VmCreate receives the CloudEvent for a VM creation
|
||||
func (h *Handler) VmCreate(w http.ResponseWriter, r *http.Request) {
|
||||
// VmCreateEvent receives the CloudEvent for a VM creation
|
||||
func (h *Handler) VmCreateEvent(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
unixTimestamp int64
|
||||
//numVcpus int32
|
||||
@@ -67,6 +67,7 @@ func (h *Handler) VmCreate(w http.ResponseWriter, r *http.Request) {
|
||||
Source: event.CloudEvent.Source,
|
||||
CloudId: event.CloudEvent.ID,
|
||||
EventTime: sql.NullInt64{Int64: unixTimestamp, Valid: unixTimestamp > 0},
|
||||
EventType: sql.NullString{String: event.CloudEvent.Type, Valid: event.CloudEvent.Type != ""},
|
||||
ChainId: strconv.Itoa(e.ChainID),
|
||||
VmId: sql.NullString{String: e.VM.VM.Value, Valid: e.VM.VM.Value != ""},
|
||||
VmName: sql.NullString{String: e.VM.Name, Valid: e.VM.Name != ""},
|
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// VmUpdate receives the CloudEvent for a VM modification or move
|
||||
func (h *Handler) VmDelete(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *Handler) VmDeleteEvent(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
deletedTimestamp int64
|
||||
)
|
@@ -18,8 +18,8 @@ import (
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
// VmModify receives the CloudEvent for a VM modification or move
|
||||
func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
||||
// VmModifyEvent receives the CloudEvent for a VM modification or move
|
||||
func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
|
||||
var configChanges []map[string]string
|
||||
params := queries.CreateUpdateParams{}
|
||||
var unixTimestamp int64
|
Reference in New Issue
Block a user