versionsapi

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalRef

func CanonicalRef(ref string) string

CanonicalRef returns the canonicalized ref for the given ref.

func IsValidRef

func IsValidRef(ref string) bool

IsValidRef returns true if the given ref is a valid ref.

func IsValidStream

func IsValidStream(ref, stream string) bool

IsValidStream returns true if the given stream is a valid stream.

Types

type Fetcher

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

Fetcher fetches a list of versions.

func New

func New() *Fetcher

New returns a new VersionsFetcher.

func (*Fetcher) MinorVersionsOf

func (f *Fetcher) MinorVersionsOf(ctx context.Context, ref, stream, major, kind string) (*List, error)

MinorVersionsOf fetches the list of minor versions for a given stream, major version and kind.

func (*Fetcher) PatchVersionsOf

func (f *Fetcher) PatchVersionsOf(ctx context.Context, ref, stream, minor, kind string) (*List, error)

PatchVersionsOf fetches the list of patch versions for a given stream, minor version and kind.

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 string `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) JSONPath

func (l *Latest) JSONPath() string

JSONPath returns the S3 JSON path for this object.

func (*Latest) Validate

func (l *Latest) Validate() error

Validate checks if this latest version is valid.

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 string `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 string `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) Contains

func (l *List) Contains(version string) bool

Contains returns true if the list contains the given version.

func (*List) JSONPath

func (l *List) JSONPath() string

JSONPath returns the S3 JSON path for this object.

func (*List) Validate

func (l *List) Validate() error

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.

Jump to

Keyboard shortcuts

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