/
types.go
173 lines (154 loc) · 4.35 KB
/
types.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package base
import (
"time"
"github.com/juju/version/v2"
"github.com/juju/juju/core/instance"
"github.com/juju/juju/core/life"
"github.com/juju/juju/core/model"
"github.com/juju/juju/core/status"
)
// UserModel holds information about a model and the last
// time the model was accessed for a particular user. This is a client
// side structure that translates the owner tag into a user facing string.
type UserModel struct {
Name string
UUID string
Type model.ModelType
Owner string
LastConnection *time.Time
}
// ModelStatus holds information about the status of a juju model.
type ModelStatus struct {
UUID string
Life life.Value
ModelType model.ModelType
Owner string
TotalMachineCount int
CoreCount int
HostedMachineCount int
ApplicationCount int
UnitCount int
Applications []Application
Machines []Machine
Volumes []Volume
Filesystems []Filesystem
Error error
}
// Machine holds information about a machine in a juju model.
type Machine struct {
Id string
InstanceId string
DisplayName string
HasVote bool
WantsVote bool
Status string
Message string
Hardware *instance.HardwareCharacteristics
// HAPrimary indicates whether this machine has a primary mongo instance in replicaset and,
// thus, can be considered a primary controller machine in HA setup.
HAPrimary *bool
}
// Application holds information about an application in a juju model.
type Application struct {
Name string
}
// ModelInfo holds information about a model.
type ModelInfo struct {
Name string
UUID string
Type model.ModelType
ControllerUUID string
IsController bool
ProviderType string
DefaultSeries string
Cloud string
CloudRegion string
CloudCredential string
Owner string
Life life.Value
Status Status
Users []UserInfo
Machines []Machine
AgentVersion *version.Number
}
// Status represents the status of a machine, application, or unit.
type Status struct {
Status status.Status
Info string
Data map[string]interface{}
Since *time.Time
}
// UserInfo holds information about a user in a juju model.
type UserInfo struct {
UserName string
DisplayName string
LastConnection *time.Time
Access string
}
// Volume holds information about a volume in a juju model.
type Volume struct {
Id string
ProviderId string
Status string
Message string
Detachable bool
}
// Filesystem holds information about a filesystem in a juju model.
type Filesystem struct {
Id string
ProviderId string
Status string
Message string
Detachable bool
}
// UserModelSummary holds summary about a model for a user.
type UserModelSummary struct {
Name string
UUID string
Type model.ModelType
ControllerUUID string
IsController bool
ProviderType string
DefaultSeries string
Cloud string
CloudRegion string
CloudCredential string
Owner string
Life life.Value
Status Status
ModelUserAccess string
UserLastConnection *time.Time
Counts []EntityCount
AgentVersion *version.Number
Error error
Migration *MigrationSummary
SLA *SLASummary
}
// EntityCount holds a count for a particular entity, for example machines or core count.
type EntityCount struct {
Entity string
Count int64
}
// MigrationSummary holds information about a current migration attempt
// if there is one on progress.
type MigrationSummary struct {
Status string
StartTime *time.Time
EndTime *time.Time
}
// SLASummary holds information about SLA.
type SLASummary struct {
Level string
Owner string
}
// StoredCredential contains information about the cloud credential stored on the controller
// and used by models.
type StoredCredential struct {
// CloudCredential is a cloud credential id that identifies cloud credential on the controller.
// The value is what CloudCredentialTag.Id() returns.
CloudCredential string
// Valid is a flag that indicates whether the credential is valid.
Valid bool
}