-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvm.go
More file actions
50 lines (44 loc) · 1.3 KB
/
vm.go
File metadata and controls
50 lines (44 loc) · 1.3 KB
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
package main
import (
"time"
)
type VMConfig struct {
TemplateID string `yaml:"template_id"`
InstanceType string `yaml:"instance_type"`
Quota int `yaml:"quota"`
User string `yaml:"user"`
}
type VMsConfig struct {
AvailableVMs map[string]VMConfig `yaml:"vms"`
}
// VM represents a virtual machine instance
type VM struct {
ID string `json:"id"`
ExoscaleID string `json:"exoscaleId"`
Name string `json:"name"`
IP string `json:"ip"`
Busy bool `json:"busy"`
UserID string `json:"userId"`
CreatedAt time.Time `json:"created_at,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Status string `json:"status,omitempty"`
}
// VMCreationResponse is the response to a VM creation request
type VMCreationResponse struct {
VMID string `json:"vmId"`
ExoscaleID string `json:"exoscaleId"`
RequestID string `json:"requestId"`
UserID string `json:"userId"`
Name string `json:"name"`
IP string `json:"ip"`
ExpiresAt int64 `json:"expiresAt"`
Status string `json:"status"`
}
// VMStatus constants
const (
VMStatusActive = "active"
VMStatusCreating = "creating"
VMStatusPendingDeletion = "pending_deletion"
VMStatusDeleted = "deleted"
VMStatusFailed = "failed"
)