func (in *AWSChaosAction) Validate(root interface{}, path *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	switch *in {
	case Ec2Stop, DetachVolume:
	case Ec2Restart:
	default:
		err := fmt.Errorf("awschaos have unknown action type")
		log.Error(err, "Wrong AWSChaos Action type")
		allErrs = append(allErrs, field.Invalid(path, in, err.Error()))
	}
	return allErrs
}
ValidateScheduler validates the scheduler and duration
package v1alpha1
import (
	"fmt"
	"reflect"
	"k8s.io/apimachinery/pkg/util/validation/field"
	"github.com/chaos-mesh/chaos-mesh/api/v1alpha1/genericwebhook"
)
type EbsVolume string
type AWSDeviceName string
func (in *EbsVolume) Validate(root interface{}, path *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	awsChaos := root.(*AWSChaos)
	if awsChaos.Spec.Action == DetachVolume {
		if in == nil {
			err := fmt.Errorf("the ID of EBS volume should not be empty on %s action", awsChaos.Spec.Action)
			allErrs = append(allErrs, field.Invalid(path, in, err.Error()))
		}
	}
	return allErrs
}
func (in *AWSDeviceName) Validate(root interface{}, path *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	awsChaos := root.(*AWSChaos)
	if awsChaos.Spec.Action == DetachVolume {
		if in == nil {
			err := fmt.Errorf("the name of device should not be empty on %s action", awsChaos.Spec.Action)
			allErrs = append(allErrs, field.Invalid(path, in, err.Error()))
		}
	}
	return allErrs
}