Documentation ¶
Index ¶
- type CASTEngineBuilder
- func (ceb *CASTEngineBuilder) Build() (e cast.Interface, err error)
- func (ceb CASTEngineBuilder) GoString() string
- func (ceb CASTEngineBuilder) String() string
- func (ceb *CASTEngineBuilder) WithCASTemplate(casTemplate *apis.CASTemplate) *CASTEngineBuilder
- func (ceb *CASTEngineBuilder) WithRuntimeConfig(configs []upgrade.DataItem) *CASTEngineBuilder
- func (ceb *CASTEngineBuilder) WithUnitOfUpgrade(item *upgrade.ResourceDetails) *CASTEngineBuilder
- func (ceb *CASTEngineBuilder) WithUpgradeResult(obj *upgrade.UpgradeResult) *CASTEngineBuilder
- type Config
- type ConfigBuilder
- func (cb *ConfigBuilder) AddCheck(p Predicate) *ConfigBuilder
- func (cb *ConfigBuilder) AddCheckf(p Predicate, predicateMsg string, args ...interface{}) *ConfigBuilder
- func (cb *ConfigBuilder) AddChecks(predicates ...Predicate) *ConfigBuilder
- func (cb *ConfigBuilder) Build() (*apis.UpgradeConfig, error)
- type Predicate
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 ¶
IsCASTemplateName is a Predicate that checks castemplate is present in object or not.
func (*Config) IsResource ¶
IsResource is a Predicate that checks resources are present in object or not.
func (*Config) IsSameKind ¶
IsSameKind is a Predicate that checks present resources in object are in same kind or not.
func (*Config) IsValidResource ¶
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 ¶
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.