Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CreateChangeStepFilter = func(c *ChangeStep) bool { return c.Action == Create } UpdateChangeStepFilter = func(c *ChangeStep) bool { return c.Action == Update } DeleteChangeStepFilter = func(c *ChangeStep) bool { return c.Action == Delete } UnChangeChangeStepFilter = func(c *ChangeStep) bool { return c.Action == UnChanged } )
Functions ¶
This section is empty.
Types ¶
type ActionType ¶ added in v0.7.3
type ActionType int64
ActionType represents the kind of operation performed by a plan. It evaluates to its string label.
const ( Undefined ActionType = iota // invalidate value UnChanged // nothing to do. Create // creating a new resource. Update // updating an existing resource. Delete // deleting an existing resource. )
ActionType values
func (ActionType) Ing ¶ added in v0.7.3
func (t ActionType) Ing() string
func (ActionType) MarshalJSON ¶ added in v0.8.1
func (t ActionType) MarshalJSON() ([]byte, error)
func (ActionType) PrettyString ¶ added in v0.7.3
func (t ActionType) PrettyString() string
func (ActionType) String ¶ added in v0.7.3
func (t ActionType) String() string
type ChangeOrder ¶
type ChangeOrder struct { StepKeys []string `json:"stepKeys,omitempty" yaml:"stepKeys,omitempty"` ChangeSteps map[string]*ChangeStep `json:"changeSteps,omitempty" yaml:"changeSteps,omitempty"` }
func (*ChangeOrder) Diffs ¶
func (o *ChangeOrder) Diffs(noStyle bool) 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(ui *terminal.UI) (string, error)
func (*ChangeOrder) Values ¶
func (o *ChangeOrder) Values(filters ...ChangeStepFilterFunc) []*ChangeStep
type ChangeStep ¶
type ChangeStep struct { // the resource id ID string `json:"id,omitempty" yaml:"id,omitempty"` // the operation performed by this step Action ActionType `json:"action,omitempty" yaml:"action,omitempty"` // old data From interface{} `json:"from,omitempty" yaml:"from,omitempty"` // new data To interface{} `json:"to,omitempty" yaml:"to,omitempty"` }
func NewChangeStep ¶
func NewChangeStep(id string, op ActionType, from, to interface{}) *ChangeStep
func (*ChangeStep) Diff ¶
func (cs *ChangeStep) Diff(noStyle bool) (string, error)
Diff compares objects(from and to) which stores in ChangeStep, and return a human-readable string report.
func (*ChangeStep) NoStyleDiff ¶ added in v0.11.1
func (cs *ChangeStep) NoStyleDiff() (string, error)
NoStyleDiff compares objects(from and to) which stores in ChangeStep, and return a string report with no style
type ChangeStepFilterFunc ¶
type ChangeStepFilterFunc func(*ChangeStep) bool
type Changes ¶
type Changes struct { *ChangeOrder `json:",inline" yaml:",inline"` // contains filtered or unexported fields }
func NewChanges ¶
func (*Changes) AllUnChange ¶ added in v0.6.2
type Operation ¶
type Operation struct { // OperationType represents the OperationType of this operation OperationType OperationType // ReleaseStorage represents the storage where state will be saved during this operation ReleaseStorage release.Storage // CtxResourceIndex represents resources updated by this operation CtxResourceIndex map[string]*apiv1.Resource // PriorStateResourceIndex represents resource state saved during the last operation PriorStateResourceIndex map[string]*apiv1.Resource // StateResourceIndex represents resources that will be saved in state.Storage StateResourceIndex map[string]*apiv1.Resource // IgnoreFields will be ignored in preview stage IgnoreFields []string // ChangeOrder is resources' change order during this operation ChangeOrder *ChangeOrder // RuntimeMap contains all infrastructure runtimes involved this operation. The key of this map is the Runtime type RuntimeMap map[apiv1.Type]runtime.Runtime // Stack contains info about where this command is invoked Stack *apiv1.Stack // 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 // WatchCh is used to send the resource IDs that are ready to be watched after sending or executing // the apply request. // Fixme: try to merge the WatchCh with the MsgCh. WatchCh chan string // Lock is the operation-wide mutex Lock *sync.Mutex // Release is the release updated in this operation, and saved in the ReleaseStorage Release *apiv1.Release }
Operation is the base model for all operations
func (*Operation) RefreshResourceIndex ¶
func (o *Operation) RefreshResourceIndex(resourceKey string, resource *apiv1.Resource, actionType ActionType) error
RefreshResourceIndex refresh resources in CtxResourceIndex & StateResourceIndex
func (*Operation) UpdateReleaseState ¶ added in v0.12.0
type OperationType ¶ added in v0.7.3
type OperationType int64
const ( UndefinedOperation OperationType = iota // invalidate value Apply ApplyPreview Destroy DestroyPreview )
Operation type
Click to show internal directories.
Click to hide internal directories.