Documentation ¶
Overview ¶
Package models contains internal models of operations todo CLI imports this package directly. We need to make this pkg internal
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CreateChangeStepFilter = func(c *ChangeStep) bool { return c.Action == types.Create } UpdateChangeStepFilter = func(c *ChangeStep) bool { return c.Action == types.Update } DeleteChangeStepFilter = func(c *ChangeStep) bool { return c.Action == types.Delete } UnChangeChangeStepFilter = func(c *ChangeStep) bool { return c.Action == types.UnChange } )
Functions ¶
This section is empty.
Types ¶
type ChangeOrder ¶
type ChangeOrder struct { StepKeys []string ChangeSteps map[string]*ChangeStep }
func (*ChangeOrder) Diffs ¶
func (o *ChangeOrder) Diffs() string
func (*ChangeOrder) Get ¶
func (o *ChangeOrder) Get(key string) *ChangeStep
func (*ChangeOrder) OutputDiff ¶
func (o *ChangeOrder) OutputDiff(target string)
func (*ChangeOrder) PromptDetails ¶
func (o *ChangeOrder) PromptDetails() (string, error)
func (*ChangeOrder) Values ¶
func (o *ChangeOrder) Values(filters ...ChangeStepFilterFunc) []*ChangeStep
type ChangeStep ¶
type ChangeStep struct { ID string // the resource id Action types.ActionType // the operation performed by this step. From interface{} // old data To interface{} // new data }
func NewChangeStep ¶
func NewChangeStep(id string, op types.ActionType, from, to interface{}) *ChangeStep
func (*ChangeStep) Diff ¶
func (cs *ChangeStep) Diff() (string, error)
Diff compares objects(from and to) which stores in ChangeStep, and return a human-readable string report.
type ChangeStepFilterFunc ¶
type ChangeStepFilterFunc func(*ChangeStep) bool
type Changes ¶
type Changes struct { *ChangeOrder // contains filtered or unexported fields }
func NewChanges ¶
func NewChanges(p *projectstack.Project, s *projectstack.Stack, order *ChangeOrder) *Changes
func (*Changes) Project ¶
func (p *Changes) Project() *projectstack.Project
func (*Changes) Stack ¶
func (p *Changes) Stack() *projectstack.Stack
type Operation ¶
type Operation struct { // OperationType represents the OperationType of this operation OperationType types.OperationType // StateStorage represents the storage where state will be saved during this operation StateStorage states.StateStorage // CtxResourceIndex represents resources updated by this operation CtxResourceIndex map[string]*models.Resource // PriorStateResourceIndex represents resource state saved during the last operation PriorStateResourceIndex map[string]*models.Resource // StateResourceIndex represents resources that will be saved in states.StateStorage StateResourceIndex map[string]*models.Resource // ChangeOrder is resources' change order during this operation ChangeOrder *ChangeOrder // Runtime is the resource infrastructure runtime of this operation Runtime runtime.Runtime // MsgCh is used to send operation status like Success, Failed or Skip to Kusion CTl, // and this message will be displayed in the terminal MsgCh chan Message // Lock is the operation-wide mutex Lock *sync.Mutex // ResultState is the final State build by this operation, and this State will be saved in the StateStorage ResultState *states.State }
Operation is the base model for all operations
func (*Operation) InitStates ¶
func (*Operation) RefreshResourceIndex ¶
func (o *Operation) RefreshResourceIndex(resourceKey string, resource *models.Resource, actionType types.ActionType) error
RefreshResourceIndex refresh resources in CtxResourceIndex & StateResourceIndex
Click to show internal directories.
Click to hide internal directories.