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 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
|
package schema
import "time"
// Server defines the schema of a server.
type Server struct {
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Created time.Time `json:"created"`
PublicNet ServerPublicNet `json:"public_net"`
PrivateNet []ServerPrivateNet `json:"private_net"`
ServerType ServerType `json:"server_type"`
IncludedTraffic uint64 `json:"included_traffic"`
OutgoingTraffic *uint64 `json:"outgoing_traffic"`
IngoingTraffic *uint64 `json:"ingoing_traffic"`
BackupWindow *string `json:"backup_window"`
RescueEnabled bool `json:"rescue_enabled"`
ISO *ISO `json:"iso"`
Locked bool `json:"locked"`
Datacenter Datacenter `json:"datacenter"`
Image *Image `json:"image"`
Protection ServerProtection `json:"protection"`
Labels map[string]string `json:"labels"`
Volumes []int64 `json:"volumes"`
PrimaryDiskSize int `json:"primary_disk_size"`
PlacementGroup *PlacementGroup `json:"placement_group"`
}
// ServerProtection defines the schema of a server's resource protection.
type ServerProtection struct {
Delete bool `json:"delete"`
Rebuild bool `json:"rebuild"`
}
// ServerPublicNet defines the schema of a server's
// public network information.
type ServerPublicNet struct {
IPv4 ServerPublicNetIPv4 `json:"ipv4"`
IPv6 ServerPublicNetIPv6 `json:"ipv6"`
FloatingIPs []int64 `json:"floating_ips"`
Firewalls []ServerFirewall `json:"firewalls"`
}
// ServerPublicNetIPv4 defines the schema of a server's public
// network information for an IPv4.
type ServerPublicNetIPv4 struct {
ID int64 `json:"id"`
IP string `json:"ip"`
Blocked bool `json:"blocked"`
DNSPtr string `json:"dns_ptr"`
}
// ServerPublicNetIPv6 defines the schema of a server's public
// network information for an IPv6.
type ServerPublicNetIPv6 struct {
ID int64 `json:"id"`
IP string `json:"ip"`
Blocked bool `json:"blocked"`
DNSPtr []ServerPublicNetIPv6DNSPtr `json:"dns_ptr"`
}
// ServerPublicNetIPv6DNSPtr defines the schema of a server's
// public network information for an IPv6 reverse DNS.
type ServerPublicNetIPv6DNSPtr struct {
IP string `json:"ip"`
DNSPtr string `json:"dns_ptr"`
}
// ServerFirewall defines the schema of a Server's Firewalls on
// a certain network interface.
type ServerFirewall struct {
ID int64 `json:"id"`
Status string `json:"status"`
}
// ServerPrivateNet defines the schema of a server's private network information.
type ServerPrivateNet struct {
Network int64 `json:"network"`
IP string `json:"ip"`
AliasIPs []string `json:"alias_ips"`
MACAddress string `json:"mac_address"`
}
// ServerGetResponse defines the schema of the response when
// retrieving a single server.
type ServerGetResponse struct {
Server Server `json:"server"`
}
// ServerListResponse defines the schema of the response when
// listing servers.
type ServerListResponse struct {
Servers []Server `json:"servers"`
}
// ServerCreateRequest defines the schema for the request to
// create a server.
type ServerCreateRequest struct {
Name string `json:"name"`
ServerType interface{} `json:"server_type"` // int or string
Image interface{} `json:"image"` // int or string
SSHKeys []int64 `json:"ssh_keys,omitempty"`
Location string `json:"location,omitempty"`
Datacenter string `json:"datacenter,omitempty"`
UserData string `json:"user_data,omitempty"`
StartAfterCreate *bool `json:"start_after_create,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
Automount *bool `json:"automount,omitempty"`
Volumes []int64 `json:"volumes,omitempty"`
Networks []int64 `json:"networks,omitempty"`
Firewalls []ServerCreateFirewalls `json:"firewalls,omitempty"`
PlacementGroup int64 `json:"placement_group,omitempty"`
PublicNet *ServerCreatePublicNet `json:"public_net,omitempty"`
}
// ServerCreatePublicNet defines the public network configuration of a server.
type ServerCreatePublicNet struct {
EnableIPv4 bool `json:"enable_ipv4"`
EnableIPv6 bool `json:"enable_ipv6"`
IPv4ID int64 `json:"ipv4,omitempty"`
IPv6ID int64 `json:"ipv6,omitempty"`
}
// ServerCreateFirewalls defines which Firewalls to apply when creating a Server.
type ServerCreateFirewalls struct {
Firewall int64 `json:"firewall"`
}
// ServerCreateResponse defines the schema of the response when
// creating a server.
type ServerCreateResponse struct {
Server Server `json:"server"`
Action Action `json:"action"`
RootPassword *string `json:"root_password"`
NextActions []Action `json:"next_actions"`
}
// ServerDeleteResponse defines the schema of the response when
// deleting a server.
type ServerDeleteResponse struct {
Action Action `json:"action"`
}
// ServerUpdateRequest defines the schema of the request to update a server.
type ServerUpdateRequest struct {
Name string `json:"name,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
}
// ServerUpdateResponse defines the schema of the response when updating a server.
type ServerUpdateResponse struct {
Server Server `json:"server"`
}
// ServerActionPoweronRequest defines the schema for the request to
// create a poweron server action.
type ServerActionPoweronRequest struct{}
// ServerActionPoweronResponse defines the schema of the response when
// creating a poweron server action.
type ServerActionPoweronResponse struct {
Action Action `json:"action"`
}
// ServerActionPoweroffRequest defines the schema for the request to
// create a poweroff server action.
type ServerActionPoweroffRequest struct{}
// ServerActionPoweroffResponse defines the schema of the response when
// creating a poweroff server action.
type ServerActionPoweroffResponse struct {
Action Action `json:"action"`
}
// ServerActionRebootRequest defines the schema for the request to
// create a reboot server action.
type ServerActionRebootRequest struct{}
// ServerActionRebootResponse defines the schema of the response when
// creating a reboot server action.
type ServerActionRebootResponse struct {
Action Action `json:"action"`
}
// ServerActionResetRequest defines the schema for the request to
// create a reset server action.
type ServerActionResetRequest struct{}
// ServerActionResetResponse defines the schema of the response when
// creating a reset server action.
type ServerActionResetResponse struct {
Action Action `json:"action"`
}
// ServerActionShutdownRequest defines the schema for the request to
// create a shutdown server action.
type ServerActionShutdownRequest struct{}
// ServerActionShutdownResponse defines the schema of the response when
// creating a shutdown server action.
type ServerActionShutdownResponse struct {
Action Action `json:"action"`
}
// ServerActionResetPasswordRequest defines the schema for the request to
// create a reset_password server action.
type ServerActionResetPasswordRequest struct{}
// ServerActionResetPasswordResponse defines the schema of the response when
// creating a reset_password server action.
type ServerActionResetPasswordResponse struct {
Action Action `json:"action"`
RootPassword string `json:"root_password"`
}
// ServerActionCreateImageRequest defines the schema for the request to
// create a create_image server action.
type ServerActionCreateImageRequest struct {
Type *string `json:"type"`
Description *string `json:"description"`
Labels *map[string]string `json:"labels,omitempty"`
}
// ServerActionCreateImageResponse defines the schema of the response when
// creating a create_image server action.
type ServerActionCreateImageResponse struct {
Action Action `json:"action"`
Image Image `json:"image"`
}
// ServerActionEnableRescueRequest defines the schema for the request to
// create a enable_rescue server action.
type ServerActionEnableRescueRequest struct {
Type *string `json:"type,omitempty"`
SSHKeys []int64 `json:"ssh_keys,omitempty"`
}
// ServerActionEnableRescueResponse defines the schema of the response when
// creating a enable_rescue server action.
type ServerActionEnableRescueResponse struct {
Action Action `json:"action"`
RootPassword string `json:"root_password"`
}
// ServerActionDisableRescueRequest defines the schema for the request to
// create a disable_rescue server action.
type ServerActionDisableRescueRequest struct{}
// ServerActionDisableRescueResponse defines the schema of the response when
// creating a disable_rescue server action.
type ServerActionDisableRescueResponse struct {
Action Action `json:"action"`
}
// ServerActionRebuildRequest defines the schema for the request to
// rebuild a server.
type ServerActionRebuildRequest struct {
Image interface{} `json:"image"` // int or string
}
// ServerActionRebuildResponse defines the schema of the response when
// creating a rebuild server action.
type ServerActionRebuildResponse struct {
Action Action `json:"action"`
RootPassword *string `json:"root_password"`
}
// ServerActionAttachISORequest defines the schema for the request to
// attach an ISO to a server.
type ServerActionAttachISORequest struct {
ISO interface{} `json:"iso"` // int or string
}
// ServerActionAttachISOResponse defines the schema of the response when
// creating a attach_iso server action.
type ServerActionAttachISOResponse struct {
Action Action `json:"action"`
}
// ServerActionDetachISORequest defines the schema for the request to
// detach an ISO from a server.
type ServerActionDetachISORequest struct{}
// ServerActionDetachISOResponse defines the schema of the response when
// creating a detach_iso server action.
type ServerActionDetachISOResponse struct {
Action Action `json:"action"`
}
// ServerActionEnableBackupRequest defines the schema for the request to
// enable backup for a server.
type ServerActionEnableBackupRequest struct {
BackupWindow *string `json:"backup_window,omitempty"`
}
// ServerActionEnableBackupResponse defines the schema of the response when
// creating a enable_backup server action.
type ServerActionEnableBackupResponse struct {
Action Action `json:"action"`
}
// ServerActionDisableBackupRequest defines the schema for the request to
// disable backup for a server.
type ServerActionDisableBackupRequest struct{}
// ServerActionDisableBackupResponse defines the schema of the response when
// creating a disable_backup server action.
type ServerActionDisableBackupResponse struct {
Action Action `json:"action"`
}
// ServerActionChangeTypeRequest defines the schema for the request to
// change a server's type.
type ServerActionChangeTypeRequest struct {
ServerType interface{} `json:"server_type"` // int or string
UpgradeDisk bool `json:"upgrade_disk"`
}
// ServerActionChangeTypeResponse defines the schema of the response when
// creating a change_type server action.
type ServerActionChangeTypeResponse struct {
Action Action `json:"action"`
}
// ServerActionChangeDNSPtrRequest defines the schema for the request to
// change a server's reverse DNS pointer.
type ServerActionChangeDNSPtrRequest struct {
IP string `json:"ip"`
DNSPtr *string `json:"dns_ptr"`
}
// ServerActionChangeDNSPtrResponse defines the schema of the response when
// creating a change_dns_ptr server action.
type ServerActionChangeDNSPtrResponse struct {
Action Action `json:"action"`
}
// ServerActionChangeProtectionRequest defines the schema of the request to
// change the resource protection of a server.
type ServerActionChangeProtectionRequest struct {
Rebuild *bool `json:"rebuild,omitempty"`
Delete *bool `json:"delete,omitempty"`
}
// ServerActionChangeProtectionResponse defines the schema of the response when
// changing the resource protection of a server.
type ServerActionChangeProtectionResponse struct {
Action Action `json:"action"`
}
// ServerActionRequestConsoleRequest defines the schema of the request to
// request a WebSocket VNC console.
type ServerActionRequestConsoleRequest struct{}
// ServerActionRequestConsoleResponse defines the schema of the response when
// requesting a WebSocket VNC console.
type ServerActionRequestConsoleResponse struct {
Action Action `json:"action"`
WSSURL string `json:"wss_url"`
Password string `json:"password"`
}
// ServerActionAttachToNetworkRequest defines the schema for the request to
// attach a network to a server.
type ServerActionAttachToNetworkRequest struct {
Network int64 `json:"network"`
IP *string `json:"ip,omitempty"`
AliasIPs []*string `json:"alias_ips,omitempty"`
}
// ServerActionAttachToNetworkResponse defines the schema of the response when
// creating an attach_to_network server action.
type ServerActionAttachToNetworkResponse struct {
Action Action `json:"action"`
}
// ServerActionDetachFromNetworkRequest defines the schema for the request to
// detach a network from a server.
type ServerActionDetachFromNetworkRequest struct {
Network int64 `json:"network"`
}
// ServerActionDetachFromNetworkResponse defines the schema of the response when
// creating a detach_from_network server action.
type ServerActionDetachFromNetworkResponse struct {
Action Action `json:"action"`
}
// ServerActionChangeAliasIPsRequest defines the schema for the request to
// change a server's alias IPs in a network.
type ServerActionChangeAliasIPsRequest struct {
Network int64 `json:"network"`
AliasIPs []string `json:"alias_ips"`
}
// ServerActionChangeAliasIPsResponse defines the schema of the response when
// creating an change_alias_ips server action.
type ServerActionChangeAliasIPsResponse struct {
Action Action `json:"action"`
}
// ServerGetMetricsResponse defines the schema of the response when requesting
// metrics for a server.
type ServerGetMetricsResponse struct {
Metrics struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
Step float64 `json:"step"`
TimeSeries map[string]ServerTimeSeriesVals `json:"time_series"`
} `json:"metrics"`
}
// ServerTimeSeriesVals contains the values for a Server time series.
type ServerTimeSeriesVals struct {
Values []interface{} `json:"values"`
}
// ServerActionAddToPlacementGroupRequest defines the schema for the request to
// add a server to a placement group.
type ServerActionAddToPlacementGroupRequest struct {
PlacementGroup int64 `json:"placement_group"`
}
// ServerActionAddToPlacementGroupResponse defines the schema of the response when
// creating an add_to_placement_group server action.
type ServerActionAddToPlacementGroupResponse struct {
Action Action `json:"action"`
}
// ServerActionRemoveFromPlacementGroupResponse defines the schema of the response when
// creating a remove_from_placement_group server action.
type ServerActionRemoveFromPlacementGroupResponse struct {
Action Action `json:"action"`
}
|