Documentation ¶
Index ¶
- Constants
- Variables
- func NewBaseNode(id string) (*baseNode, status.Status)
- func ReplaceImplicitRef(v reflect.Value, resourceIndex map[string]*models.Resource, ...) ([]string, reflect.Value, status.Status)
- func ReplaceRef(v reflect.Value, resourceIndex map[string]*models.Resource, ...) ([]string, reflect.Value, status.Status)
- func ReplaceSecretRef(v reflect.Value, ss *vals.SecretStores) ([]string, reflect.Value, status.Status)
- type ExecutableNode
- type ResourceNode
- type RootNode
Constants ¶
View Source
const (
ImplicitRefPrefix = "$kusion_path."
)
Variables ¶
View Source
var ImplicitReplaceFun = func(resourceIndex map[string]*models.Resource, refPath string) (reflect.Value, status.Status) { const Sep = "." split := strings.Split(refPath, Sep) key := split[0] priorState := resourceIndex[key] if priorState == nil { msg := fmt.Sprintf("can't find resource by key:%s when replacing %s", key, refPath) return reflect.Value{}, status.NewErrorStatusWithMsg(status.IllegalManifest, msg) } attributes := priorState.Attributes if attributes == nil { msg := fmt.Sprintf("attributes is nil in resource:%s", key) return reflect.Value{}, status.NewErrorStatusWithMsg(status.IllegalManifest, msg) } var valueMap interface{} valueMap = attributes if len(split) > 1 { split := split[1:] for _, k := range split { if valueMap.(map[string]interface{})[k] == nil { msg := fmt.Sprintf("can't find specified value in resource:%s by ref:%s", key, refPath) return reflect.Value{}, status.NewErrorStatusWithMsg(status.IllegalManifest, msg) } valueMap = valueMap.(map[string]interface{})[k] } } return reflect.ValueOf(valueMap), nil }
Functions ¶
func NewBaseNode ¶
func ReplaceImplicitRef ¶ added in v0.7.4
func ReplaceRef ¶ added in v0.7.4
func ReplaceRef( v reflect.Value, resourceIndex map[string]*models.Resource, replaceImplicitDependencyFun func(map[string]*models.Resource, string) (reflect.Value, status.Status), ss *vals.SecretStores, replaceSecretFun func(string, string, *vals.SecretStores) (string, error), ) ([]string, reflect.Value, status.Status)
Types ¶
type ExecutableNode ¶
type ResourceNode ¶
type ResourceNode struct { Action opsmodels.ActionType // contains filtered or unexported fields }
func NewResourceNode ¶
func NewResourceNode(key string, state *models.Resource, action opsmodels.ActionType) (*ResourceNode, status.Status)
func (*ResourceNode) Execute ¶
func (rn *ResourceNode) Execute(operation *opsmodels.Operation) status.Status
func (*ResourceNode) PreExecute ¶ added in v0.7.4
func (rn *ResourceNode) PreExecute(o *opsmodels.Operation) status.Status
func (*ResourceNode) State ¶
func (rn *ResourceNode) State() *models.Resource
Click to show internal directories.
Click to hide internal directories.