types

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidName            = errors.New("must be lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character")
	ErrInvalidURL             = errors.New("must be a valid URL")
	ErrInvalidPathNotFound    = errors.New("must be a valid path")
	ErrInvalidPathIsDir       = errors.New("must be a file")
	ErrInvalidPathIsFile      = errors.New("must be a directory")
	ErrValidtorStopValidation = errors.New("stop validation")
)
View Source
var (
	NameRegex = regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`)
	EnvRegex  = regexp.MustCompile("^[a-zA-Z_]+[a-zA-Z0-9_]*$")
	UrlRegex  = regexp.MustCompile(`^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$`)
)
View Source
var GlobalManifest = &Manifest{}

Functions

func RegisterConverter

func RegisterConverter[T any](zero T, converter func(string) (T, error))

Types

type BasicSelectable

type BasicSelectable struct {
	LabelStr    string
	SelectedStr string
	DetailsStr  string
}

func (BasicSelectable) Details

func (b BasicSelectable) Details() string

func (BasicSelectable) Label

func (b BasicSelectable) Label() string

func (BasicSelectable) Match

func (b BasicSelectable) Match(input string) bool

func (BasicSelectable) Selected

func (b BasicSelectable) Selected() string

type Future

type Future[T any] interface {
	Get() (T, error)
	GetOrPanic() T
	Reset()
	String() string
}

func FutureFrom

func FutureFrom[T any](a T) Future[T]

func FutureFromFunc

func FutureFromFunc[T any](f func() T) Future[T]

func FutureFromFuncErr

func FutureFromFuncErr[T any](f func() (T, error)) Future[T]

func FutureFromPtr

func FutureFromPtr[T any](a *T) Future[T]

func FutureFromStringers

func FutureFromStringers[T Stringer](f Future[[]T]) Future[[]string]

func FutureInterfacer

func FutureInterfacer[T any, I any](f Future[T]) Future[I]

func FutureInterfacerArray

func FutureInterfacerArray[T any, I any](f Future[[]T]) Future[[]I]

type HelmChart

type HelmChart struct {
	RepoName    string `json:"name"`
	Version     string `json:"version"`
	AppVersion  string `json:"app_version"`
	Description string `json:"description"`

	LocalPath string `json:"-"`
	IsLocal   bool   `json:"-"`
}

func (HelmChart) Details

func (m HelmChart) Details() string

func (HelmChart) HelmName

func (h HelmChart) HelmName() string

func (HelmChart) Label

func (m HelmChart) Label() string

func (HelmChart) Match

func (m HelmChart) Match(input string) bool

func (HelmChart) Name

func (h HelmChart) Name() string

func (HelmChart) Repo

func (h HelmChart) Repo() string

func (HelmChart) Selected

func (m HelmChart) Selected() string

func (HelmChart) String

func (h HelmChart) String() string

type HelmChartArray

type HelmChartArray []HelmChart

func (HelmChartArray) ToHelmChartMulti

func (h HelmChartArray) ToHelmChartMulti() HelmChartMultiArray

type HelmChartMulti

type HelmChartMulti struct {
	HelmChart
	Versions []HelmChartMultiVersion
}

func (HelmChartMulti) FindVersion

func (h HelmChartMulti) FindVersion(version string) HelmChartMultiVersion

func (HelmChartMulti) Selected

func (m HelmChartMulti) Selected() string

type HelmChartMultiArray

type HelmChartMultiArray []HelmChartMulti

func (HelmChartMultiArray) FindChart

func (h HelmChartMultiArray) FindChart(chart string) HelmChartMulti

type HelmChartMultiVersion

type HelmChartMultiVersion HelmChart

func (HelmChartMultiVersion) Details

func (m HelmChartMultiVersion) Details() string

func (HelmChartMultiVersion) Label

func (m HelmChartMultiVersion) Label() string

func (HelmChartMultiVersion) Match

func (m HelmChartMultiVersion) Match(input string) bool

func (HelmChartMultiVersion) Name

func (h HelmChartMultiVersion) Name() string

func (HelmChartMultiVersion) Repo

func (h HelmChartMultiVersion) Repo() string

func (HelmChartMultiVersion) Selected

func (m HelmChartMultiVersion) Selected() string

type HelmRelease

type HelmRelease struct {
	Name         string `json:"name"`
	Namespace    string `json:"namespace"`
	Revision     string `json:"revision"`
	Updated      string `json:"updated"`
	Status       string `json:"status"`
	ChartVersion string `json:"chart"`
	AppVersion   string `json:"app_version"`
}

func (HelmRelease) Chart

func (h HelmRelease) Chart() string

func (HelmRelease) Details

func (m HelmRelease) Details() string

func (HelmRelease) Label

func (m HelmRelease) Label() string

func (HelmRelease) Match

func (m HelmRelease) Match(input string) bool

func (HelmRelease) Selected

func (m HelmRelease) Selected() string

func (HelmRelease) String

func (h HelmRelease) String() string

func (HelmRelease) Version

func (h HelmRelease) Version() string

type HelmRepo

type HelmRepo struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

func (HelmRepo) Details

func (m HelmRepo) Details() string

func (HelmRepo) Label

func (m HelmRepo) Label() string

func (HelmRepo) Match

func (m HelmRepo) Match(input string) bool

func (HelmRepo) Selected

func (m HelmRepo) Selected() string

type Manifest

type Manifest struct {
	Name        string             `yaml:"name"`
	Repos       []ManifestRepo     `yaml:"repos"`        // Helm repos
	AllowedEnv  []SelectableString `yaml:"allowed_env"`  // Allowed environment variables
	Releases    []ManifestRelease  `yaml:"releases"`     // Helm releases
	Singles     []ManifestSingle   `yaml:"singles"`      // Single files
	LocalCharts []SelectableString `yaml:"local_charts"` // Local charts

	Exists bool `yaml:"-"` // Whether the manifest exists
}

func (Manifest) ReleaseByName

func (m Manifest) ReleaseByName(name string) ManifestRelease

func (Manifest) ReleaseIdxByName

func (m Manifest) ReleaseIdxByName(name string) (ManifestRelease, int)

func (Manifest) RepoByName

func (m Manifest) RepoByName(name string) ManifestRepo

func (Manifest) SingleByName

func (m Manifest) SingleByName(name string) ManifestSingle

func (Manifest) Validate

func (m Manifest) Validate() bool

type ManifestChart

type ManifestChart struct {
	Name       string `yaml:"name"`        // Name of the chart
	Version    string `yaml:"version"`     // Version of the chart
	AppVersion string `yaml:"app_version"` // AppVersion the chart covers
	Repo       string `yaml:"repo"`        // Repo the chart is in from the manifest
}

func (ManifestChart) Details

func (m ManifestChart) Details() string

func (ManifestChart) Label

func (m ManifestChart) Label() string

func (ManifestChart) Match

func (m ManifestChart) Match(input string) bool

func (ManifestChart) RepoName

func (m ManifestChart) RepoName() string

func (ManifestChart) Selected

func (m ManifestChart) Selected() string

func (ManifestChart) String

func (m ManifestChart) String() string

type ManifestRelease

type ManifestRelease struct {
	Name      string        `yaml:"name"`      // the release name (required)
	Namespace string        `yaml:"namespace"` // the namespace the release is installed in (defaults to "default")
	Chart     ManifestChart `yaml:"chart"`     // The chart to install (required)
}

func (ManifestRelease) Details

func (m ManifestRelease) Details() string

func (ManifestRelease) Label

func (m ManifestRelease) Label() string

func (ManifestRelease) Match

func (m ManifestRelease) Match(input string) bool

func (ManifestRelease) Selected

func (m ManifestRelease) Selected() string

func (ManifestRelease) String

func (m ManifestRelease) String() string

type ManifestRepo

type ManifestRepo struct {
	Name string `yaml:"name"` // Name of the repo
	URL  string `yaml:"url"`  // URL of the repo
}

func (ManifestRepo) Details

func (m ManifestRepo) Details() string

func (ManifestRepo) Label

func (m ManifestRepo) Label() string

func (ManifestRepo) Match

func (m ManifestRepo) Match(input string) bool

func (ManifestRepo) Selected

func (m ManifestRepo) Selected() string

func (ManifestRepo) String

func (m ManifestRepo) String() string

type ManifestSingle

type ManifestSingle struct {
	Name      string `yaml:"name"`       // Name of the single
	UseCreate bool   `yaml:"use_create"` // Use create instead of apply
	Namespace string `yaml:"namespace"`  // Namespace to install the single in (optional)
}

func (ManifestSingle) Details

func (m ManifestSingle) Details() string

func (ManifestSingle) Label

func (m ManifestSingle) Label() string

func (ManifestSingle) Match

func (m ManifestSingle) Match(input string) bool

func (ManifestSingle) Selected

func (m ManifestSingle) Selected() string

func (ManifestSingle) String

func (m ManifestSingle) String() string

type ReleaseLock

type ReleaseLock struct {
	Chart   string `yaml:"chart"`
	Version string `yaml:"version"`
}

type Selectable

type Selectable interface {
	Label() string
	Selected() string
	Details() string
	Match(input string) bool
}

type SelectableString

type SelectableString string

func (SelectableString) Details

func (s SelectableString) Details() string

func (SelectableString) Label

func (s SelectableString) Label() string

func (SelectableString) Match

func (s SelectableString) Match(input string) bool

func (SelectableString) Selected

func (s SelectableString) Selected() string

func (SelectableString) String

func (s SelectableString) String() string

type Stringer

type Stringer interface {
	String() string
}

type StringerFunc

type StringerFunc func() string

func (StringerFunc) String

func (s StringerFunc) String() string

type ToStringer

type ToStringer string

func (ToStringer) String

func (s ToStringer) String() string

type Validator

type Validator[T any] interface {
	Validate(T) error
	Convert(string) (T, error)
}

func ConditionalValidator

func ConditionalValidator[T comparable](validator func(input T) Validator[T]) Validator[T]

func EmptyValidator

func EmptyValidator[T comparable](name string, empty bool) Validator[T]

func EnvValidator

func EnvValidator() Validator[string]

func EqualValidator

func EqualValidator[T comparable](format Stringer, future Future[[]T]) Validator[T]

func MultiValidator

func MultiValidator[T any](validators ...Validator[T]) Validator[T]

func NameValidator

func NameValidator(name string, allowEmpty bool) Validator[string]

func NotEqualValidator

func NotEqualValidator[T comparable](template Stringer, future Future[[]T]) Validator[T]

func OptionalEmptyValidator

func OptionalEmptyValidator[T comparable]() Validator[T]

func PathValidator

func PathValidator(name string, allowEmpty bool, allowDir bool, allowFile bool, allowStdIn bool) Validator[string]

func UrlValidator

func UrlValidator(name string, allowEmpty bool) Validator[string]

type ValidatorFunction

type ValidatorFunction[T any] func(T) error

func (ValidatorFunction[T]) Convert

func (v ValidatorFunction[T]) Convert(val string) (T, error)

func (ValidatorFunction[T]) Validate

func (v ValidatorFunction[T]) Validate(val T) error

Jump to

Keyboard shortcuts

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