293 lines
12 KiB
Go
293 lines
12 KiB
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type IncidentResponse struct {
|
|
ImportSet string `json:"import_set"`
|
|
StagingTable string `json:"staging_table"`
|
|
Result []struct {
|
|
TransformMap string `json:"transform_map"`
|
|
Table string `json:"table"`
|
|
DisplayName string `json:"display_name"`
|
|
DisplayValue string `json:"display_value"`
|
|
RecordLink string `json:"record_link"`
|
|
Status string `json:"status"`
|
|
SysID string `json:"sys_id"`
|
|
}
|
|
}
|
|
|
|
type Incident struct {
|
|
IncidentNumber string `json:"incident_number,omitempty"` // The incident number in ServiceNow. If blank, creates a new incident, if populated with a valid value it updates that record.
|
|
Description string `json:"description,omitempty"`
|
|
ShortDescription string `json:"short_description,omitempty"`
|
|
// 1 = Critical , 2 = High, 3 = Medium, 4 = Low
|
|
Urgency string `json:"urgency,omitempty"` // integer value, 1-4
|
|
// 1 = Critical , 2 = High, 3 = Medium, 4 = Low
|
|
Impact string `json:"impact,omitempty"` // integer value, 1-4
|
|
// State: 1 = New ; 2 = In Progress ; 3 = On Hold ; 6 = Resolved ; 7 = Closed ; 8 = Cancelled
|
|
State string `json:"state,omitempty"` // integer value, 1-6 (6 is resolved)
|
|
// Associated DeviceID (UUID from CPDB)
|
|
ExternalID string `json:"external_id,omitempty"` // CPDB UUID for the configuration item
|
|
WorkNotes string `json:"work_notes,omitempty"` // Additional notes
|
|
AssignmentGroup string `json:"assignment_group,omitempty"`
|
|
AssignedTo string `json:"assigned_to,omitempty"`
|
|
// Cat/SubCategory to populate the Incident appropriately
|
|
Category string `json:"category,omitempty"`
|
|
SubCategory string `json:"subcategory,omitempty"`
|
|
}
|
|
|
|
type CloudEventReceived struct {
|
|
CloudEvent struct {
|
|
ID string `json:"id"`
|
|
Specversion string `json:"specversion"`
|
|
Source string `json:"source"`
|
|
Type string `json:"type"`
|
|
Time string `json:"time"` // Modified from time.Time
|
|
Data struct {
|
|
ChainID int `json:"ChainId"`
|
|
ChangeTag string `json:"ChangeTag"`
|
|
ComputeResource struct {
|
|
ComputeResource struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"ComputeResource"`
|
|
Name string `json:"Name"`
|
|
} `json:"ComputeResource"`
|
|
CreatedTime string `json:"CreatedTime"` // Modified from time.Time
|
|
Datacenter struct {
|
|
Datacenter struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Datacenter"`
|
|
Name string `json:"Name"`
|
|
} `json:"Datacenter"`
|
|
Ds interface{} `json:"Ds"`
|
|
Dvs interface{} `json:"Dvs"`
|
|
FullFormattedMessage string `json:"FullFormattedMessage"`
|
|
Host struct {
|
|
Host struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Host"`
|
|
Name string `json:"Name"`
|
|
} `json:"Host"`
|
|
Key int `json:"Key"`
|
|
Net interface{} `json:"Net"`
|
|
NewParent *CloudEventResourcePool `json:"NewParent"`
|
|
OldParent *CloudEventResourcePool `json:"OldParent"`
|
|
SrcTemplate *CloudEventVm `json:"SrcTemplate"`
|
|
Template bool `json:"Template"`
|
|
UserName string `json:"UserName"`
|
|
VM struct {
|
|
Name string `json:"Name"`
|
|
VM struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Vm"`
|
|
} `json:"Vm"`
|
|
ConfigSpec *json.RawMessage `json:"configSpec"`
|
|
ConfigChanges *ConfigChangesReceived `json:"configChanges"` // Modified to separate struct
|
|
} `json:"data"`
|
|
} `json:"cloudEvent"`
|
|
}
|
|
|
|
type CloudEventResourcePool struct {
|
|
Name string `json:"Name"`
|
|
ResourcePool struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"ResourcePool"`
|
|
}
|
|
|
|
type CloudEventVm struct {
|
|
Name string `json:"Name"`
|
|
VM struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Vm"`
|
|
}
|
|
|
|
type ImportReceived struct {
|
|
Name string `json:"Name"`
|
|
Vcenter string `json:"Vcenter"`
|
|
VmId string `json:"VmId"`
|
|
InitialRam int `json:"InitialRam"`
|
|
PowerState int `json:"PowerState"`
|
|
CreationTime int `json:"CreationTime"`
|
|
InitialVcpus int `json:"InitialVcpus"`
|
|
ProvisionedDisk float64 `json:"ProvisionedDisk"`
|
|
Folder string `json:"Folder"`
|
|
ResourcePool string `json:"ResourcePool"`
|
|
Datacenter string `json:"Datacenter"`
|
|
Cluster string `json:"Cluster"`
|
|
}
|
|
|
|
type ConfigChangesReceived struct {
|
|
Modified string `json:"modified"`
|
|
}
|
|
|
|
// This probably needs more fields added so not in use yet
|
|
type ConfigSpec struct {
|
|
AlternateGuestName string `json:"AlternateGuestName"`
|
|
Annotation string `json:"Annotation"`
|
|
BootOptions any `json:"BootOptions"`
|
|
ChangeTrackingEnabled any `json:"ChangeTrackingEnabled"`
|
|
ChangeVersion string `json:"ChangeVersion"`
|
|
ConsolePreferences any `json:"ConsolePreferences"`
|
|
CPUAffinity any `json:"CpuAffinity"`
|
|
CPUAllocation any `json:"CpuAllocation"`
|
|
CPUFeatureMask any `json:"CpuFeatureMask"`
|
|
CPUHotAddEnabled any `json:"CpuHotAddEnabled"`
|
|
CPUHotRemoveEnabled any `json:"CpuHotRemoveEnabled"`
|
|
CreateDate string `json:"CreateDate"` // Modified from time.Time
|
|
Crypto any `json:"Crypto"`
|
|
DeviceChange []struct {
|
|
Backing any `json:"Backing"`
|
|
Device struct {
|
|
Backing *BackingSpec `json:"Backing,omitempty"`
|
|
CapacityInBytes int `json:"CapacityInBytes"`
|
|
CapacityInKB int `json:"CapacityInKB"`
|
|
Connectable struct {
|
|
AllowGuestControl bool `json:"AllowGuestControl"`
|
|
Connected bool `json:"Connected"`
|
|
MigrateConnect string `json:"MigrateConnect"`
|
|
StartConnected bool `json:"StartConnected"`
|
|
Status string `json:"Status"`
|
|
} `json:"Connectable"`
|
|
ControllerKey int `json:"ControllerKey"`
|
|
DeviceInfo struct {
|
|
Label string `json:"Label"`
|
|
Summary string `json:"Summary"`
|
|
} `json:"DeviceInfo"`
|
|
ExternalID string `json:"ExternalId"`
|
|
MacAddress string `json:"MacAddress"`
|
|
ResourceAllocation struct {
|
|
Limit int `json:"Limit"`
|
|
Reservation int `json:"Reservation"`
|
|
Share struct {
|
|
Level string `json:"Level"`
|
|
Shares int `json:"Shares"`
|
|
} `json:"Share"`
|
|
} `json:"ResourceAllocation"`
|
|
SlotInfo any `json:"SlotInfo"`
|
|
UnitNumber int `json:"UnitNumber"`
|
|
UptCompatibilityEnabled bool `json:"UptCompatibilityEnabled"`
|
|
WakeOnLanEnabled bool `json:"WakeOnLanEnabled"`
|
|
DiskObjectID string `json:"DiskObjectId"`
|
|
Iofilter any `json:"Iofilter"`
|
|
Key int `json:"Key"`
|
|
NativeUnmanagedLinkedClone any `json:"NativeUnmanagedLinkedClone"`
|
|
Shares any `json:"Shares"`
|
|
StorageIOAllocation struct {
|
|
Limit int `json:"Limit"`
|
|
Reservation any `json:"Reservation"`
|
|
Shares struct {
|
|
Level string `json:"Level"`
|
|
Shares int `json:"Shares"`
|
|
} `json:"Shares"`
|
|
} `json:"StorageIOAllocation"`
|
|
VDiskID any `json:"VDiskId"`
|
|
VFlashCacheConfigInfo any `json:"VFlashCacheConfigInfo"`
|
|
} `json:"Device,omitempty"`
|
|
FileOperation string `json:"FileOperation"`
|
|
Operation string `json:"Operation"`
|
|
Profile []struct {
|
|
ProfileData struct {
|
|
ExtensionKey string `json:"ExtensionKey"`
|
|
ObjectData string `json:"ObjectData"` // Modified from time.Time
|
|
} `json:"ProfileData"`
|
|
ProfileID string `json:"ProfileId"`
|
|
ProfileParams any `json:"ProfileParams"`
|
|
ReplicationSpec any `json:"ReplicationSpec"`
|
|
} `json:"Profile"`
|
|
} `json:"DeviceChange"`
|
|
ExtraConfig any `json:"ExtraConfig"`
|
|
Files struct {
|
|
FtMetadataDirectory string `json:"FtMetadataDirectory"`
|
|
LogDirectory string `json:"LogDirectory"`
|
|
SnapshotDirectory string `json:"SnapshotDirectory"`
|
|
SuspendDirectory string `json:"SuspendDirectory"`
|
|
VMPathName string `json:"VmPathName"`
|
|
} `json:"Files"`
|
|
Firmware string `json:"Firmware"`
|
|
Flags any `json:"Flags"`
|
|
FtInfo any `json:"FtInfo"`
|
|
GuestAutoLockEnabled any `json:"GuestAutoLockEnabled"`
|
|
GuestID string `json:"GuestId"`
|
|
GuestMonitoringModeInfo any `json:"GuestMonitoringModeInfo"`
|
|
InstanceUUID string `json:"InstanceUuid"`
|
|
LatencySensitivity any `json:"LatencySensitivity"`
|
|
LocationID string `json:"LocationId"`
|
|
ManagedBy any `json:"ManagedBy"`
|
|
MaxMksConnections int `json:"MaxMksConnections"`
|
|
MemoryAffinity any `json:"MemoryAffinity"`
|
|
MemoryAllocation any `json:"MemoryAllocation"`
|
|
MemoryHotAddEnabled any `json:"MemoryHotAddEnabled"`
|
|
MemoryMB int `json:"MemoryMB"`
|
|
MemoryReservationLockedToMax any `json:"MemoryReservationLockedToMax"`
|
|
MessageBusTunnelEnabled any `json:"MessageBusTunnelEnabled"`
|
|
MigrateEncryption string `json:"MigrateEncryption"`
|
|
Name string `json:"Name"`
|
|
NestedHVEnabled any `json:"NestedHVEnabled"`
|
|
NetworkShaper any `json:"NetworkShaper"`
|
|
NpivDesiredNodeWwns int `json:"NpivDesiredNodeWwns"`
|
|
NpivDesiredPortWwns int `json:"NpivDesiredPortWwns"`
|
|
NpivNodeWorldWideName any `json:"NpivNodeWorldWideName"`
|
|
NpivOnNonRdmDisks any `json:"NpivOnNonRdmDisks"`
|
|
NpivPortWorldWideName any `json:"NpivPortWorldWideName"`
|
|
NpivTemporaryDisabled any `json:"NpivTemporaryDisabled"`
|
|
NpivWorldWideNameOp string `json:"NpivWorldWideNameOp"`
|
|
NpivWorldWideNameType string `json:"NpivWorldWideNameType"`
|
|
NumCPUs int `json:"NumCPUs"`
|
|
NumCoresPerSocket int `json:"NumCoresPerSocket"`
|
|
PowerOpInfo any `json:"PowerOpInfo"`
|
|
RepConfig any `json:"RepConfig"`
|
|
ScheduledHardwareUpgradeInfo any `json:"ScheduledHardwareUpgradeInfo"`
|
|
SevEnabled any `json:"SevEnabled"`
|
|
SgxInfo any `json:"SgxInfo"`
|
|
SwapPlacement string `json:"SwapPlacement"`
|
|
Tools any `json:"Tools"`
|
|
UUID string `json:"Uuid"`
|
|
VAppConfig any `json:"VAppConfig"`
|
|
VAppConfigRemoved any `json:"VAppConfigRemoved"`
|
|
VAssertsEnabled any `json:"VAssertsEnabled"`
|
|
VPMCEnabled any `json:"VPMCEnabled"`
|
|
VcpuConfig any `json:"VcpuConfig"`
|
|
Version string `json:"Version"`
|
|
VirtualICH7MPresent any `json:"VirtualICH7MPresent"`
|
|
VirtualSMCPresent any `json:"VirtualSMCPresent"`
|
|
VMProfile any `json:"VmProfile"`
|
|
}
|
|
|
|
type BackingSpec struct {
|
|
Port struct {
|
|
ConnectionCookie int `json:"ConnectionCookie"`
|
|
PortKey string `json:"PortKey"`
|
|
PortgroupKey string `json:"PortgroupKey"`
|
|
SwitchUUID string `json:"SwitchUuid"`
|
|
} `json:"Port"`
|
|
BackingObjectID string `json:"BackingObjectId"`
|
|
ChangeID string `json:"ChangeId"`
|
|
ContentID string `json:"ContentId"`
|
|
Datastore struct {
|
|
Type string `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Datastore"`
|
|
DeltaDiskFormat string `json:"DeltaDiskFormat"`
|
|
DeltaDiskFormatVariant string `json:"DeltaDiskFormatVariant"`
|
|
DeltaGrainSize int `json:"DeltaGrainSize"`
|
|
DigestEnabled any `json:"DigestEnabled"`
|
|
DiskMode string `json:"DiskMode"`
|
|
EagerlyScrub bool `json:"EagerlyScrub"`
|
|
FileName string `json:"FileName"`
|
|
KeyID any `json:"KeyId"`
|
|
Parent any `json:"Parent"`
|
|
Sharing string `json:"Sharing"`
|
|
Split any `json:"Split"`
|
|
ThinProvisioned bool `json:"ThinProvisioned"`
|
|
UUID string `json:"Uuid"`
|
|
WriteThrough any `json:"WriteThrough"`
|
|
}
|