v1.0.0
This commit is contained in:
85
pkg/cluster/models/model_list.go
Normal file
85
pkg/cluster/models/model_list.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ListClusterResponse represents the response for a list of clusters.
|
||||
type ListClusterResponse struct {
|
||||
List ListCluster `json:"cluster_list"`
|
||||
RequestID string `json:"request_id"`
|
||||
}
|
||||
|
||||
type ListCluster struct {
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"per_page"`
|
||||
IsApproximateTotal bool `json:"is_approximate_total"`
|
||||
Items []ItemCluster `json:"items"`
|
||||
HasMore bool `json:"has_more"`
|
||||
}
|
||||
|
||||
// ItemCluster represents the details of a specific cluster.
|
||||
type ItemCluster struct {
|
||||
FenixClusterStatus string `json:"fenix_cluster_status"`
|
||||
ClusterID int `json:"cluster_id"`
|
||||
MemoryOvercommit float64 `json:"memory_overcommit"`
|
||||
CPUOvercommit float64 `json:"cpu_overcommit"`
|
||||
Created time.Time `json:"created"`
|
||||
StorageName string `json:"storage_name"`
|
||||
StorageType string `json:"storage_type"`
|
||||
FenixBroadcastIP string `json:"fenix_broadcast_ip"`
|
||||
Modified time.Time `json:"modified"`
|
||||
FenixPingIP string `json:"fenix_ping_ip"`
|
||||
Deleted time.Time `json:"deleted"`
|
||||
DrsMode string `json:"drs_mode"`
|
||||
Name string `json:"name"`
|
||||
FenixClusterID int `json:"fenix_cluster_id"`
|
||||
VstorageClusterID int `json:"vstorage_cluster_id"`
|
||||
FenixBalancingStrategy string `json:"fenix_balancing_strategy"`
|
||||
FenixEnabled bool `json:"fenix_enabled"`
|
||||
NodeCount int `json:"node_count"`
|
||||
VMTotalRAM int `json:"vm_total_ram"`
|
||||
VMCount int `json:"vm_count"`
|
||||
ResourceMetrics interface{} `json:"resource_metrics"`
|
||||
}
|
||||
|
||||
type ResourceMetrics struct {
|
||||
CPU int `json:"cpu"`
|
||||
MemoryAvailable float64 `json:"memory_available"`
|
||||
AvgUtilization float64 `json:"avg_utilization"`
|
||||
MaxMemoryAvailable float64 `json:"max_memory_available"`
|
||||
MaxCPUAvailable float64 `json:"max_cpu_available"`
|
||||
MigrationsCount int `json:"migrations_count"`
|
||||
CPUAvailable float64 `json:"cpu_available"`
|
||||
Memory int `json:"memory"`
|
||||
StandardDeviation float64 `json:"standard_deviation"`
|
||||
MaxStandardDeviation float64 `json:"max_standard_deviation"`
|
||||
}
|
||||
|
||||
func (ic *ItemCluster) UnmarshalJSON(data []byte) error {
|
||||
type Alias ItemCluster
|
||||
temp := &struct {
|
||||
ResourceMetrics json.RawMessage `json:"resource_metrics,omitempty"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(ic),
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &temp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(temp.ResourceMetrics) > 0 {
|
||||
var metrics ResourceMetrics
|
||||
if err := json.Unmarshal(temp.ResourceMetrics, &metrics); err != nil {
|
||||
return err
|
||||
}
|
||||
ic.ResourceMetrics = metrics
|
||||
} else {
|
||||
ic.ResourceMetrics = nil
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
57
pkg/cluster/models/model_v_network.go
Normal file
57
pkg/cluster/models/model_v_network.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type ListVNetwork struct {
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"per_page"`
|
||||
IsApproximateTotal bool `json:"is_approximate_total"`
|
||||
Items []VNetworkItem `json:"items"`
|
||||
HasMore bool `json:"has_more"`
|
||||
RequestID string `json:"request_id"`
|
||||
}
|
||||
|
||||
type VNetworkItem struct {
|
||||
AliasID int `json:"alias_id"`
|
||||
NetworkType string `json:"network_type"`
|
||||
ClusterID int `json:"cluster_id"`
|
||||
VirtualNetworkID int `json:"virtual_network_id"`
|
||||
Created time.Time `json:"created"`
|
||||
Modified time.Time `json:"modified"`
|
||||
ExternalUUID int `json:"external_uuid"`
|
||||
Deleted time.Time `json:"deleted"`
|
||||
Name string `json:"name"`
|
||||
BridgeInterfaceID int `json:"bridge_interface_id"`
|
||||
VlanID int `json:"vlan_id"`
|
||||
Description string `json:"description"`
|
||||
VlanInterfaceID int `json:"vlan_interface_id"`
|
||||
NetworkInterfaceID int `json:"network_interface_id"`
|
||||
ExternalResourceID int `json:"external_resource_id"`
|
||||
NodeID int `json:"node_id"`
|
||||
NodeCount int `json:"node_count"`
|
||||
VMCount int `json:"vm_count"`
|
||||
RunningVMCount int `json:"running_vm_count"`
|
||||
Alias string `json:"alias"`
|
||||
Node Node `json:"node"`
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
MaintenanceStatus string `json:"maintenance_status"`
|
||||
ClusterID int `json:"cluster_id"`
|
||||
Created time.Time `json:"created"`
|
||||
VstorageStatus string `json:"vstorage_status"`
|
||||
IPAddress string `json:"ip_address"`
|
||||
Status string `json:"status"`
|
||||
Modified time.Time `json:"modified"`
|
||||
Deleted time.Time `json:"deleted"`
|
||||
ServerUUID string `json:"server_uuid"`
|
||||
Name string `json:"name"`
|
||||
VstorageHostID int `json:"vstorage_host_id"`
|
||||
Compute bool `json:"compute"`
|
||||
VstorageClusterID int `json:"vstorage_cluster_id"`
|
||||
SdkStatus string `json:"sdk_status"`
|
||||
Description string `json:"description"`
|
||||
StorageStatus string `json:"storage_status"`
|
||||
NodeID int `json:"node_id"`
|
||||
}
|
||||
Reference in New Issue
Block a user