assumes

package
v0.0.0-...-b0bff92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// A set of user-friendly descriptions for potentially supported
	// features that are known to the controller. This allows us to
	// generate better error messages when an "assumes" expression requests a
	// feature that is not included in the feature set supported by the
	// current model.
	UserFriendlyFeatureDescriptions = map[string]string{
		"juju":    "the version of Juju used by the model",
		"k8s-api": "the Kubernetes API lets charms query and manipulate the state of API objects in a Kubernetes cluster",
	}
)

Functions

func IsRequirementsNotSatisfiedError

func IsRequirementsNotSatisfiedError(err error) bool

IsRequirementsNotSatisfiedError returns true if err is a RequirementsNotSatisfiedError.

Types

type Feature

type Feature struct {
	// The name of the feature.
	Name string

	// A user-friendly description of what the feature provides.
	Description string

	// An optional semantic version for this feature. It can be left empty
	// to signify that a particular feature is available without explicitly
	// specifying a version
	Version *version.Number
}

Feature identifies a particular piece of functionality provided by a Juju controller depending on the substrate associated with a particular model.

type FeatureSet

type FeatureSet struct {
	// contains filtered or unexported fields
}

FeatureSet describes a set of features supported by a particular model.

func (*FeatureSet) Add

func (fs *FeatureSet) Add(features ...Feature)

Add a list of Features to the feature set. Duplicate feature entries will be ignored.

func (*FeatureSet) AsList

func (fs *FeatureSet) AsList() []Feature

AsList returns the contents of this set as a list sorted by feature name.

func (FeatureSet) Get

func (fs FeatureSet) Get(featName string) (Feature, bool)

Get a feature with the provide feature name. The method returns a boolean value to indicate if the feature was found.

func (*FeatureSet) Merge

func (fs *FeatureSet) Merge(other FeatureSet)

Merge the features from other into this feature set.

func (FeatureSet) Satisfies

func (fs FeatureSet) Satisfies(assumesExprTree *chassumes.ExpressionTree) error

Satisfies checks whether the feature set contents satisfy the provided "assumes" expression tree and returns an error otherwise.

type RequirementsNotSatisfiedError

type RequirementsNotSatisfiedError struct {
	// contains filtered or unexported fields
}

RequirementsNotSatisfiedError indicates that the set of features supported by a model cannot satisfy an "assumes" expression tree as specified in the charm metadata.

func (*RequirementsNotSatisfiedError) Error

Error returns the error message associated with this error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL