func CreateMutateHandler(ruleName string, mutate *kyverno.Mutation, patchedResource unstructured.Unstructured, context context.EvalInterface, logger logr.Logger, foreachIndex int) Handler {
	switch {
	case isPatchStrategicMerge(mutate):
		return newPatchStrategicMergeHandler(ruleName, mutate, patchedResource, context, logger)
	case isPatchesJSON6902(mutate):
		return newPatchesJSON6902Handler(ruleName, mutate, patchedResource, logger)
	case isOverlay(mutate):
		mutate.PatchStrategicMerge = mutate.Overlay
		var a interface{}
		mutate.Overlay = a
		return newPatchStrategicMergeHandler(ruleName, mutate, patchedResource, context, logger)
	case isPatches(mutate):
		return newPatchesHandler(ruleName, mutate, patchedResource, context, logger)
	case isForEach(mutate):
		return newForEachHandler(ruleName, mutate, patchedResource, context, logger, foreachIndex)
	default:
		return newEmptyHandler(patchedResource)
	}
}
CreateMutateHandler initilizes a new instance of mutation handler
package mutate
import (
	"github.com/go-logr/logr"
	kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
	"github.com/kyverno/kyverno/pkg/engine/context"
	"github.com/kyverno/kyverno/pkg/engine/response"
	"github.com/kyverno/kyverno/pkg/engine/utils"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
type Handler interface {
	Handle() (resp response.RuleResponse, newPatchedResource unstructured.Unstructured)
}