Documentation
¶
Index ¶
Constants ¶
const (
// OutputFieldName is the reference of context base object
OutputFieldName = "output"
// OutputsFieldName is the reference of context Auxiliaries
OutputsFieldName = "outputs"
// ConfigFieldName is the reference of context config
ConfigFieldName = "config"
// ContextName is the name of context
ContextName = "name"
// ContextAppName is the appName of context
ContextAppName = "appName"
// ContextAppRevision is the revision name of app of context
ContextAppRevision = "appRevision"
// ContextAppRevisionNum is the revision num of app of context
ContextAppRevisionNum = "appRevisionNum"
// ContextNamespace is the namespace of the app
ContextNamespace = "namespace"
// OutputSecretName is used to store all secret names which are generated by cloud resource components
OutputSecretName = "outputSecretName"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auxiliary ¶ added in v0.3.3
type Auxiliary struct {
Ins model.Instance
// Type will be used to mark definition label for OAM runtime to get the CRD
// It's now required for trait and main workload object. Extra workload CR object will not have the type.
Type string
// Workload or trait with multiple `outputs` will have a name, if name is empty, than it's the main of this type.
Name string
}
Auxiliary are objects rendered by definition template. the format for auxiliary resource is always: `outputs.<resourceName>`, it can be auxiliary workload or trait
type AuxiliaryHook ¶ added in v1.0.3
type AuxiliaryHook interface {
Exec(Context, []Auxiliary) error
}
AuxiliaryHook defines function to be invoked before appending auxiliaries to a process.Context
type AuxiliaryHookFn ¶ added in v1.0.3
type AuxiliaryHookFn func(Context, []Auxiliary) error
AuxiliaryHookFn implements AuxiliaryHook interface
type BaseHook ¶ added in v1.0.3
type BaseHook interface {
Exec(Context, model.Instance) error
}
BaseHook defines function to be invoked before setting base to a process.Context
type BaseHookFn ¶ added in v1.0.3
type BaseHookFn func(Context, model.Instance) error
BaseHookFn implements BaseHook interface
type Context ¶
type Context interface {
SetBase(base model.Instance) error
AppendAuxiliaries(auxiliaries ...Auxiliary) error
Output() (model.Instance, []Auxiliary)
BaseContextFile() string
ExtendedContextFile() string
BaseContextLabels() map[string]string
SetConfigs(configs []map[string]string)
InsertSecrets(outputSecretName string, requiredSecrets []RequiredSecrets)
}
Context defines Rendering Context Interface
func NewContext ¶
func NewContext(namespace, name, appName, appRevision string) Context
NewContext create render templateContext
func NewContextWithHooks ¶ added in v1.0.3
func NewContextWithHooks(namespace, name, appName, appRevision string, baseHooks []BaseHook, auxHooks []AuxiliaryHook) Context
NewContextWithHooks create render templateContext with hooks for validation
type RequiredSecrets ¶ added in v1.0.0
type RequiredSecrets struct {
Namespace string
Name string
ContextName string
Data map[string]interface{}
}
RequiredSecrets is used to store all secret names which are generated by cloud resource components and required by current component