func (r *AccessToken) ValidateDelete() error {
	accesstokenlog.Info("validate delete", "name", r.Name)
	return nil
}
ValidateDelete implements webhook.Validator so a webhook will be registered for the type
package v1alpha1
import (
	"crypto/sha256"
	"encoding/hex"
	"fmt"
	apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
	"k8s.io/apimachinery/pkg/runtime"
	ctrl "sigs.k8s.io/controller-runtime"
	logf "sigs.k8s.io/controller-runtime/pkg/log"
	"sigs.k8s.io/controller-runtime/pkg/webhook"
)
var accesstokenlog = logf.Log.WithName("accesstoken-resource")
func (r *AccessToken) SetupWebhookWithManager(mgr ctrl.Manager) error {
	return ctrl.NewWebhookManagedBy(mgr).
		For(r).
		Complete()
}
var _ webhook.Defaulter = &AccessToken{}
func (r *AccessToken) Default() {
	accesstokenlog.Info("default", "name", r.Name)
}
var _ webhook.Validator = &AccessToken{}
func (r *AccessToken) ValidateCreate() error {
	accesstokenlog.Info("validate create", "name", r.Name)
	if err := r.validate(); err != nil {
		return err
	}
	return nil
}
func (r *AccessToken) ValidateUpdate(old runtime.Object) error {
	accesstokenlog.Info("validate update", "name", r.Name)
	if oldAccessToken, ok := old.(*AccessToken); !ok {
		return fmt.Errorf("old object is not an access token")
	} else {
		if r.Spec.Creator != oldAccessToken.Spec.Creator {
			return fmt.Errorf("Can't modify creator")
		}
	}
	if oldAccessToken, ok := old.(*AccessToken); !ok {
		return fmt.Errorf("old object is not an access token")
	} else {
		if r.Spec.Token != oldAccessToken.Spec.Token {
			return fmt.Errorf("Can't modify token")
		}
	}
	return r.validate()
}
func GetAccessTokenNameFromToken(token string) string {
	tokenHash := sha256.Sum256([]byte(token))
	return hex.EncodeToString(tokenHash[:])
}