~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/lxc/lxd/shared/image.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package shared
 
2
 
 
3
import (
 
4
        "time"
 
5
)
 
6
 
 
7
type ImageProperties map[string]string
 
8
 
 
9
type ImageAliasesEntry struct {
 
10
        Name        string `json:"name"`
 
11
        Description string `json:"description"`
 
12
        Target      string `json:"target"`
 
13
}
 
14
 
 
15
type ImageAliases []ImageAliasesEntry
 
16
 
 
17
type ImageAlias struct {
 
18
        Name        string `json:"name"`
 
19
        Description string `json:"description"`
 
20
}
 
21
 
 
22
type ImageSource struct {
 
23
        Server      string `json:"server"`
 
24
        Protocol    string `json:"protocol"`
 
25
        Certificate string `json:"certificate"`
 
26
        Alias       string `json:"alias"`
 
27
}
 
28
 
 
29
type ImageInfo struct {
 
30
        Aliases      []ImageAlias      `json:"aliases"`
 
31
        Architecture string            `json:"architecture"`
 
32
        Cached       bool              `json:"cached"`
 
33
        Filename     string            `json:"filename"`
 
34
        Fingerprint  string            `json:"fingerprint"`
 
35
        Properties   map[string]string `json:"properties"`
 
36
        Public       bool              `json:"public"`
 
37
        Size         int64             `json:"size"`
 
38
 
 
39
        AutoUpdate bool         `json:"auto_update"`
 
40
        Source     *ImageSource `json:"update_source,omitempty"`
 
41
 
 
42
        CreationDate time.Time `json:"created_at"`
 
43
        ExpiryDate   time.Time `json:"expires_at"`
 
44
        LastUsedDate time.Time `json:"last_used_at"`
 
45
        UploadDate   time.Time `json:"uploaded_at"`
 
46
}
 
47
 
 
48
/*
 
49
 * BriefImageInfo contains a subset of the fields in
 
50
 * ImageInfo, namely those which a user may update
 
51
 */
 
52
type BriefImageInfo struct {
 
53
        AutoUpdate bool              `json:"auto_update"`
 
54
        Properties map[string]string `json:"properties"`
 
55
        Public     bool              `json:"public"`
 
56
}
 
57
 
 
58
func (i *ImageInfo) Brief() BriefImageInfo {
 
59
        retstate := BriefImageInfo{
 
60
                AutoUpdate: i.AutoUpdate,
 
61
                Properties: i.Properties,
 
62
                Public:     i.Public}
 
63
        return retstate
 
64
}