/
formatted.go
70 lines (61 loc) · 3.21 KB
/
formatted.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
65
66
67
68
69
70
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package resource
import "time"
// FormattedCharmResource holds the formatted representation of a resource's info.
type FormattedCharmResource struct {
// These fields are exported for the sake of serialization.
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Path string `json:"path" yaml:"path"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Revision int `json:"revision,omitempty" yaml:"revision,omitempty"`
Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
Size int64 `json:"size" yaml:"size"`
Origin string `json:"origin" yaml:"origin"`
}
// FormattedApplicationInfo holds the formatted representation of the information
// about an application's resources.
type FormattedApplicationInfo struct {
Resources []FormattedAppResource `json:"resources,omitempty" yaml:"resources,omitempty"`
Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"`
}
// FormattedAppResource holds the formatted representation of a resource's info.
type FormattedAppResource struct {
// These fields are exported for the sake of serialization.
ID string `json:"resourceid,omitempty" yaml:"resourceid,omitempty"`
ApplicationID string `json:"applicationId,omitempty" yaml:"applicationId,omitempty"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Path string `json:"path" yaml:"path"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Revision string `json:"revision,omitempty" yaml:"revision,omitempty"`
Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
Size int64 `json:"size" yaml:"size"`
Origin string `json:"origin" yaml:"origin"`
Used bool `json:"used" yaml:"used"`
Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
CombinedRevision string `json:"-"`
UsedYesNo string `json:"-"`
CombinedOrigin string `json:"-"`
}
// FormattedDetailResource is the data for a single line of tabular output for
// juju resources <application> --details.
type FormattedDetailResource struct {
UnitID string `json:"unitID" yaml:"unitID"`
Unit FormattedAppResource `json:"unit" yaml:"unit"`
Expected FormattedAppResource `json:"expected" yaml:"expected"`
Progress int64 `json:"progress,omitempty" yaml:"progress,omitempty"`
UnitNumber int `json:"-"`
RevProgress string `json:"-"`
}
// FormattedApplicationDetails is the data for the tabular output for juju resources
// <application> --details.
type FormattedApplicationDetails struct {
Resources []FormattedDetailResource `json:"resources,omitempty" yaml:"resources,omitempty"`
Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"`
}
// FormattedDetailResource is the data for the tabular output for juju resources
// <unit> --details.
type FormattedUnitDetails []FormattedDetailResource