Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶ added in v0.4.4
func Apply( o *ApplyOptions, runtime runtime.Runtime, storage states.StateStorage, planResources *models.Spec, changes *opsmodels.Changes, out io.Writer, ) error
The Apply function will apply the resources changes through the execution Kusion Engine, and will save the state to specified storage.
You can customize the runtime of engine and the state storage through `runtime` and `storage` parameters.
Example:
o := NewApplyOptions() stateStorage := &states.FileSystemState{ Path: filepath.Join(o.WorkDir, states.KusionState) } kubernetesRuntime, err := runtime.NewKubernetesRuntime() if err != nil { return err } err = Apply(o, kubernetesRuntime, stateStorage, planResources, changes, os.Stdout) if err != nil { return err }
func NewCmdApply ¶
func Preview ¶ added in v0.4.4
func Preview( o *ApplyOptions, runtime runtime.Runtime, storage states.StateStorage, planResources *models.Spec, project *projectstack.Project, stack *projectstack.Stack, out io.Writer, ) (*opsmodels.Changes, error)
The Preview function calculates the upcoming actions of each resource through the execution Kusion Engine, and you can customize the runtime of engine and the state storage through `runtime` and `storage` parameters.
Example:
o := NewApplyOptions() stateStorage := &states.FileSystemState{ Path: filepath.Join(o.WorkDir, states.KusionState) } kubernetesRuntime, err := runtime.NewKubernetesRuntime() if err != nil { return err } changes, err := Preview(o, kubernetesRuntime, stateStorage, planResources, project, stack, os.Stdout) if err != nil { return err }
todo @elliotxx io.Writer is not used now
Types ¶
type ApplyOptions ¶
type ApplyOptions struct { compilecmd.CompileOptions Operator string Yes bool Detail bool NoStyle bool DryRun bool OnlyPreview bool }
ApplyOptions defines flags for the `apply` command
func NewApplyOptions ¶
func NewApplyOptions() *ApplyOptions
NewApplyOptions returns a new ApplyOptions instance
func (*ApplyOptions) Complete ¶
func (o *ApplyOptions) Complete(args []string)
func (*ApplyOptions) Run ¶
func (o *ApplyOptions) Run() error
func (*ApplyOptions) Validate ¶
func (o *ApplyOptions) Validate() error
Click to show internal directories.
Click to hide internal directories.