func()

in mpdev/internal/resources/registry.go [73:95]


func (r *registry) Apply(dryRun bool) error {
	resources, err := r.topologicalSort()
	if err != nil {
		return err
	}

	for _, resource := range resources {
		fmt.Printf("Starting to validate/create resource %+v\n", resource.GetReference())
		applyErr := resource.Apply(r, dryRun)
		if applyErr != nil {
			applyErr := errors.Wrapf(applyErr, "Error in resource %+v\n", resource.GetReference())
			// Accumulate errors if dryRun
			if dryRun {
				err = multierror.Append(applyErr, err)
			} else {
				return applyErr
			}
		}
	}
	fmt.Printf("all resources have been validated/created\n")

	return err
}