-
Notifications
You must be signed in to change notification settings - Fork 23
/
interfaces.go
359 lines (310 loc) · 8.05 KB
/
interfaces.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
// Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package description
import (
"time"
"github.com/juju/names/v5"
"github.com/juju/version/v2"
)
// AgentTools represent the version and related binary file
// that the machine and unit agents are using.
type AgentTools interface {
Version() version.Binary
URL() string
SHA256() string
Size() int64
}
// Space represents a network space, which is a named collection of subnets.
type Space interface {
Id() string
Name() string
Public() bool
ProviderID() string
}
// LinkLayerDevice represents a link layer device.
type LinkLayerDevice interface {
Name() string
MTU() uint
ProviderID() string
MachineID() string
Type() string
MACAddress() string
IsAutoStart() bool
IsUp() bool
ParentName() string
VirtualPortType() string
}
// IPAddress represents an IP address.
type IPAddress interface {
ProviderID() string
DeviceName() string
MachineID() string
SubnetCIDR() string
ConfigMethod() string
Value() string
DNSServers() []string
DNSSearchDomains() []string
GatewayAddress() string
IsDefaultGateway() bool
ProviderNetworkID() string
ProviderSubnetID() string
Origin() string
IsShadow() bool
IsSecondary() bool
}
// SSHHostKey represents an ssh host key.
type SSHHostKey interface {
MachineID() string
Keys() []string
}
// CloudImageMetadata represents an IP cloudimagemetadata.
type CloudImageMetadata interface {
Stream() string
Region() string
Version() string
Arch() string
VirtType() string
RootStorageType() string
RootStorageSize() (uint64, bool)
DateCreated() int64
Source() string
Priority() int
ImageId() string
ExpireAt() *time.Time
}
// Volume represents a volume (disk, logical volume, etc.) in the model.
type Volume interface {
HasStatus
HasStatusHistory
Tag() names.VolumeTag
Storage() names.StorageTag
Provisioned() bool
Size() uint64
Pool() string
HardwareID() string
WWN() string
VolumeID() string
Persistent() bool
Attachments() []VolumeAttachment
AttachmentPlans() []VolumeAttachmentPlan
AddAttachment(VolumeAttachmentArgs) VolumeAttachment
AddAttachmentPlan(VolumeAttachmentPlanArgs) VolumeAttachmentPlan
}
// VolumeAttachment represents a volume attached to a machine.
type VolumeAttachment interface {
Host() names.Tag
Provisioned() bool
ReadOnly() bool
DeviceName() string
DeviceLink() string
BusAddress() string
VolumePlanInfo() VolumePlanInfo
}
type VolumeAttachmentPlan interface {
Machine() names.MachineTag
BlockDevice() BlockDevice
VolumePlanInfo() VolumePlanInfo
}
type VolumePlanInfo interface {
DeviceType() string
DeviceAttributes() map[string]string
}
// Filesystem represents a filesystem in the model.
type Filesystem interface {
HasStatus
HasStatusHistory
Tag() names.FilesystemTag
Volume() names.VolumeTag
Storage() names.StorageTag
Provisioned() bool
Size() uint64
Pool() string
FilesystemID() string
Attachments() []FilesystemAttachment
AddAttachment(FilesystemAttachmentArgs) FilesystemAttachment
}
// FilesystemAttachment represents a filesystem attached to a machine.
type FilesystemAttachment interface {
Host() names.Tag
Provisioned() bool
MountPoint() string
ReadOnly() bool
}
// Storage represents the state of a unit or application-wide storage instance
// in the model.
type Storage interface {
Tag() names.StorageTag
Kind() string
// Owner returns the tag of the application or unit that owns this storage
// instance.
Owner() (names.Tag, error)
Name() string
Attachments() []names.UnitTag
// Constraints returns the storage instance constraints, and a boolean
// reporting whether there are any.
Constraints() (StorageInstanceConstraints, bool)
Validate() error
}
// StoragePool represents a named storage pool and its settings.
type StoragePool interface {
Name() string
Provider() string
Attributes() map[string]interface{}
}
// StorageDirective represents the user-specified storage directive for
// provisioning storage instances for an application unit.
type StorageDirective interface {
// Pool is the name of the storage pool from which to provision the
// storage instances.
Pool() string
// Size is the required size of the storage instances, in MiB.
Size() uint64
// Count is the required number of storage instances.
Count() uint64
}
// StorageInstanceConstraints represents the user-specified constraints
// for provisioning a single storage instance for an application unit.
type StorageInstanceConstraints struct {
Pool string
Size uint64
}
// Subnet represents a network subnet.
type Subnet interface {
ID() string
ProviderId() string
ProviderNetworkId() string
ProviderSpaceId() string
CIDR() string
VLANTag() int
AvailabilityZones() []string
IsPublic() bool
SpaceID() string
SpaceName() string
FanLocalUnderlay() string
FanOverlay() string
}
// FirewallRule represents a firewall ruleset for a known service type, with
// whitelist CIDRs.
type FirewallRule interface {
ID() string
WellKnownService() string
WhitelistCIDRs() []string
}
// CharmOrigin represents a charm source, where the charm originates from to
// help support multiple store locations.
type CharmOrigin interface {
Source() string
ID() string
Hash() string
Revision() int
Channel() string
Platform() string
}
// CharmMetadata represents the metadata of a charm.
type CharmMetadata interface {
Name() string
Summary() string
Description() string
Subordinate() bool
MinJujuVersion() string
RunAs() string
Assumes() string
Provides() map[string]CharmMetadataRelation
Requires() map[string]CharmMetadataRelation
Peers() map[string]CharmMetadataRelation
ExtraBindings() map[string]string
Categories() []string
Tags() []string
Storage() map[string]CharmMetadataStorage
Devices() map[string]CharmMetadataDevice
Payloads() map[string]CharmMetadataPayload
Resources() map[string]CharmMetadataResource
Terms() []string
Containers() map[string]CharmMetadataContainer
}
// CharmMetadataRelation represents a relation in the metadata of a charm.
type CharmMetadataRelation interface {
Name() string
Role() string
Interface() string
Optional() bool
Limit() int
Scope() string
}
// CharmMetadataStorage represents a storage in the metadata of a charm.
type CharmMetadataStorage interface {
Name() string
Description() string
Type() string
Shared() bool
Readonly() bool
CountMin() int
CountMax() int
MinimumSize() int
Location() string
Properties() []string
}
// CharmMetadataDevice represents a device in the metadata of a charm.
type CharmMetadataDevice interface {
Name() string
Description() string
Type() string
CountMin() int
CountMax() int
}
// CharmMetadataPayload represents a payload in the metadata of a charm.
type CharmMetadataPayload interface {
Name() string
Type() string
}
// CharmMetadataResource represents a resource in the metadata of a charm.
type CharmMetadataResource interface {
Name() string
Type() string
Path() string
Description() string
}
// CharmMetadataContainer represents a container in the metadata of a charm.
type CharmMetadataContainer interface {
Resource() string
Mounts() []CharmMetadataContainerMount
Uid() *int
Gid() *int
}
// CharmMetadataContainerMount represents a mount in the metadata of a charm
// container.
type CharmMetadataContainerMount interface {
Storage() string
Location() string
}
// CharmManifest represents the manifest of a charm.
type CharmManifest interface {
Bases() []CharmManifestBase
}
// CharmManifestBase represents the metadata of a charm base.
type CharmManifestBase interface {
Name() string
Channel() string
Architectures() []string
}
// CharmActions represents the actions of a charm.
type CharmActions interface {
Actions() map[string]CharmAction
}
// CharmAction represents an action in the metadata of a charm.
type CharmAction interface {
Description() string
Parallel() bool
ExecutionGroup() string
Parameters() map[string]interface{}
}
// CharmConfigs represents the configuration of a charm.
type CharmConfigs interface {
Configs() map[string]CharmConfig
}
// CharmConfig represents the configuration of a charm.
type CharmConfig interface {
Type() string
Default() interface{}
Description() string
}