Documentation ¶
Index ¶
- Variables
- func IsBuiltinMetric(key string) bool
- func IsCharmDir(path string) bool
- func IsMissingSeriesError(err error) bool
- func IsUnsupportedSeriesError(err error) bool
- func IsValidName(name string) bool
- func IsValidSeries(series string) bool
- func NewUnsupportedSeriesError(requestedSeries string, supportedSeries []string) error
- func Quote(unsafe string) string
- func SeriesForCharm(requestedSeries string, supportedSeries []string) (string, error)
- func ValidateName(name string) error
- func ValidateSchema(schema string) error
- func ValidateSeries(series string) error
- type ActionSpec
- type Actions
- type ApplicationSpec
- type Bundle
- type BundleArchive
- type BundleData
- func (bd *BundleData) RequiredCharms() []string
- func (bd *BundleData) SetBSON(raw bson.Raw) error
- func (bd *BundleData) UnmarshalJSON(b []byte) error
- func (bd *BundleData) UnmarshalYAML(f func(interface{}) error) error
- func (d *BundleData) UnmarshaledWithServices() bool
- func (bd *BundleData) Verify(verifyConstraints func(c string) error, verifyStorage func(s string) error) error
- func (bd *BundleData) VerifyLocal(bundleDir string, verifyConstraints func(c string) error, ...) error
- func (bd *BundleData) VerifyWithCharms(verifyConstraints func(c string) error, verifyStorage func(s string) error, ...) error
- type BundleDir
- type Charm
- type CharmArchive
- func (a *CharmArchive) Actions() *Actions
- func (a *CharmArchive) Config() *Config
- func (a *CharmArchive) ExpandTo(dir string) error
- func (a *CharmArchive) Manifest() (set.Strings, error)
- func (a *CharmArchive) Meta() *Meta
- func (a *CharmArchive) Metrics() *Metrics
- func (a *CharmArchive) Revision() int
- func (a *CharmArchive) SetRevision(revision int)
- type CharmDir
- func (dir *CharmDir) Actions() *Actions
- func (dir *CharmDir) ArchiveTo(w io.Writer) error
- func (dir *CharmDir) Config() *Config
- func (dir *CharmDir) Meta() *Meta
- func (dir *CharmDir) Metrics() *Metrics
- func (dir *CharmDir) Revision() int
- func (dir *CharmDir) SetDiskRevision(revision int) error
- func (dir *CharmDir) SetRevision(revision int)
- type Config
- func (c *Config) DefaultSettings() Settings
- func (c *Config) FilterSettings(settings Settings) Settings
- func (c *Config) ParseSettingsStrings(values map[string]string) (Settings, error)
- func (c *Config) ParseSettingsYAML(yamlData []byte, key string) (Settings, error)
- func (c *Config) ValidateSettings(settings Settings) (Settings, error)
- type ExtraBinding
- type Location
- type MachineSpec
- type Meta
- type Metric
- type MetricType
- type Metrics
- type Option
- type PayloadClass
- type Plan
- type Relation
- type RelationRole
- type RelationScope
- type Settings
- type Storage
- type StorageType
- type TermsId
- type URL
- func (u *URL) GetBSON() (interface{}, error)
- func (u *URL) MarshalJSON() ([]byte, error)
- func (u *URL) MarshalText() ([]byte, error)
- func (r URL) Path() string
- func (u *URL) SetBSON(raw bson.Raw) error
- func (u URL) String() string
- func (u *URL) UnmarshalJSON(b []byte) error
- func (u *URL) UnmarshalText(data []byte) error
- func (url *URL) WithRevision(revision int) *URL
- type UnitPlacement
- type VerificationError
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnresolvedUrl error = fmt.Errorf("charm or bundle url series is not resolved")
)
Functions ¶
func IsBuiltinMetric ¶
IsBuiltinMetric reports whether the given metric key is in the builtin metric namespace
func IsCharmDir ¶
IsCharmDir report whether the path is likely to represent a charm, even it may be incomplete.
func IsMissingSeriesError ¶
IsMissingSeriesError returns true if err is an missingSeriesError.
func IsUnsupportedSeriesError ¶
IsUnsupportedSeriesError returns true if err is an UnsupportedSeriesError.
func IsValidName ¶
IsValidName reports whether name is a valid charm or bundle name.
func IsValidSeries ¶
IsValidSeries reports whether series is a valid series in charm or bundle URLs.
func NewUnsupportedSeriesError ¶
NewUnsupportedSeriesError returns an error indicating that the requested series is not supported by a charm.
func Quote ¶
Quote translates a charm url string into one which can be safely used in a file path. ASCII letters, ASCII digits, dot and dash stay the same; other characters are translated to their hex representation surrounded by underscores.
func SeriesForCharm ¶
SeriesForCharm takes a requested series and a list of series supported by a charm and returns the series which is relevant. If the requested series is empty, then the first supported series is used, otherwise the requested series is validated against the supported series.
func ValidateName ¶
ValidateName returns an error if the given name is invalid.
func ValidateSchema ¶
ValidateSchema returns an error if the schema is invalid.
func ValidateSeries ¶
ValidateSeries returns an error if the given series is invalid.
Types ¶
type ActionSpec ¶
ActionSpec is a definition of the parameters and traits of an Action. The Params map is expected to conform to JSON-Schema Draft 4 as defined at http://json-schema.org/draft-04/schema# (see http://json-schema.org/latest/json-schema-core.html)
func (*ActionSpec) InsertDefaults ¶
func (spec *ActionSpec) InsertDefaults(target map[string]interface{}) (map[string]interface{}, error)
InsertDefaults inserts the schema's default values in target using github.com/juju/gojsonschema. If a nil target is received, an empty map will be created as the target. The target is then mutated to include the defaults.
The returned map will be the transformed or created target map.
func (*ActionSpec) ValidateParams ¶
func (spec *ActionSpec) ValidateParams(params map[string]interface{}) error
ValidateParams validates the passed params map against the given ActionSpec and returns any error encountered. Usage:
err := ch.Actions().ActionSpecs["snapshot"].ValidateParams(someMap)
type Actions ¶
type Actions struct {
ActionSpecs map[string]ActionSpec `yaml:"actions,omitempty" bson:",omitempty"`
}
Actions defines the available actions for the charm. Additional params may be added as metadata at a future time (e.g. version.)
type ApplicationSpec ¶
type ApplicationSpec struct { // Charm holds the charm URL of the charm to // use for the given application. Charm string // Series is the series to use when deploying a local charm, // if the charm does not specify a default or the default // is not the desired value. // Series is not compatible with charm store charms where // the series is specified in the URL. Series string `bson:",omitempty" yaml:",omitempty" json:",omitempty"` // Resources is the set of resource revisions to deploy for the // application. Bundles only support charm store resources and not ones // that were uploaded to the controller. Resources map[string]interface{} `bson:",omitempty" yaml:",omitempty" json:",omitempty"` // NumUnits holds the number of units of the // application that will be deployed. // // For a subordinate application, this actually represents // an arbitrary number of units depending on // the application it is related to. NumUnits int `bson:",omitempty" yaml:"num_units,omitempty" json:",omitempty"` // To may hold up to NumUnits members with // each member specifying a desired placement // for the respective unit of the application. // // In regular-expression-like notation, each // element matches the following pattern: // // (<containertype>:)?(<unit>|<machine>|new) // // If containertype is specified, the unit is deployed // into a new container of that type, otherwise // it will be "hulk-smashed" into the specified location, // by co-locating it with any other units that happen to // be there, which may result in unintended behavior. // // The second part (after the colon) specifies where // the new unit should be placed - it may refer to // a unit of another application specified in the bundle, // a machine id specified in the machines section, // or the special name "new" which specifies a newly // created machine. // // A unit placement may be specified with an application name only, // in which case its unit number is assumed to // be one more than the unit number of the previous // unit in the list with the same application, or zero // if there were none. // // If there are less elements in To than NumUnits, // the last element is replicated to fill it. If there // are no elements (or To is omitted), "new" is replicated. // // For example: // // wordpress/0 wordpress/1 lxc:0 kvm:new // // specifies that the first two units get hulk-smashed // onto the first two units of the wordpress application, // the third unit gets allocated onto an lxc container // on machine 0, and subsequent units get allocated // on kvm containers on new machines. // // The above example is the same as this: // // wordpress wordpress lxc:0 kvm:new To []string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Expose holds whether the application must be exposed. Expose bool `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Options holds the configuration values // to apply to the new application. They should // be compatible with the charm configuration. Options map[string]interface{} `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Annotations holds any annotations to apply to the // application when deployed. Annotations map[string]string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Constraints holds the default constraints to apply // when creating new machines for units of the application. // This is ignored for units with explicit placement directives. Constraints string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Storage holds the constraints for storage to assign // to units of the application. Storage map[string]string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // EndpointBindings maps how endpoints are bound to spaces EndpointBindings map[string]string `bson:"bindings,omitempty" json:"bindings,omitempty" yaml:"bindings,omitempty"` }
ApplicationSpec represents a single application that will be deployed as part of the bundle.
type Bundle ¶
type Bundle interface { // Data returns the contents of the bundle's bundle.yaml file. Data() *BundleData // Data returns the contents of the bundle's README.md file. ReadMe() string }
The Bundle interface is implemented by any type that may be handled as a bundle. It encapsulates all the data of a bundle.
func ReadBundle ¶
ReadBundle reads a Bundle from path, which can point to either a bundle archive or a bundle directory.
type BundleArchive ¶
type BundleArchive struct { Path string // contains filtered or unexported fields }
func ReadBundleArchive ¶
func ReadBundleArchive(path string) (*BundleArchive, error)
ReadBundleArchive reads a bundle archive from the given file path.
func ReadBundleArchiveBytes ¶
func ReadBundleArchiveBytes(data []byte) (*BundleArchive, error)
ReadBundleArchiveBytes reads a bundle archive from the given byte slice.
func ReadBundleArchiveFromReader ¶
func ReadBundleArchiveFromReader(r io.ReaderAt, size int64) (*BundleArchive, error)
ReadBundleArchiveFromReader returns a BundleArchive that uses r to read the bundle. The given size must hold the number of available bytes in the file.
Note that the caller is responsible for closing r - methods on the returned BundleArchive may fail after that.
func (*BundleArchive) Data ¶
func (a *BundleArchive) Data() *BundleData
Data implements Bundle.Data.
func (*BundleArchive) ExpandTo ¶
func (a *BundleArchive) ExpandTo(dir string) error
ExpandTo expands the bundle archive into dir, creating it if necessary. If any errors occur during the expansion procedure, the process will abort.
func (*BundleArchive) ReadMe ¶
func (a *BundleArchive) ReadMe() string
ReadMe implements Bundle.ReadMe.
type BundleData ¶
type BundleData struct { // Applications holds one entry for each application // that the bundle will create, indexed by // the application name. Applications map[string]*ApplicationSpec `bson:"applications,omitempty" json:"applications,omitempty" yaml:"applications,omitempty"` // Machines holds one entry for each machine referred to // by unit placements. These will be mapped onto actual // machines at bundle deployment time. // It is an error if a machine is specified but // not referred to by a unit placement directive. Machines map[string]*MachineSpec `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Series holds the default series to use when // the bundle chooses charms. Series string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Relations holds a slice of 2-element slices, // each specifying a relation between two applications. // Each two-element slice holds two endpoints, // each specified as either colon-separated // (application, relation) pair or just an application name. // The relation is made between each. If the relation // name is omitted, it will be inferred from the available // relations defined in the applications' charms. Relations [][]string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // White listed set of tags to categorize bundles as we do charms. Tags []string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // Short paragraph explaining what the bundle is useful for. Description string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` // contains filtered or unexported fields }
BundleData holds the contents of the bundle.
func ReadBundleData ¶
func ReadBundleData(r io.Reader) (*BundleData, error)
ReadBundleData reads bundle data from the given reader. The returned data is not verified - call Verify to ensure that it is OK.
func (*BundleData) RequiredCharms ¶
func (bd *BundleData) RequiredCharms() []string
RequiredCharms returns a sorted slice of all the charm URLs required by the bundle.
func (*BundleData) SetBSON ¶
func (bd *BundleData) SetBSON(raw bson.Raw) error
SetBSON implements the bson.Setter interface.
func (*BundleData) UnmarshalJSON ¶
func (bd *BundleData) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*BundleData) UnmarshalYAML ¶
func (bd *BundleData) UnmarshalYAML(f func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
func (*BundleData) UnmarshaledWithServices ¶
func (d *BundleData) UnmarshaledWithServices() bool
UnmarshaledWithServices reports whether the bundle data was unmarshaled from a representation that used the legacy "services" field rather than the "applications" field.
func (*BundleData) Verify ¶
func (bd *BundleData) Verify( verifyConstraints func(c string) error, verifyStorage func(s string) error, ) error
Verify is a convenience method that calls VerifyWithCharms with a nil charms map.
func (*BundleData) VerifyLocal ¶
func (bd *BundleData) VerifyLocal( bundleDir string, verifyConstraints func(c string) error, verifyStorage func(s string) error, ) error
VerifyLocal verifies that a local bundle file is consistent. A local bundle file may contain references to charms which are referred to by a directory, either relative or absolute.
bundleDir is used to construct the full path for charms specified using a relative directory path. The charm path is therefore expected to be relative to the bundle.yaml file.
func (*BundleData) VerifyWithCharms ¶
func (bd *BundleData) VerifyWithCharms( verifyConstraints func(c string) error, verifyStorage func(s string) error, charms map[string]Charm, ) error
VerifyWithCharms verifies that the bundle is consistent. The verifyConstraints function is called to verify any constraints that are found. If verifyConstraints is nil, no checking of constraints will be done. Similarly, a non-nil verifyStorage function is called to verify any storage constraints.
It verifies the following:
- All defined machines are referred to by placement directives. - All applications referred to by placement directives are specified in the bundle. - All applications referred to by relations are specified in the bundle. - All basic constraints are valid. - All storage constraints are valid.
If charms is not nil, it should hold a map with an entry for each charm url returned by bd.RequiredCharms. The verification will then also check that applications are defined with valid charms, relations are correctly made and options are defined correctly.
If the verification fails, Verify returns a *VerificationError describing all the problems found.
type BundleDir ¶
type BundleDir struct { Path string // contains filtered or unexported fields }
func ReadBundleDir ¶
ReadBundleDir returns a BundleDir representing an expanded bundle directory. It does not verify the bundle data.
func (*BundleDir) Data ¶
func (dir *BundleDir) Data() *BundleData
type Charm ¶
type Charm interface { Meta() *Meta Config() *Config Metrics() *Metrics Actions() *Actions Revision() int }
The Charm interface is implemented by any type that may be handled as a charm.
type CharmArchive ¶
type CharmArchive struct { Path string // May be empty if CharmArchive wasn't read from a file // contains filtered or unexported fields }
The CharmArchive type encapsulates access to data and operations on a charm archive.
func ReadCharmArchive ¶
func ReadCharmArchive(path string) (*CharmArchive, error)
ReadCharmArchive returns a CharmArchive for the charm in path.
func ReadCharmArchiveBytes ¶
func ReadCharmArchiveBytes(data []byte) (archive *CharmArchive, err error)
ReadCharmArchiveBytes returns a CharmArchive read from the given data. Make sure the archive fits in memory before using this.
func ReadCharmArchiveFromReader ¶
func ReadCharmArchiveFromReader(r io.ReaderAt, size int64) (archive *CharmArchive, err error)
ReadCharmArchiveFromReader returns a CharmArchive that uses r to read the charm. The given size must hold the number of available bytes in the file.
Note that the caller is responsible for closing r - methods on the returned CharmArchive may fail after that.
func (*CharmArchive) Actions ¶
func (a *CharmArchive) Actions() *Actions
Actions returns the Actions map for the actions.yaml file for the charm archive.
func (*CharmArchive) Config ¶
func (a *CharmArchive) Config() *Config
Config returns the Config representing the config.yaml file for the charm archive.
func (*CharmArchive) ExpandTo ¶
func (a *CharmArchive) ExpandTo(dir string) error
ExpandTo expands the charm archive into dir, creating it if necessary. If any errors occur during the expansion procedure, the process will abort.
func (*CharmArchive) Manifest ¶
func (a *CharmArchive) Manifest() (set.Strings, error)
Manifest returns a set of the charm's contents.
func (*CharmArchive) Meta ¶
func (a *CharmArchive) Meta() *Meta
Meta returns the Meta representing the metadata.yaml file from archive.
func (*CharmArchive) Metrics ¶
func (a *CharmArchive) Metrics() *Metrics
Metrics returns the Metrics representing the metrics.yaml file for the charm archive.
func (*CharmArchive) Revision ¶
func (a *CharmArchive) Revision() int
Revision returns the revision number for the charm expanded in dir.
func (*CharmArchive) SetRevision ¶
func (a *CharmArchive) SetRevision(revision int)
SetRevision changes the charm revision number. This affects the revision reported by Revision and the revision of the charm directory created by ExpandTo.
type CharmDir ¶
type CharmDir struct { Path string // contains filtered or unexported fields }
The CharmDir type encapsulates access to data and operations on a charm directory.
func ReadCharmDir ¶
ReadCharmDir returns a CharmDir representing an expanded charm directory.
func (*CharmDir) Actions ¶
Actions returns the Actions representing the actions.yaml file for the charm expanded in dir.
func (*CharmDir) ArchiveTo ¶
ArchiveTo creates a charm file from the charm expanded in dir. By convention a charm archive should have a ".charm" suffix.
func (*CharmDir) Config ¶
Config returns the Config representing the config.yaml file for the charm expanded in dir.
func (*CharmDir) Meta ¶
Meta returns the Meta representing the metadata.yaml file for the charm expanded in dir.
func (*CharmDir) Metrics ¶
Metrics returns the Metrics representing the metrics.yaml file for the charm expanded in dir.
func (*CharmDir) SetDiskRevision ¶
SetDiskRevision does the same as SetRevision but also changes the revision file in the charm directory.
func (*CharmDir) SetRevision ¶
SetRevision changes the charm revision number. This affects the revision reported by Revision and the revision of the charm archived by ArchiveTo. The revision file in the charm directory is not modified.
type Config ¶
Config represents the supported configuration options for a charm, as declared in its config.yaml file.
func ReadConfig ¶
ReadConfig reads a Config in YAML format.
func (*Config) DefaultSettings ¶
DefaultSettings returns settings containing the default value of every option in the config. Default values may be nil.
func (*Config) FilterSettings ¶
FilterSettings returns the subset of the supplied settings that are valid.
func (*Config) ParseSettingsStrings ¶
ParseSettingsStrings returns settings derived from the supplied map. Every value in the map must be parseable to the correct type for the option identified by its key. Empty values are interpreted as nil.
func (*Config) ParseSettingsYAML ¶
ParseSettingsYAML returns settings derived from the supplied YAML data. The YAML must unmarshal to a map of strings to settings data; the supplied key must be present in the map, and must point to a map in which every value must have, or be a string parseable to, the correct type for the associated config option. Empty strings and nil values are both interpreted as nil.
type ExtraBinding ¶
type ExtraBinding struct {
Name string `bson:"name" json:"Name"`
}
ExtraBinding represents an extra bindable endpoint that is not a relation.
type Location ¶
Location represents a charm location, which must declare a path component and a string representaion.
type MachineSpec ¶
type MachineSpec struct { Constraints string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` Annotations map[string]string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` Series string `bson:",omitempty" json:",omitempty" yaml:",omitempty"` }
MachineSpec represents a notional machine that will be mapped onto an actual machine at bundle deployment time.
type Meta ¶
type Meta struct { Name string `bson:"name" json:"Name"` Summary string `bson:"summary" json:"Summary"` Description string `bson:"description" json:"Description"` Subordinate bool `bson:"subordinate" json:"Subordinate"` Provides map[string]Relation `bson:"provides,omitempty" json:"Provides,omitempty"` Requires map[string]Relation `bson:"requires,omitempty" json:"Requires,omitempty"` Peers map[string]Relation `bson:"peers,omitempty" json:"Peers,omitempty"` ExtraBindings map[string]ExtraBinding `bson:"extra-bindings,omitempty" json:"ExtraBindings,omitempty"` Categories []string `bson:"categories,omitempty" json:"Categories,omitempty"` Tags []string `bson:"tags,omitempty" json:"Tags,omitempty"` Series []string `bson:"series,omitempty" json:"SupportedSeries,omitempty"` Storage map[string]Storage `bson:"storage,omitempty" json:"Storage,omitempty"` PayloadClasses map[string]PayloadClass `bson:"payloadclasses,omitempty" json:"PayloadClasses,omitempty"` Resources map[string]resource.Meta `bson:"resources,omitempty" json:"Resources,omitempty"` Terms []string `bson:"terms,omitempty" json:"Terms,omitempty"` MinJujuVersion version.Number `bson:"min-juju-version,omitempty" json:"min-juju-version,omitempty"` }
Meta represents all the known content that may be defined within a charm's metadata.yaml file. Note: Series is serialised for backward compatibility as "supported-series" because a previous charm version had an incompatible Series field that was unused in practice but still serialized. This only applies to JSON because Meta has a custom YAML marshaller.
func (Meta) CombinedRelations ¶
CombinedRelations returns all defined relations, regardless of their type in a single map.
func (Meta) Hooks ¶
Hooks returns a map of all possible valid hooks, taking relations into account. It's a map to enable fast lookups, and the value is always true.
func (Meta) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler (yaml.v2).
func (*Meta) UnmarshalYAML ¶
type Metric ¶
type Metric struct { Type MetricType `yaml:"type"` Description string `yaml:"description"` }
Metric represents a single metric definition
type MetricType ¶
type MetricType string
MetricType is used to identify metric types supported by juju.
const ( // Supported metric types. MetricTypeGauge MetricType = "gauge" MetricTypeAbsolute MetricType = "absolute" )
type Metrics ¶
type Metrics struct { Metrics map[string]Metric `yaml:"metrics"` Plan *Plan `yaml:"plan,omitempty"` }
Metrics contains the metrics declarations encoded in the metrics.yaml file.
func ReadMetrics ¶
ReadMetrics reads a MetricsDeclaration in YAML format.
func (Metrics) PlanRequired ¶
PlanRequired reports whether these metrics require a plan.
func (Metrics) ValidateMetric ¶
ValidateMetric validates the supplied metric name and value against the loaded metric definitions.
type Option ¶
type Option struct { Type string `yaml:"type"` Description string `yaml:"description,omitempty"` Default interface{} `yaml:"default,omitempty"` }
Option represents a single charm config option.
type PayloadClass ¶
type PayloadClass struct { // Name identifies the payload class. Name string // Type identifies the type of payload (e.g. kvm, docker). Type string }
PayloadClass holds the information about a payload class, as stored in a charm's metadata.
func (PayloadClass) Validate ¶
func (pc PayloadClass) Validate() error
Validate checks the payload class to ensure its data is valid.
type Plan ¶
type Plan struct {
Required bool `yaml:"required,omitempty"`
}
Plan represents the plan section of metrics.yaml
type Relation ¶
type Relation struct { Name string `bson:"name"` Role RelationRole `bson:"role"` Interface string `bson:"interface"` Optional bool `bson:"optional"` Limit int `bson:"limit"` Scope RelationScope `bson:"scope"` }
Relation represents a single relation defined in the charm metadata.yaml file.
func (Relation) ImplementedBy ¶
ImplementedBy returns whether the relation is implemented by the supplied charm.
func (Relation) IsImplicit ¶
IsImplicit returns whether the relation is supplied by juju itself, rather than by a charm.
type RelationRole ¶
type RelationRole string
RelationRole defines the role of a relation.
const ( RoleProvider RelationRole = "provider" RoleRequirer RelationRole = "requirer" RolePeer RelationRole = "peer" )
type RelationScope ¶
type RelationScope string
RelationScope describes the scope of a relation.
const ( ScopeGlobal RelationScope = "global" ScopeContainer RelationScope = "container" )
type Settings ¶
type Settings map[string]interface{}
Settings is a group of charm config option names and values. A Settings S is considered valid by the Config C if every key in S is an option in C, and every value either has the correct type or is nil.
type Storage ¶
type Storage struct { // Name is the name of the store. // // Name has no default, and must be specified. Name string `bson:"name"` // Description is a description of the store. // // Description has no default, and is optional. Description string `bson:"description"` // Type is the storage type: filesystem or block-device. // // Type has no default, and must be specified. Type StorageType `bson:"type"` // an application deployed from the charm. It is an error to attempt to // assign non-shareable storage to a "shared" storage requirement. // // Shared defaults to false. Shared bool `bson:"shared"` // ReadOnly indicates that the storage should be made read-only if // possible. If the storage cannot be made read-only, Juju will warn // the user. // // ReadOnly defaults to false. ReadOnly bool `bson:"read-only"` // CountMin is the number of storage instances that must be attached // to the charm for it to be useful; the charm will not install until // this number has been satisfied. This must be a non-negative number. // // CountMin defaults to 1 for singleton stores. CountMin int `bson:"countmin"` // CountMax is the largest number of storage instances that can be // attached to the charm. If CountMax is -1, then there is no upper // bound. // // CountMax defaults to 1 for singleton stores. CountMax int `bson:"countmax"` // MinimumSize is the minimum size of store that the charm needs to // work at all. This is not a recommended size or a comfortable size // or a will-work-well size, just a bare minimum below which the charm // is going to break. // MinimumSize requires a unit, one of MGTPEZY, and is stored as MiB. // // There is no default MinimumSize; if left unspecified, a provider // specific default will be used, typically 1GB for block storage. MinimumSize uint64 `bson:"minimum-size"` // Location is the mount location for filesystem stores. For multi- // stores, the location acts as the parent directory for each mounted // store. // // Location has no default, and is optional. Location string `bson:"location,omitempty"` // Properties allow the charm author to characterise the relative storage // performance requirements and sensitivities for each store. // eg “transient” is used to indicate that non persistent storage is acceptable, // such as tmpfs or ephemeral instance disks. // // Properties has no default, and is optional. Properties []string `bson:"properties,omitempty"` }
Storage represents a charm's storage requirement.
type StorageType ¶
type StorageType string
StorageType defines a storage type.
const ( StorageBlock StorageType = "block" StorageFilesystem StorageType = "filesystem" )
type TermsId ¶
TermsId represents a single term id. The term can either be owned or "public" (meaning there is no owner). The Revision starts at 1. Therefore a value of 0 means the revision is unset.
func MustParseTerm ¶
MustParseTerm acts like ParseTerm but panics on error.
func ParseTerm ¶
ParseTerm takes a termID as a string and parses it into a Term. A complete term is in the form: tenant:owner/name/revision This function accepts partially specified identifiers typically in one of the following forms: name owner/name owner/name/27 # Revision 27 name/283 # Revision 283 cs:owner/name # Tenant cs
type URL ¶
type URL struct { Schema string // "cs" or "local". User string // "joe". Name string // "wordpress". Revision int // -1 if unset, N otherwise. Series string // "precise" or "" if unset; "bundle" if it's a bundle. }
URL represents a charm or bundle location:
cs:~joe/oneiric/wordpress cs:oneiric/wordpress-42 local:oneiric/wordpress cs:~joe/wordpress cs:wordpress cs:precise/wordpress-20 cs:development/precise/wordpress-20 cs:~joe/development/wordpress
func InferURL ¶
InferURL parses src as a reference, fills out the series in the returned URL using defaultSeries if necessary.
This function is deprecated. New code should use ParseURL instead.
func MustParseURL ¶
MustParseURL works like ParseURL, but panics in case of errors.
func ParseURL ¶
ParseURL parses the provided charm URL string into its respective structure.
Additionally, fully-qualified charmstore URLs are supported; note that this currently assumes that they will map to jujucharms.com (that is, fully-qualified URLs currently map to the 'cs' schema):
https://jujucharms.com/name https://jujucharms.com/name/series https://jujucharms.com/name/revision https://jujucharms.com/name/series/revision https://jujucharms.com/u/user/name https://jujucharms.com/u/user/name/series https://jujucharms.com/u/user/name/revision https://jujucharms.com/u/user/name/series/revision https://jujucharms.com/channel/name https://jujucharms.com/channel/name/series https://jujucharms.com/channel/name/revision https://jujucharms.com/channel/name/series/revision https://jujucharms.com/u/user/channel/name https://jujucharms.com/u/user/channel/name/series https://jujucharms.com/u/user/channel/name/revision https://jujucharms.com/u/user/channel/name/series/revision
A missing schema is assumed to be 'cs'.
func (*URL) GetBSON ¶
GetBSON turns u into a bson.Getter so it can be saved directly on a MongoDB database with mgo.
func (*URL) MarshalJSON ¶
func (*URL) MarshalText ¶
MarshalText implements encoding.TextMarshaler by returning u.String()
func (*URL) SetBSON ¶
SetBSON turns u into a bson.Setter so it can be loaded directly from a MongoDB database with mgo.
func (*URL) UnmarshalJSON ¶
func (*URL) UnmarshalText ¶
UnmarshalText implements encoding.TestUnmarshaler by parsing the data with ParseURL.
func (*URL) WithRevision ¶
WithRevision returns a URL equivalent to url but with Revision set to revision.
type UnitPlacement ¶
type UnitPlacement struct { // ContainerType holds the container type of the new // new unit, or empty if unspecified. ContainerType string // Machine holds the numeric machine id, or "new", // or empty if the placement specifies an application. Machine string // application holds the application name, or empty if // the placement specifies a machine. Application string // Unit holds the unit number of the application, or -1 // if unspecified. Unit int }
func ParsePlacement ¶
func ParsePlacement(p string) (*UnitPlacement, error)
ParsePlacement parses a unit placement directive, as specified in the To clause of an application entry in the applications section of a bundle.
type VerificationError ¶
type VerificationError struct {
Errors []error
}
VerificationError holds an error generated by BundleData.Verify, holding all the verification errors found when verifying.
func (*VerificationError) Error ¶
func (err *VerificationError) Error() string