Documentation
¶
Index ¶
- Constants
- func Apply(ctx context.Context, o *APIOptions, storage release.Storage, ...) (*apiv1.Release, error)
- func Destroy(o *APIOptions, rel *apiv1.Release, changes *models.Changes, ...) (*apiv1.Release, error)
- func DestroyPreview(o *APIOptions, planResources *apiv1.Spec, priorResources *apiv1.State, ...) (*models.Changes, error)
- func GenerateSpecWithSpinner(project *v1.Project, stack *v1.Stack, workspace *v1.Workspace, noStyle bool) (*v1.Spec, error)
- func Preview(o *APIOptions, storage release.Storage, planResources *apiv1.Spec, ...) (*opsmodels.Changes, error)
- func ProcessApplyDetails(ctx context.Context, ac *operation.ApplyOperation, err *error, ...)
- func SpecFromFile(filePath string) (*v1.Spec, error)
- func ValidateSpec(spec *v1.Spec) error
- func Watch(ctx context.Context, ac *operation.ApplyOperation, changes *models.Changes, ...)
- type APIOptions
Constants ¶
const JSONOutput = "json"
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply( ctx context.Context, o *APIOptions, storage release.Storage, rel *apiv1.Release, gph *apiv1.Graph, changes *models.Changes, out io.Writer, ) (*apiv1.Release, 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.
func DestroyPreview ¶
func GenerateSpecWithSpinner ¶
func GenerateSpecWithSpinner(project *v1.Project, stack *v1.Stack, workspace *v1.Workspace, noStyle bool) (*v1.Spec, error)
GenerateSpecWithSpinner calls generator to generate versioned Spec. Add a method wrapper for testing purposes.
func Preview ¶
func Preview( o *APIOptions, storage release.Storage, planResources *apiv1.Spec, priorResources *apiv1.State, proj *apiv1.Project, stack *apiv1.Stack, ) (*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 := 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
}
func ProcessApplyDetails ¶ added in v0.14.0
func ProcessApplyDetails( ctx context.Context, ac *operation.ApplyOperation, err *error, wg *sync.WaitGroup, changes *models.Changes, ls *lineSummary, dryRun bool, gphResources *apiv1.GraphResources, gph *apiv1.Graph, rel *apiv1.Release, )
ProcessApplyDetails function will receive the messages of the apply operation and process the details. Fixme: abstract the input variables into a struct.
func ValidateSpec ¶ added in v0.14.0
func Watch ¶
func Watch( ctx context.Context, ac *operation.ApplyOperation, changes *models.Changes, err *error, dryRun bool, watchErrCh chan error, watchTimeout int, gph *apiv1.Graph, rel *apiv1.Release, )
Watch function will observe the changes of each resource by the execution engine.
Example:
o := NewApplyOptions()
kubernetesRuntime, err := runtime.NewKubernetesRuntime()
if err != nil {
return err
}
Watch(o, kubernetesRuntime, planResources, changes, os.Stdout)
if err != nil {
return err
}
Watch function will watch the changed Kubernetes and Terraform resources. Fixme: abstract the input variables into a struct.
Types ¶
type APIOptions ¶
type APIOptions struct {
Operator string
Cluster string
IgnoreFields []string
DryRun bool
MaxConcurrent int
Watch bool
WatchTimeout int
}
func NewAPIOptions ¶
func NewAPIOptions() APIOptions