v1alpha1

package
v1.11.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CASTEngineBuilder

type CASTEngineBuilder struct {
	*errors.ErrorList
	RuntimeConfig []apis.Config
	CASTemplate   *apis.CASTemplate
	UnitOfUpgrade *upgrade.ResourceDetails
	UpgradeResult *upgrade.UpgradeResult
}

CASTEngineBuilder helps to build a new instance of castEngine

func NewCASTEngineBuilder

func NewCASTEngineBuilder() *CASTEngineBuilder

NewCASTEngineBuilder returns an empty instance of CASTEngineBuilder

func (*CASTEngineBuilder) Build

func (ceb *CASTEngineBuilder) Build() (e cast.Interface, err error)

Build builds a new instance of engine with the helps of CASTEngineBuilder struct.

func (CASTEngineBuilder) GoString

func (ceb CASTEngineBuilder) GoString() string

GoString implements GoStringer interface

func (CASTEngineBuilder) String

func (ceb CASTEngineBuilder) String() string

String implements Stringer interface

func (*CASTEngineBuilder) WithCASTemplate

func (ceb *CASTEngineBuilder) WithCASTemplate(casTemplate *apis.CASTemplate) *CASTEngineBuilder

WithCASTemplate sets casTemplate object in CASTEngineBuilder.

func (*CASTEngineBuilder) WithRuntimeConfig

func (ceb *CASTEngineBuilder) WithRuntimeConfig(configs []upgrade.DataItem) *CASTEngineBuilder

WithRuntimeConfig sets runtime config in CASTEngineBuilder.

func (*CASTEngineBuilder) WithUnitOfUpgrade

func (ceb *CASTEngineBuilder) WithUnitOfUpgrade(item *upgrade.ResourceDetails) *CASTEngineBuilder

WithUnitOfUpgrade sets unitOfUpgrade details in CASTEngineBuilder.

func (*CASTEngineBuilder) WithUpgradeResult

func (ceb *CASTEngineBuilder) WithUpgradeResult(obj *upgrade.UpgradeResult) *CASTEngineBuilder

WithUpgradeResult sets upgradeResult in CASTEngineBuilder.

type Config

type Config struct {
	Object *apis.UpgradeConfig
}

Config is wrapper over apis.UpgradeConfig which is upgrade config for a particular job.

func (*Config) IsCASTemplateName

func (c *Config) IsCASTemplateName() bool

IsCASTemplateName is a Predicate that checks castemplate is present in object or not.

func (*Config) IsResource

func (c *Config) IsResource() bool

IsResource is a Predicate that checks resources are present in object or not.

func (*Config) IsSameKind

func (c *Config) IsSameKind() bool

IsSameKind is a Predicate that checks present resources in object are in same kind or not.

func (*Config) IsValidResource

func (c *Config) IsValidResource() bool

IsValidResource is a Predicate that checks present resources in object contains name, namespace and kind or not.

type ConfigBuilder

type ConfigBuilder struct {
	*errors.ErrorList
	Config *Config
	// contains filtered or unexported fields
}

ConfigBuilder helps to build UpgradeConfig instance

func ConfigBuilderForRaw

func ConfigBuilderForRaw(raw []byte) *ConfigBuilder

ConfigBuilderForRaw add object in ConfigBuilder struct. With the help of raw bytes

func ConfigBuilderForYaml

func ConfigBuilderForYaml(yamlString string) *ConfigBuilder

ConfigBuilderForYaml add object in ConfigBuilder struct. with the help of yaml string

func NewConfigBuilder

func NewConfigBuilder() *ConfigBuilder

NewConfigBuilder returns a new instance of ConfigBuilder

func (*ConfigBuilder) AddCheck

func (cb *ConfigBuilder) AddCheck(p Predicate) *ConfigBuilder

AddCheck adds the predicate as a condition to be validated against the upgrade config instance

func (*ConfigBuilder) AddCheckf

func (cb *ConfigBuilder) AddCheckf(p Predicate, predicateMsg string, args ...interface{}) *ConfigBuilder

AddCheckf adds the predicate as a condition to be validated against the upgrade config instance and format the message string according to format specifier. If only predicate and message string is provided, it will treat it as the value for the corresponding predicate.

func (*ConfigBuilder) AddChecks

func (cb *ConfigBuilder) AddChecks(predicates ...Predicate) *ConfigBuilder

AddChecks adds the provided predicates as conditions to be validated against the upgrade config instance

func (*ConfigBuilder) Build

func (cb *ConfigBuilder) Build() (*apis.UpgradeConfig, error)

Build returns the final instance of UpgradeConfig

type Predicate

type Predicate func(*Config) bool

Predicate abstracts conditional logic w.r.t the upgradeConfig instance

NOTE: Predicate is a functional approach versus traditional approach to mix conditions such as *if-else* within blocks of business logic

NOTE: Predicate approach enables clear separation of conditionals from imperatives i.e. actions that form the business logic

func IsCASTemplateName

func IsCASTemplateName() Predicate

IsCASTemplateName returns predicate to check castemplate is present in object or not.

func IsResource

func IsResource() Predicate

IsResource returns predicate to check resources are present in object or not.

func IsSameKind

func IsSameKind() Predicate

IsSameKind returns predicate to check present resources in object are in same kind or not.

func IsValidResource

func IsValidResource() Predicate

IsValidResource returns predicate to check present resources in object contains name, namespace and kind or not.

Jump to

Keyboard shortcuts

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