forked from canonical/lxd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.go
64 lines (53 loc) · 1.68 KB
/
image.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
54
55
56
57
58
59
60
61
62
63
64
package shared
import (
"time"
)
type ImageProperties map[string]string
type ImageAliasesEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Target string `json:"target"`
}
type ImageAliases []ImageAliasesEntry
type ImageAlias struct {
Name string `json:"name"`
Description string `json:"description"`
}
type ImageSource struct {
Server string `json:"server"`
Protocol string `json:"protocol"`
Certificate string `json:"certificate"`
Alias string `json:"alias"`
}
type ImageInfo struct {
Aliases []ImageAlias `json:"aliases"`
Architecture string `json:"architecture"`
Cached bool `json:"cached"`
Filename string `json:"filename"`
Fingerprint string `json:"fingerprint"`
Properties map[string]string `json:"properties"`
Public bool `json:"public"`
Size int64 `json:"size"`
AutoUpdate bool `json:"auto_update"`
Source *ImageSource `json:"update_source,omitempty"`
CreationDate time.Time `json:"created_at"`
ExpiryDate time.Time `json:"expires_at"`
LastUsedDate time.Time `json:"last_used_at"`
UploadDate time.Time `json:"uploaded_at"`
}
/*
* BriefImageInfo contains a subset of the fields in
* ImageInfo, namely those which a user may update
*/
type BriefImageInfo struct {
AutoUpdate bool `json:"auto_update"`
Properties map[string]string `json:"properties"`
Public bool `json:"public"`
}
func (i *ImageInfo) Brief() BriefImageInfo {
retstate := BriefImageInfo{
AutoUpdate: i.AutoUpdate,
Properties: i.Properties,
Public: i.Public}
return retstate
}