代码拉取完成,页面将自动刷新
package logging
import (
"fmt"
"github.com/rancher/norman/httperror"
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/convert"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"github.com/rancher/rancher/pkg/controllers/user/logging/utils"
)
func ClusterLoggingValidator(resquest *types.APIContext, schema *types.Schema, data map[string]interface{}) error {
var clusterLogging v3.ClusterLoggingSpec
if err := convert.ToObj(data, &clusterLogging); err != nil {
return httperror.NewAPIError(httperror.InvalidBodyContent, fmt.Sprintf("%v", err))
}
wp := utils.WrapClusterLogging{
ClusterLoggingSpec: clusterLogging,
}
if err := wp.Validate(); err != nil {
logrus.Warnf("clusterlogging %s input validate failed, %v", resquest.ID, err)
return httperror.NewAPIError(httperror.InvalidFormat, fmt.Sprintf("%v", err))
}
return nil
}
func ProjectLoggingValidator(resquest *types.APIContext, schema *types.Schema, data map[string]interface{}) error {
var projectLogging v3.ProjectLoggingSpec
if err := convert.ToObj(data, &projectLogging); err != nil {
return httperror.NewAPIError(httperror.InvalidBodyContent, fmt.Sprintf("%v", err))
}
wp := utils.WrapProjectLogging{
ProjectLoggingSpec: projectLogging,
}
if err := wp.Validate(); err != nil {
logrus.Warnf("projectlogging %s input validate failed, %v", resquest.ID, err)
return httperror.NewAPIError(httperror.InvalidFormat, fmt.Sprintf("%v", err))
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。