v1.16.8
This commit is contained in:
@@ -505,3 +505,65 @@ func migrateV2ModeValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
return IsInSlice(fieldValue, migrateV2ModeValues)
|
||||
}
|
||||
|
||||
// pressureThresholdValidator checks if PressureThreshold is in range from 5 to 50
|
||||
func pressureThresholdValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(pressureThresholdMin) && fieldValue <= uint64(pressureThresholdMax)
|
||||
}
|
||||
|
||||
// deflateThresholdValidator checks if DeflateThreshold is in range from 10 to 70
|
||||
func deflateThresholdValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(deflateThresholdMin) && fieldValue <= uint64(deflateThresholdMax)
|
||||
}
|
||||
|
||||
func bufferPCTValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(bufferPCTMin) && fieldValue <= uint64(bufferPCTMax)
|
||||
}
|
||||
|
||||
func guaranteedPCTValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(guaranteedPCTMin) && fieldValue <= uint64(guaranteedPCTMax)
|
||||
}
|
||||
|
||||
func guaranteedABSMinValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(guaranteedABSMinMin) && fieldValue <= uint64(guaranteedABSMinMax)
|
||||
}
|
||||
|
||||
func shrinkThresholdPCTValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(shrinkThresholdPCTMin) && fieldValue <= uint64(shrinkThresholdPCTMax)
|
||||
}
|
||||
|
||||
func balloonMaxShrinkPCTValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(balloonMaxShrinkPCTMin) && fieldValue <= uint64(balloonMaxShrinkPCTMax)
|
||||
}
|
||||
|
||||
func balloonMaxGrowPCTValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(balloonMaxGrowPCTMin) && fieldValue <= uint64(balloonMaxGrowPCTMax)
|
||||
}
|
||||
|
||||
func vmChangeCooldownValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(vmChangeCooldownMin) && fieldValue <= uint64(vmChangeCooldownMax)
|
||||
}
|
||||
|
||||
func emergencyReturnCooldownValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(emergencyReturnCooldownMin) && fieldValue <= uint64(emergencyReturnCooldownMax)
|
||||
}
|
||||
|
||||
func majorFaultThresholdValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().Uint()
|
||||
return fieldValue >= uint64(majorFaultThresholdMin) && fieldValue <= uint64(majorFaultThresholdMax)
|
||||
}
|
||||
|
||||
func logLevelValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
return IsInSlice(fieldValue, logLevelValues)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user