private void ValidateSessionCode(string sessionCode) { ValidationResult sessionCodeValidator = new SessionCodeValidator(sessionCode).Validate(); if (!sessionCodeValidator.IsValid) { _messageBuilder.AppendLine(sessionCodeValidator.Message); } }
private string ValidateCurrentUsageAndLimitationsForCurrentUserModel(GetCurrentUsageAndLimitationsForCurrentUserModel validationObj) { ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateRemoveCommandTemplateModel(RemoveCommandTemplateModel model) { ValidateId(model.CommandTemplateId, nameof(model.CommandTemplateId)); ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }
private string ValidateCreateJobModel(CreateJobModel validationObj) { _ = ValidateJobSpecificationExt(validationObj.JobSpecification); ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateListAdaptorUserGroupsModel(ListAdaptorUserGroupsModel validationObj) { ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateGetCurrentInfoForJobModel(GetCurrentInfoForJobModel validationObj) { ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId)); ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateGetAllocatedNodesIPsModel(GetAllocatedNodesIPsModel validationObj) { ValidateId(validationObj.SubmittedTaskInfoId, nameof(validationObj.SubmittedTaskInfoId)); ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateEndDataTransferModel(EndDataTransferModel validationObj) { ValidateDataTransferMethodExt(validationObj.UsedTransferMethod); ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }
private string ValidateGetResourceUsageReportForJobModel(GetResourceUsageReportForJobModel validationObj) { ValidateId(validationObj.JobId, nameof(validationObj.JobId)); ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateCurrentClusterNodeUsageModel(CurrentClusterNodeUsageModel model) { if (model.ClusterNodeId <= 0) { _messageBuilder.AppendLine(MustBeGreaterThanZeroMessage("ClusterNodeId")); } ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }
private string ValidateCreateCommandTemplateModel(CreateCommandTemplateModel model) { ValidateId(model.GenericCommandTemplateId, nameof(model.GenericCommandTemplateId)); ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } if (ContainsIllegalCharactersForPath(model.ExecutableFile)) { _messageBuilder.AppendLine("ExecutableFile contains illegal characters."); } return(_messageBuilder.ToString()); }
private string ValidateGetUserGroupResourceUsageReportModel(GetUserGroupResourceUsageReportModel model) { ValidateId(model.GroupId, nameof(model.GroupId)); if (model.StartTime > model.EndTime) { _messageBuilder.AppendLine("StartTime must be before EndTime"); } ValidationResult validationResult = new SessionCodeValidator(model.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateCopyJobDataToTempModel(CopyJobDataToTempModel validationObj) { ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId)); ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } validationResult = new PathValidator(validationObj.Path).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateGetCommandTemplateParametersNameModele(GetCommandTemplateParametersNameModel model) { if (model.CommandTemplateId <= 0) { _messageBuilder.AppendLine(MustBeGreaterThanZeroMessage("CommandTemplateId")); } if (ContainsIllegalCharactersForPath(model.UserScriptPath)) { _messageBuilder.AppendLine("UserScriptPath contains illegal characters."); } ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }
private string ValidateHttpGetToJobNodeModel(HttpGetToJobNodeModel validationObj) { if (string.IsNullOrEmpty(validationObj.NodeIPAddress)) { _messageBuilder.AppendLine("IpAddress must be set"); } else if (!IsIpAddress(validationObj.NodeIPAddress)) { _messageBuilder.AppendLine("Ip address has unknown format. If using ipv6, please try to specify 'full address' without shortening."); } if (string.IsNullOrEmpty(validationObj.HttpRequest)) { _messageBuilder.AppendLine("HttpRequest must be set"); } if (!validationObj.HttpHeaders.Any()) { _messageBuilder.AppendLine("HttpHeader must be set"); } if (validationObj.HttpHeaders.Any(httpHeader => string.IsNullOrEmpty(httpHeader.Name) || string.IsNullOrEmpty(httpHeader.Value))) { _messageBuilder.AppendLine("HttpHeader must be set"); } ValidatePort(validationObj.NodePort); ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId)); ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }
private string ValidateGetDataTransferMethodModel(GetDataTransferMethodModel validationObj) { if (string.IsNullOrEmpty(validationObj.IpAddress)) { _messageBuilder.AppendLine("IpAddress must be set"); } else if (!IsIpAddress(validationObj.IpAddress)) { _messageBuilder.AppendLine("Ip address has unknown format. If using ipv6, please try to specify 'full address' without shortening."); } ValidatePort(validationObj.Port); ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId)); ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate(); if (!sessionCodeValidation.IsValid) { _messageBuilder.AppendLine(sessionCodeValidation.Message); } return(_messageBuilder.ToString()); }