Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdPreview ¶
NewCmdPreview creates the `preview` command.
func Preview ¶
func Preview( opts *PreviewOptions, storage release.Storage, planResources *apiv1.Spec, priorResources *apiv1.State, project *apiv1.Project, stack *apiv1.Stack, ) (*models.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 := newPreviewOptions() 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 }
Types ¶
type PreviewFlags ¶
type PreviewFlags struct { MetaFlags *meta.MetaFlags Detail bool All bool NoStyle bool Output string SpecFile string IgnoreFields []string Values []string UI *terminal.UI genericiooptions.IOStreams }
PreviewFlags directly reflect the information that CLI is gathering via flags. They will be converted to PreviewOptions, which reflect the runtime requirements for the command.
This structure reduces the transformation to wiring and makes the logic itself easy to unit test.
func NewPreviewFlags ¶ added in v0.11.1
func NewPreviewFlags(ui *terminal.UI, streams genericiooptions.IOStreams) *PreviewFlags
NewPreviewFlags returns a default PreviewFlags
func (*PreviewFlags) AddFlags ¶ added in v0.11.1
func (f *PreviewFlags) AddFlags(cmd *cobra.Command)
AddFlags registers flags for a cli.
func (*PreviewFlags) ToOptions ¶ added in v0.11.1
func (f *PreviewFlags) ToOptions() (*PreviewOptions, error)
ToOptions converts from CLI inputs to runtime inputs.
type PreviewOptions ¶
type PreviewOptions struct { *meta.MetaOptions Detail bool All bool NoStyle bool Output string SpecFile string IgnoreFields []string Values []string UI *terminal.UI genericiooptions.IOStreams }
PreviewOptions defines flags and other configuration parameters for the `preview` command.
func (*PreviewOptions) Run ¶
func (o *PreviewOptions) Run() error
Run executes the `preview` command.