either

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// template key
	KeyMajor = "Major"
	KeyMinor = "Minor"
	KeyPatch = "Patch"
)

Variables

View Source
var (
	// DefaultTemplate is the default template used to download certificates
	DefaultTemplate = fmt.Sprintf("https://cloud.ibm.com/media/docs/downloads/hyper-protect-container-runtime/ibm-hyper-protect-container-runtime-{{.%s}}-{{.%s}}-s390x-{{.%s}}-encrypt.crt", KeyMajor, KeyMinor, KeyPatch)

	// ParseConstraint parses a constraint string into a constraint object
	ParseConstraint = E.Eitherize1(semver.NewConstraint)

	// ParseVersion parses a version string into a version object
	ParseVersion = E.Eitherize1(semver.NewVersion)

	// ParseResolver parses a template string into a resolver function
	ParseResolver = F.Flow2(
		ParseTemplate("DownloadUrl"),
		E.Fold(F.Flow2(
			E.Left[string, error],
			F.Constant1[C.Version, E.Either[error, string]],
		), ResolveUrl),
	)
)

Functions

func CertificateFromSpec

func CertificateFromSpec(spec *semver.Constraints) func(certs map[string]string) E.Either[error, C.VersionCert]

CertificateFromSpec selects the best matching certificate from a map out of string and certificate

func ParseTemplate

func ParseTemplate(name string) func(string) E.Either[error, *template.Template]

ParseTemplate parses a template of the given name

Types

type Resolver

type Resolver = func(version C.Version) E.Either[error, string]

func ResolveUrl

func ResolveUrl(tmp *template.Template) Resolver

ResolveUrl computes the download URL from a version number

Jump to

Keyboard shortcuts

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