Documentation ¶
Overview ¶
Versions API ¶
The Versions API is a provides information about versions of Constellation components.
This package defines API types that represents objects of the versions API. The types provide helper methods for validation and commonly used operations on the information contained in the objects. Especially the paths used for the API are defined in these helper methods.
The package also provides helper functions that can be used in context of the versions API, e.g. to validate versions.
Index ¶
- Constants
- func CanonicalizeRef(ref string) string
- func ValidateRef(ref string) error
- func ValidateStream(ref, stream string) error
- type Granularity
- type ImageInfo
- type Latest
- type List
- type Version
- func (v Version) ArtifactPath() string
- func (v Version) ArtifactURL() string
- func (v Version) ListPath(gran Granularity) string
- func (v Version) ListURL(gran Granularity) string
- func (v Version) Major() string
- func (v Version) MajorMinor() string
- func (v Version) ShortPath() string
- func (v Version) Validate() error
- func (v Version) WithGranularity(gran Granularity) string
- type VersionKind
Constants ¶
const ReleaseRef = "-"
ReleaseRef is the ref used for release versions.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeRef ¶ added in v2.4.0
CanonicalizeRef returns the canonicalized ref for the given ref.
func ValidateRef ¶ added in v2.4.0
ValidateRef checks if the given ref is a valid ref. Canonicalize the ref before checking if it is valid.
func ValidateStream ¶ added in v2.4.0
ValidateStream checks if the given stream is a valid stream for the given ref.
Types ¶
type Granularity ¶ added in v2.4.0
type Granularity int
Granularity represents the granularity of a semantic version.
const ( // GranularityUnknown is the default granularity. GranularityUnknown Granularity = iota // GranularityMajor is the granularity of a major version, e.g. "v1". // Lists with granularity "major" map from a major version to a list of minor versions. GranularityMajor // GranularityMinor is the granularity of a minor version, e.g. "v1.0". // Lists with granularity "minor" map from a minor version to a list of patch versions. GranularityMinor // GranularityPatch is the granularity of a patch version, e.g. "v1.0.0". // There are no lists with granularity "patch". GranularityPatch )
func GranularityFromString ¶ added in v2.4.0
func GranularityFromString(s string) Granularity
GranularityFromString returns the granularity for the given string.
func (Granularity) MarshalJSON ¶ added in v2.4.0
func (g Granularity) MarshalJSON() ([]byte, error)
MarshalJSON marshals the granularity to JSON.
func (Granularity) String ¶ added in v2.4.0
func (g Granularity) String() string
String returns the string representation of the granularity.
func (*Granularity) UnmarshalJSON ¶ added in v2.4.0
func (g *Granularity) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the granularity from JSON.
type ImageInfo ¶ added in v2.4.0
type ImageInfo struct { // Ref is the reference name of the image. Ref string `json:"ref,omitempty"` // Stream is the stream name of the image. Stream string `json:"stream,omitempty"` // Version is the version of the image. Version string `json:"version,omitempty"` // AWS is a map of AWS regions to AMI IDs. AWS map[string]string `json:"aws,omitempty"` // Azure is a map of image types to Azure image IDs. Azure map[string]string `json:"azure,omitempty"` // GCP is a map of image types to GCP image IDs. GCP map[string]string `json:"gcp,omitempty"` // QEMU is a map of image types to QEMU image URLs. QEMU map[string]string `json:"qemu,omitempty"` }
ImageInfo contains information about the OS images for a specific version.
func (ImageInfo) ValidateRequest ¶ added in v2.4.0
ValidateRequest validates the request parameters of the list. The provider specific maps must be empty.
type Latest ¶
type Latest struct { // Ref is the branch name this latest version belongs to. Ref string `json:"ref,omitempty"` // Stream is stream name this latest version belongs to. Stream string `json:"stream,omitempty"` // Kind is the kind of resource this latest version is for. Kind VersionKind `json:"kind,omitempty"` // Version is the latest version for this ref, stream and kind. Version string `json:"version,omitempty"` }
Latest is the latest version of a kind of resource.
func (Latest) ValidateRequest ¶ added in v2.4.0
ValidateRequest checks if this latest version beside values that are fetched.
type List ¶
type List struct { // Ref is the branch name the list belongs to. Ref string `json:"ref,omitempty"` // Stream is the update stream of the list. Stream string `json:"stream,omitempty"` // Granularity is the granularity of the base version of this list. // It can be either "major" or "minor". Granularity Granularity `json:"granularity,omitempty"` // Base is the base version of the list. // Every version in the list is a finer-grained version of this base version. Base string `json:"base,omitempty"` // Kind is the kind of resource this list is for. Kind VersionKind `json:"kind,omitempty"` // Versions is a list of all versions in this list. Versions []string `json:"versions,omitempty"` }
List represents a list of versions for a kind of resource. It has a granularity of either "major" or "minor".
For example, a List with granularity "major" could contain the base version "v1" and a list of minor versions "v1.0", "v1.1", "v1.2" etc. A List with granularity "minor" could contain the base version "v1.0" and a list of patch versions "v1.0.0", "v1.0.1", "v1.0.2" etc.
func (List) StructuredVersions ¶ added in v2.4.0
StructuredVersions returns the versions of the list as slice of Version structs.
func (List) Validate ¶
Validate checks if the list is valid. This performs the following checks: - The ref is set. - The stream is supported. - The granularity is "major" or "minor". - The kind is supported. - The base version is a valid semantic version that matches the granularity. - All versions in the list are valid semantic versions that are finer-grained than the base version.
func (List) ValidateRequest ¶ added in v2.4.0
ValidateRequest validates the request parameters of the list. The versions field must be empty.
type Version ¶ added in v2.4.0
type Version struct { Ref string Stream string Version string Kind VersionKind }
Version represents a version. A version has a ref, stream, version string and kind.
Notice that version is a meta object to the versions API and there isn't an actual corresponding object in the S3 bucket. Therefore, the version object doesn't have a URL or JSON path.
func NewVersionFromShortPath ¶ added in v2.4.0
func NewVersionFromShortPath(shortPath string, kind VersionKind) (Version, error)
NewVersionFromShortPath creates a new Version from a version short path.
func (Version) ArtifactPath ¶ added in v2.4.0
ArtifactPath returns the path to the artifacts stored for this version. The path points to a directory.
func (Version) ArtifactURL ¶ added in v2.4.0
ArtifactURL returns the URL to the artifacts stored for this version. The URL points to a directory.
func (Version) ListPath ¶ added in v2.4.0
func (v Version) ListPath(gran Granularity) string
ListPath returns the path of the list with the given granularity, this version is listed in. For example, assing GranularityMajor returns the path of the versions list that maps the major version of this version to its minor version. In case of an unknown granularity, an empty string is returned.
func (Version) ListURL ¶ added in v2.4.0
func (v Version) ListURL(gran Granularity) string
ListURL returns the URL of the list with the given granularity, this version is listed in. For example, assing GranularityMajor returns the URL of the versions list that maps the major version of this version to its minor version. In case of an unknown granularity, an empty string is returned.
func (Version) Major ¶ added in v2.4.0
Major returns the major version corresponding to the version. For example, if the version is "v1.2.3", the major version is "v1".
func (Version) MajorMinor ¶ added in v2.4.0
MajorMinor returns the major and minor version corresponding to the version. For example, if the version is "v1.2.3", the major and minor version is "v1.2".
func (Version) WithGranularity ¶ added in v2.4.0
func (v Version) WithGranularity(gran Granularity) string
WithGranularity returns the version with the given granularity.
For example, if the version is "v1.2.3" and the granularity is GranularityMajor, the returned version is "v1". This is a helper function for Major() and MajorMinor() and v.Version. In case of an unknown granularity, an empty string is returned.
type VersionKind ¶ added in v2.4.0
type VersionKind int
VersionKind represents the kind of resource the version versions.
const ( // VersionKindUnknown is the default value for VersionKind. VersionKindUnknown VersionKind = iota // VersionKindImage is the kind for image versions. VersionKindImage )
func VersionKindFromString ¶ added in v2.4.0
func VersionKindFromString(s string) VersionKind
VersionKindFromString returns the VersionKind for the given string.
func (VersionKind) MarshalJSON ¶ added in v2.4.0
func (k VersionKind) MarshalJSON() ([]byte, error)
MarshalJSON marshals the VersionKind to JSON.
func (VersionKind) String ¶ added in v2.4.0
func (k VersionKind) String() string
String returns the string representation of the VersionKind.
func (*VersionKind) UnmarshalJSON ¶ added in v2.4.0
func (k *VersionKind) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the VersionKind from JSON.
Directories ¶
Path | Synopsis |
---|---|
This package provides a CLI tool to interact with the Constellation versions API.
|
This package provides a CLI tool to interact with the Constellation versions API. |
Package client provides a client for the versions API.
|
Package client provides a client for the versions API. |
Package fetcher implements a client for the versions API.
|
Package fetcher implements a client for the versions API. |