-
Notifications
You must be signed in to change notification settings - Fork 59
/
charmbase.go
72 lines (61 loc) · 1.88 KB
/
charmbase.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
// Copyright 2021 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package charm
// charmBase implements the Charm interface with commonality between
// a charm archive and directory.
type charmBase struct {
meta *Meta
config *Config
metrics *Metrics
actions *Actions
lxdProfile *LXDProfile
manifest *Manifest
revision int
version string
}
// Revision returns the revision number for the charm
// expanded in dir.
func (c *charmBase) Revision() int {
return c.revision
}
// Version returns the VCS version representing the version file from archive.
func (c *charmBase) Version() string {
return c.version
}
// Meta returns the Meta representing the metadata.yaml file
// for the charm expanded in dir.
func (c *charmBase) Meta() *Meta {
return c.meta
}
// Config returns the Config representing the config.yaml file
// for the charm expanded in dir.
func (c *charmBase) Config() *Config {
return c.config
}
// Metrics returns the Metrics representing the metrics.yaml file
// for the charm expanded in dir.
func (c *charmBase) Metrics() *Metrics {
return c.metrics
}
// Actions returns the Actions representing the actions.yaml file
// for the charm expanded in dir.
func (c *charmBase) Actions() *Actions {
return c.actions
}
// LXDProfile returns the LXDProfile representing the lxd-profile.yaml file
// for the charm expanded in dir.
func (c *charmBase) LXDProfile() *LXDProfile {
return c.lxdProfile
}
// Manifest returns the Manifest representing the manifest.yaml file
// for the charm expanded in dir.
func (c *charmBase) Manifest() *Manifest {
return c.manifest
}
// SetRevision changes the charm revision number. This affects
// the revision reported by Revision and the revision of the
// charm created.
// The revision file in the charm directory is not modified.
func (c *charmBase) SetRevision(revision int) {
c.revision = revision
}