Files
vclusterapi/models/workloads.go
behrooz 08d17a33ea fix
2025-09-03 16:48:20 +03:30

161 lines
4.3 KiB
Go

package models
import (
"go.mongodb.org/mongo-driver/bson/primitive"
)
type User struct {
ID string `json:"id,omitempty"`
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password,omitempty"`
}
type Cluster struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
Name string `json:"name"`
Namespace string `json:"namespace"`
ControlPlane string `json:"controlPlane"`
PlatformVersion string `json:"platformversion"`
Cpu string `json:"cpu"`
Memory string `json:"memory"`
CreatedAt string `json:"createdAt"`
UserID primitive.ObjectID `json:"userId"`
Cluster_config string `json:"clusterconfig"`
EndPoint string `json:"endPoint"`
}
type Header struct {
Authorization string `bson:"token"`
}
type Pod struct {
Name string `json:name`
Namespace string `json:name`
Status string `json:status`
Restart int32 `json:restart`
Age string `json:age`
}
type Service struct {
Name string `json:name`
Namespace string `json:name`
Type string `json:type`
ClusterIP string `json:clusterIp`
ExternalIP string `json:externalIp`
Ports string `json:ports`
Age string `json:age`
}
type Deployment struct {
Name string `json:name`
Namespace string `json:namespace`
Available string `json:available`
Replicas int32 `json:replicas`
Message string `json:message`
Reason string `json:reason`
}
type Daemonset struct {
Name string `json:name`
Namespace string `json:namespace`
Ready int32 `json:Ready`
Age string `json:age`
DESIRED int32 `json:desired`
CURRENT int32 `json:current`
UpdateToDate int32 `json:uptodate`
Available int32 `json:available`
Node string `json:node`
Selector string `json:selector`
}
type Jobs struct {
Namespace string `json:name`
Name string `json:name`
Status string `json:status`
Completion string `json:completion`
Duration string `json:duration`
Age string `json:age`
}
type Replicaset struct {
Name string `json:name`
Desired int32 `json:desired`
Current int32 `json:current`
Ready int32 `json:Ready`
Age string `json:age`
Namespace string `json:name`
}
type ReplicationController struct {
Namespace string `json:name`
Name string `json:name`
Desired int32 `json:desired`
Current int32 `json:current`
Ready int32 `json:Ready`
Age string `json:age`
}
type StatefulSet struct {
Namespace string `json:name`
Name string `json:name`
Ready string `json:Ready`
Age string `json:age`
}
type WorkerNodesPlans struct {
Plan string `json:plan`
Cpu string `json:cpu`
Memory string `json:memory`
Storage string `;sjon:storage`
}
type ClusterStats struct {
ResourceUsage ResourceUsage `json:"resourceUsage"`
Performance Performance `json:"performance"`
Health Health `json:"health"`
Uptime Uptime `json:"uptime"`
Name string `json:"name"`
ClusterId string `json:"clusterId"`
Status string `json:"status"`
Version string `json:"version"`
Alerts string `json:"alerts"`
Endpoint string `json:"endpoint"`
}
type ResourceUsage struct {
CPU Usage `json:"cpu"`
Memory Usage `json:"memory"`
Storage Usage `json:"storage"`
Network Usage `json:"network"`
}
type Usage struct {
Used float64 `json:"used"`
Total float64 `json:"total"`
Unit string `json:"unit"`
}
type Performance struct {
PodStartupTime string `json:"podStartupTime"`
APILatency string `json:"apiLatency"`
EtcdLatency string `json:"etcdLatency"`
SchedulerLatency string `json:"schedulerLatency"`
}
type Health struct {
NodesHealthy int `json:"nodesHealthy"`
NodesTotal int `json:"nodesTotal"`
PodsRunning int `json:"podsRunning"`
PodsTotal int `json:"podsTotal"`
Alerts int `json:"alerts"`
Warnings int `json:"warnings"`
Status string `json:"healthy"`
}
type Uptime struct {
ClusterUptime string `json:"clusterUptime"`
LastMaintenance string `json:"lastMaintenance"`
NextMaintenance string `json:"nextMaintenance"`
}