def _validate_integer(cls, param, max_value = None, min_value = None): try: value = int(param) except ValueError: raise ValidationError(ValidationMessage.InvalidNumber.format(param)) if max_value is not None and max_value < value: raise ValidationError(ValidationMessage.NumberTooBig.format(value)) if min_value is not None and min_value > value: raise ValidationError(ValidationMessage.NumberTooSmall.format(value))
def validate_region(cls, parameter_pool, source): if (parameter_pool.has(ParameterName.Region)): region = parameter_pool.get_value(ParameterName.Region) if region not in ServiceRegion: raise ValidationError(ValidationMessage.InvalidRegion.\ format(region))
def _validate_string(cls, value, name): if len(value) < 1: raise ValidationError(ValidationMessage.EmptyString.format(name))