func (h *Hook) Action(obj interface{}, resourceType int, eventType EventType) error {
	var err error
	for actionType, cfg := range h.Config {
		actionEvent, ok := ActionForEventMap[actionType]
		if !ok {
			continue
		}
		if actionEvent.evType != eventType {
			continue
		}
		switch resourceType {
		case ResourceBackendPVC:
			err = pvcHookAction(cfg.BackendPVCConfig, actionEvent.actOp, obj)
			if err != nil {
				return err
			}
		case ResourceBackendPV:
			err = pvHookAction(cfg.BackendPVConfig, actionEvent.actOp, obj)
			if err != nil {
				return err
			}
		case ResourceNFSService:
			err = serviceHookAction(cfg.NFSServiceConfig, actionEvent.actOp, obj)
			if err != nil {
				return err
			}
		case ResourceNFSPV:
			err = pvHookAction(cfg.NFSPVConfig, actionEvent.actOp, obj)
			if err != nil {
				return err
			}
		case ResourceNFSServerDeployment:
			err = deploymentHookAction(cfg.NFSDeploymentConfig, actionEvent.actOp, obj)
			if err != nil {
				return err
			}
		}
	}
	return nil
}
Action run hooks for the given object type as per the event
Action will skip further hook execution if any error occurred
package hook