Documentation ¶
Index ¶
- Variables
- type Collection
- func (c Collection) Len() int
- func (c Collection) Less(i, j int) bool
- func (c *Collection) MarshalJSON() ([]byte, error)
- func (c *Collection) MarshalYAML() (interface{}, error)
- func (c Collection) Swap(i, j int)
- func (c *Collection) UnmarshalJSON(data []byte) error
- func (c *Collection) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Constraints
- type Version
- func (v *Version) AirgapDownloadURL(arch string) string
- func (v *Version) Compare(b *Version) int
- func (v *Version) DocsURL() string
- func (v *Version) DownloadURL(os, arch string) string
- func (v *Version) Equal(b *Version) bool
- func (v *Version) GreaterThan(b *Version) bool
- func (v *Version) GreaterThanOrEqual(b *Version) bool
- func (v *Version) IsZero() bool
- func (v *Version) LessThan(b *Version) bool
- func (v *Version) LessThanOrEqual(b *Version) bool
- func (v *Version) MarshalJSON() ([]byte, error)
- func (v *Version) MarshalYAML() (interface{}, error)
- func (v *Version) Satisfies(constraint Constraints) bool
- func (v *Version) String() string
- func (v *Version) URL() string
- func (v *Version) UnmarshalJSON(b []byte) error
- func (v *Version) UnmarshalYAML(f func(interface{}) error) error
Constants ¶
This section is empty.
Variables ¶
var BaseUrl = "https://github.com/k0sproject/k0s/"
var Timeout = time.Second * 10
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection []*Version
Collection is a type that implements the sort.Interface interface so that versions can be sorted.
func NewCollection ¶
func NewCollection(versions ...string) (Collection, error)
func (Collection) Len ¶
func (c Collection) Len() int
func (Collection) Less ¶
func (c Collection) Less(i, j int) bool
func (*Collection) MarshalJSON ¶ added in v0.4.0
func (c *Collection) MarshalJSON() ([]byte, error)
UnmarshalText implements the json.Marshaler interface.
func (*Collection) MarshalYAML ¶ added in v0.4.0
func (c *Collection) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (Collection) Swap ¶
func (c Collection) Swap(i, j int)
func (*Collection) UnmarshalJSON ¶ added in v0.4.0
func (c *Collection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Collection) UnmarshalYAML ¶ added in v0.4.0
func (c *Collection) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Constraints ¶ added in v0.4.0
type Constraints []constraint
Constraints is a collection of version constraint rules that can be checked against a version.
func MustConstraint ¶ added in v0.4.0
func MustConstraint(cs string) Constraints
MustConstraint is like NewConstraint but panics if the constraint is invalid.
func NewConstraint ¶ added in v0.4.0
func NewConstraint(cs string) (Constraints, error)
NewConstraint parses a string into a Constraints object that can be used to check if a given version satisfies the constraint.
func (Constraints) Check ¶ added in v0.4.0
func (cs Constraints) Check(v *Version) bool
Check returns true if the given version satisfies all of the constraints.
func (Constraints) CheckString ¶ added in v0.4.0
func (cs Constraints) CheckString(v string) bool
CheckString is like Check but takes a string version. If the version is invalid, it returns false.
func (Constraints) String ¶ added in v0.4.1
func (cs Constraints) String() string
String returns the constraint as a string.
type Version ¶
Version is a k0s version
func Latest ¶ added in v0.3.0
LatestVersion returns the semantically sorted latest version even if it is a prerelease from the online repository
func LatestByPrerelease ¶ added in v0.3.0
LatestByPrerelease returns the latest released k0s version, if preok is true, prereleases are also accepted.
func LatestStable ¶ added in v0.3.0
LatestStable returns the semantically sorted latest non-prerelease version from the online repository
func MustParse ¶ added in v0.4.0
MustParse is like NewVersion but panics if the version cannot be parsed. It simplifies safe initialization of global variables.
func NewVersion ¶
NewVersion returns a new Version created from the supplied string or an error if the string is not a valid version number
func (*Version) AirgapDownloadURL ¶ added in v0.3.0
AirgapDownloadURL returns the k0s airgap bundle download URL for the k0s version
func (*Version) Compare ¶
Compare compares two versions and returns one of the integers: -1, 0 or 1 (less than, equal, greater than)
func (*Version) DownloadURL ¶ added in v0.3.0
DownloadURL returns the k0s binary download URL for the k0s version
func (*Version) GreaterThan ¶
GreaterThan returns true if the version is greater than the supplied version
func (*Version) GreaterThanOrEqual ¶
GreaterThanOrEqual returns true if the version is greater than the supplied version or equal
func (*Version) LessThanOrEqual ¶
LessThanOrEqual returns true if the version is lower than the supplied version or equal
func (*Version) MarshalJSON ¶ added in v0.4.0
MarshalJSON implements the json.Marshaler interface.
func (*Version) MarshalYAML ¶ added in v0.4.0
MarshalYAML implements the yaml.Marshaler interface.
func (*Version) Satisfies ¶ added in v0.4.0
func (v *Version) Satisfies(constraint Constraints) bool
Satisfies returns true if the version satisfies the supplied constraint
func (*Version) String ¶ added in v0.3.0
String returns a v-prefixed string representation of the k0s version
func (*Version) URL ¶ added in v0.3.0
URL returns an URL to the release information page for the k0s version
func (*Version) UnmarshalJSON ¶ added in v0.4.0
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Version) UnmarshalYAML ¶ added in v0.4.0
UnmarshalYAML implements the yaml.Unmarshaler interface.