1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
package api
import (
"time"
)
// InstanceStatePut represents the modifiable fields of an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStatePut struct {
// State change action (start, stop, restart, freeze, unfreeze)
// Example: start
Action string `json:"action" yaml:"action"`
// How long to wait (in s) before giving up (when force isn't set)
// Example: 30
Timeout int `json:"timeout" yaml:"timeout"`
// Whether to force the action (for stop and restart)
// Example: false
Force bool `json:"force" yaml:"force"`
// Whether to store the runtime state (for stop)
// Example: false
Stateful bool `json:"stateful" yaml:"stateful"`
}
// InstanceState represents an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceState struct {
// Current status (Running, Stopped, Frozen or Error)
// Example: Running
Status string `json:"status" yaml:"status"`
// Numeric status code (101, 102, 110, 112)
// Example: 101
StatusCode StatusCode `json:"status_code" yaml:"status_code"`
// Disk usage key/value pairs
Disk map[string]InstanceStateDisk `json:"disk" yaml:"disk"`
// Memory usage information
Memory InstanceStateMemory `json:"memory" yaml:"memory"`
// Network usage key/value pairs
Network map[string]InstanceStateNetwork `json:"network" yaml:"network"`
// PID of the runtime
// Example: 7281
Pid int64 `json:"pid" yaml:"pid"`
// Number of processes in the instance
// Example: 50
Processes int64 `json:"processes" yaml:"processes"`
// CPU usage information
CPU InstanceStateCPU `json:"cpu" yaml:"cpu"`
// The time that the instance started at
//
// API extension: instance_state_started_at.
StartedAt time.Time `json:"started_at" yaml:"started_at"`
// OS information.
//
// API extension: instances_state_os_info.
OSInfo *InstanceStateOSInfo `json:"os_info" yaml:"os_info"`
}
// InstanceStateDisk represents the disk information section of an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateDisk struct {
// Disk usage in bytes
// Example: 502239232
Usage int64 `json:"usage" yaml:"usage"`
// Total size in bytes
// Example: 502239232
//
// API extension: instances_state_total
Total int64 `json:"total" yaml:"total"`
}
// InstanceStateCPU represents the cpu information section of an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateCPU struct {
// CPU usage in nanoseconds
// Example: 3637691016
Usage int64 `json:"usage" yaml:"usage"`
// CPU time available per second, in nanoseconds
// Example: 4000000000
//
// API extension: instance_state_cpu_time
AllocatedTime int64 `json:"allocated_time" yaml:"allocated_time"`
}
// InstanceStateMemory represents the memory information section of an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateMemory struct {
// Memory usage in bytes
// Example: 73248768
Usage int64 `json:"usage" yaml:"usage"`
// Peak memory usage in bytes
// Example: 73785344
UsagePeak int64 `json:"usage_peak" yaml:"usage_peak"`
// Total memory size in bytes
// Example: 12297557
//
// API extension: instances_state_total
Total int64 `json:"total" yaml:"total"`
// SWAP usage in bytes
// Example: 12297557
SwapUsage int64 `json:"swap_usage" yaml:"swap_usage"`
// Peak SWAP usage in bytes
// Example: 12297557
SwapUsagePeak int64 `json:"swap_usage_peak" yaml:"swap_usage_peak"`
}
// InstanceStateNetwork represents the network information section of an instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateNetwork struct {
// List of IP addresses
Addresses []InstanceStateNetworkAddress `json:"addresses" yaml:"addresses"`
// Traffic counters
Counters InstanceStateNetworkCounters `json:"counters" yaml:"counters"`
// MAC address
// Example: 10:66:6a:0c:ee:dd
Hwaddr string `json:"hwaddr" yaml:"hwaddr"`
// Name of the interface on the host
// Example: vethbbcd39c7
HostName string `json:"host_name" yaml:"host_name"`
// MTU (maximum transmit unit) for the interface
// Example: 1500
Mtu int `json:"mtu" yaml:"mtu"`
// Administrative state of the interface (up/down)
// Example: up
State string `json:"state" yaml:"state"`
// Type of interface (broadcast, loopback, point-to-point, ...)
// Example: broadcast
Type string `json:"type" yaml:"type"`
}
// InstanceStateNetworkAddress represents a network address as part of the network section of an
// instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateNetworkAddress struct {
// Network family (inet or inet6)
// Example: inet6
Family string `json:"family" yaml:"family"`
// IP address
// Example: fd42:4c81:5770:1eaf:1266:6aff:fe0c:eedd
Address string `json:"address" yaml:"address"`
// Network mask
// Example: 64
Netmask string `json:"netmask" yaml:"netmask"`
// Address scope (local, link or global)
// Example: global
Scope string `json:"scope" yaml:"scope"`
}
// InstanceStateNetworkCounters represents packet counters as part of the network section of an
// instance's state.
//
// swagger:model
//
// API extension: instances.
type InstanceStateNetworkCounters struct {
// Number of bytes received
// Example: 192021
BytesReceived int64 `json:"bytes_received" yaml:"bytes_received"`
// Number of bytes sent
// Example: 10888579
BytesSent int64 `json:"bytes_sent" yaml:"bytes_sent"`
// Number of packets received
// Example: 1748
PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`
// Number of packets sent
// Example: 964
PacketsSent int64 `json:"packets_sent" yaml:"packets_sent"`
// Number of errors received
// Example: 14
ErrorsReceived int64 `json:"errors_received" yaml:"errors_received"`
// Number of errors sent
// Example: 41
ErrorsSent int64 `json:"errors_sent" yaml:"errors_sent"`
// Number of outbound packets dropped
// Example: 541
PacketsDroppedOutbound int64 `json:"packets_dropped_outbound" yaml:"packets_dropped_outbound"`
// Number of inbound packets dropped
// Example: 179
PacketsDroppedInbound int64 `json:"packets_dropped_inbound" yaml:"packets_dropped_inbound"`
}
// InstanceStateOSInfo represents the operating system information section of an instance's state.
//
// swagger:model
//
// API extension: instances_state_os_info.
type InstanceStateOSInfo struct {
// Operating system running in the instance.
// Example: Debian GNU/Linux
OS string `json:"os" yaml:"os"`
// Version of the operating system.
// Example: 12 (bookworm)
OSVersion string `json:"os_version" yaml:"os_version"`
// Version of the kernel running in the instance.
// Example: 6.1.0-25-amd64
KernelVersion string `json:"kernel_version" yaml:"kernel_version"`
// Hostname of the instance.
// Example: myhost
Hostname string `json:"hostname" yaml:"hostname"`
// FQDN of the instance.
// Example: myhost.mydomain.local
FQDN string `json:"fqdn" yaml:"fqdn"`
}
|