-
Notifications
You must be signed in to change notification settings - Fork 2
/
container_snapshot.go
53 lines (44 loc) · 2.23 KB
/
container_snapshot.go
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
package api
import (
"time"
)
// ContainerSnapshotsPost represents the fields available for a new LXD container snapshot
type ContainerSnapshotsPost struct {
Name string `json:"name" yaml:"name"`
Stateful bool `json:"stateful" yaml:"stateful"`
// API extension: snapshot_expiry_creation
ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`
}
// ContainerSnapshotPost represents the fields required to rename/move a LXD container snapshot
type ContainerSnapshotPost struct {
Name string `json:"name" yaml:"name"`
Migration bool `json:"migration" yaml:"migration"`
Target *ContainerPostTarget `json:"target" yaml:"target"`
// API extension: container_snapshot_stateful_migration
Live bool `json:"live,omitempty" yaml:"live,omitempty"`
}
// ContainerSnapshotPut represents the modifiable fields of a LXD container snapshot
// API extension: snapshot_expiry
type ContainerSnapshotPut struct {
Architecture string `json:"architecture" yaml:"architecture"`
Config map[string]string `json:"config" yaml:"config"`
Devices map[string]map[string]string `json:"devices" yaml:"devices"`
Ephemeral bool `json:"ephemeral" yaml:"ephemeral"`
Profiles []string `json:"profiles" yaml:"profiles"`
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
}
// ContainerSnapshot represents a LXD conainer snapshot
type ContainerSnapshot struct {
ContainerSnapshotPut `yaml:",inline"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
ExpandedConfig map[string]string `json:"expanded_config" yaml:"expanded_config"`
ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`
Name string `json:"name" yaml:"name"`
Stateful bool `json:"stateful" yaml:"stateful"`
}
// Writable converts a full ContainerSnapshot struct into a ContainerSnapshotPut struct
// (filters read-only fields)
func (c *ContainerSnapshot) Writable() ContainerSnapshotPut {
return c.ContainerSnapshotPut
}