38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using LCU.Library.Internal.ApiResponse.Models;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System;
|
|
|
|
namespace LCU.Api.Internal.FTPLib.Models
|
|
{
|
|
[Obsolete("Please use SftpDownloadFileRequest and SshFtpRequst Models")]
|
|
public class SftpRequest : ReturnResponse, IValidatableObject
|
|
{
|
|
[Required]
|
|
public ProtocolType Protocol { get; set; }
|
|
[Required]
|
|
public string HostName { get; set; }
|
|
[Required, Range(1, 999999)]
|
|
public int PortNumber { get; set; } = 22;
|
|
[Required]
|
|
public string UserName { get; set; }
|
|
[Required]
|
|
public string Password { get; set; }
|
|
[Required]
|
|
public string SshHostKeyFingerprint { get; set; }
|
|
public string LocalFilePath { get; set; }
|
|
[Required]
|
|
public string RemoteFilePath { get; set; }
|
|
public byte[] LocalFileData { get; set; }
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(LocalFilePath) && LocalFileData == null)
|
|
{
|
|
yield return new ValidationResult(
|
|
$"One of LocalFilePath or LocalFileData bytes are required.",
|
|
new[] {nameof(LocalFileData), nameof(LocalFilePath)});
|
|
}
|
|
}
|
|
}
|
|
} |