using Cloud.Requests; using FluentValidation; namespace Cloud.Validation { public class FarmValidator : AbstractValidator { public FarmValidator() { RuleFor(request => request.RaspberryIP) .NotEmpty().WithMessage("IP address can't be empty") .Matches(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$").WithMessage("IP address is not valid"); RuleFor(request => request.Name) .NotEmpty().WithMessage("Name can't be empty"); } } }