<PackageReference Include="Relativity.Transfer.Client" Version="6.2.4" />

AsperaClientConfiguration

using Relativity.Transfer.Aspera.Resources; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; namespace Relativity.Transfer.Aspera { [Serializable] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The name is more appropriate for its usage.")] public class AsperaClientConfiguration : ClientConfiguration { public const bool DefaultConnectionCheckAsperaCredentialCacheEnable = true; public const int DefaultDocRootLevels = 1; public const int DefaultHealthCheckLogMaxLine = 100; public const int DefaultMetaThreadCount = 0; public const int DefaultWriteThreadCount = 0; public const int DefaultScanThreadCount = 0; public const int DefaultReadThreadCount = 0; public const bool DefaultCreateDirectories = true; public const string DefaultEncryptionCipher = "AES_256"; public const bool DefaultFaspDebugEnabled = false; public const int DefaultMaxNonFatalStatsRetryAttempts = 5; public const string DefaultOverwritePolicy = "ALWAYS"; public const string DefaultPartialFileSuffix = ".partial"; public const string DefaultResumeSuffix = ".aspx"; public const string DefaultPolicy = "FAIR"; public const string DefaultResumeCheck = "OFF"; public const bool DefaultSaveBeforeOverwriteEnabled = false; public const int DefaultTcpPort = 33001; public const int DefaultUdpPortStartRange = 33001; public const int DefaultUdpPortEndRange = 33050; public const string DefaultTestConnectionDestinationPath = "/FTA/TestConnectionResults"; public const AscpVersion DefaultAscpVersion = AscpVersion.Stable; public const bool DefaultUseAscp4 = false; public const int DefaultDatagramSize = 0; private const int FaspMinAllowedDatagramValue = 296; private const int FaspMaxAllowedDatagramValue = 10000; [ConfigurationDoc("aspera-account-username", "The optional Aspera account username.This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public string AccountUserName { get { return this.GetStringValue("aspera-account-username", null); } set { base["aspera-account-username"] = value; } } [ConfigurationDoc("aspera-account-password", "The optional Aspera account password. This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public string AccountPassword { get { return this.GetStringValue("aspera-account-password", null); } set { base["aspera-account-password"] = value; } } [ConfigurationDoc("aspera-doc-root-levels", "The number of levels the Aspera doc root folder is relative to the File share Resource Server UNC path. This should never be changed unless the server configuration has deviated from the default.", 1)] public int DocRootLevels { get { return this.GetInt32Value("aspera-doc-root-levels", 1); } set { base["aspera-doc-root-levels"] = value; } } [ConfigurationDoc("health-check-log-max-line", "The maximum number of lines to retrieve from the Aspera transfer log when performing a diagnostic check.", 100)] public int HealthCheckLogMaxLine { get { return this.GetInt32Value("health-check-log-max-line", 100); } set { base["health-check-log-max-line"] = value; } } [ConfigurationDoc("aspera-host", "The optional Aspera host name.This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public Uri Host { get { return this.GetUriValue("aspera-host", null); } set { base["aspera-host"] = ((value != (Uri)null) ? value.ToString() : null); } } [ConfigurationDoc("aspera-create-directories", "Enable or disable whether to automatically create directories when they don't already exist.", true)] public bool CreateDirectories { get { return this.GetBooleanValue("aspera-create-directories", true); } set { base["aspera-create-directories"] = value.ToString(); } } [ConfigurationDoc("aspera-encryption-cipher", "The cipher used to encrypt all transferred data. Accepted values include: NONE|AES_128|AES_192|AES_256.", "AES_256", "NONE|AES_128|AES_192|AES_256")] public string EncryptionCipher { get { return this.GetStringValue("aspera-encryption-cipher", "AES_256"); } set { base["aspera-encryption-cipher"] = value; } } [ConfigurationDoc("aspera-fasp-debug-enabled", "Enable or disable whether to apply debug logging to the transfer logs.", false)] public bool FaspDebugEnabled { get { return this.GetBooleanValue("aspera-fasp-debug-enabled", false); } set { base["aspera-fasp-debug-enabled"] = value.ToString(); } } [ConfigurationDoc("aspera-meta-threadcount", "The number of threads the Aspera receiver uses to create directories or 0 byte files. It takes effect on both client and server, when acting as a receiver. The default of zero causes the Aspera receiver to use its internal default, which may vary by operating system. This is a performance-tuning parameter for an Aspera receiver.", 0)] public int MetaThreadCount { get { return this.GetInt32Value("aspera-meta-threadcount", 0); } set { base["aspera-meta-threadcount"] = value.ToString(); } } [ConfigurationDoc("node-aspera-account-username", "The optional Aspera Node API account user name.This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public string NodeAccountUserName { get { return this.GetStringValue("node-aspera-account-username", null); } set { base["node-aspera-account-username"] = value; } } [ConfigurationDoc("node-aspera-account-password", "The optional Aspera Node API account password.This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public string NodeAccountPassword { get { return this.GetStringValue("node-aspera-account-password", null); } set { base["node-aspera-account-password"] = value; } } [ConfigurationDoc("node-aspera-host", "The optional Aspera Node API host name.This should only be set when overriding the auto-configured credential. This is retrieved from the workspace's default file share when the client is first initialized.")] public Uri NodeHost { get { return this.GetUriValue("node-aspera-host", null); } set { base["node-aspera-host"] = ((value != (Uri)null) ? value.ToString() : null); } } [ConfigurationDoc("aspera-overwrite-policy", "The policy that determines whether to overwrite files at the target path. The transfer job will fail when this option is disabled and target paths already exist.", "ALWAYS", "DIFFERENT|ALWAYS|DIFFERENT_AND_OLDER|NEVER|OLDER")] public string OverwritePolicy { get { return this.GetStringValue("aspera-overwrite-policy", "ALWAYS"); } set { base["aspera-overwrite-policy"] = value; } } [ConfigurationDoc("aspera-partialfile-suffix", "The filename extension on the destination computer while the file is being transferred. Once the file has been completely transferred, this filename extension is removed. This must be specified when the OverwritePolicy is set.", ".partial")] public string PartialFileSuffix { get { return this.GetStringValue("aspera-partialfile-suffix", ".partial"); } set { base["aspera-partialfile-suffix"] = value; } } [ConfigurationDoc("aspera-resume-suffix", "Filename extension for aspera temporary transfer file that will be created for each file, while it's being transferred. Once the file has been completely transferred, this file will be removed")] public string ResumeSuffix { get { return this.GetStringValue("aspera-resume-suffix", ".aspx"); } set { base["aspera-resume-suffix"] = value; } } [ConfigurationDoc("aspera-policy", "The default transfer rate and bandwidth policy. Care must be taken when deviating from the default FAIR policy since it can cause significant transfer errors if an overly aggressive setting is used.", "FAIR", "FAIR|FIXED|HIGH|LOW")] public string Policy { get { return this.GetStringValue("aspera-policy", "FAIR"); } set { base["aspera-policy"] = value; } } [ConfigurationDoc("aspera-read-threadcount", "The number of threads the Aspera sender uses to read file contents from the source disk drive. It takes effect on both client and server when acting as a sender. The default of zero causes the Aspera sender to use its internal default, which may vary by operating system. This is a performance-tuning parameter for an Aspera sender.", 0)] public int ReadThreadCount { get { return this.GetInt32Value("aspera-read-threadcount", 0); } set { base["aspera-read-threadcount"] = value.ToString(); } } [ConfigurationDoc("aspera-resume-check", "The resume policy for partially transferred files. When specified, retry attempts can take longer if the dataset includes a large number of small files. Accepted values include: FILE_ATTRIBUTES|FULL_CHECKSUM|OFF|SPARSE_CHECKSUM.", "OFF", "FILE_ATTRIBUTES|FULL_CHECKSUM|OFF|SPARSE_CHECKSUM")] public string ResumeCheck { get { return this.GetStringValue("aspera-resume-check", "OFF"); } set { base["aspera-resume-check"] = value; } } [ConfigurationDoc("aspera-save-before-overwrite-enabled", "Enable or disable whether to modify a filename that would overwrite an existing file by renaming to filename.yyyy.mm.dd.hh.mm.ss.index.ext (where index is set to 1 at the beginning of each new second and incremented for each file saved in this manner during the same second) in the same directory before writing the new file. File attributes are maintained in the renamed file.", false)] public bool SaveBeforeOverwriteEnabled { get { return this.GetBooleanValue("aspera-save-before-overwrite-enabled", false); } set { base["aspera-save-before-overwrite-enabled"] = value.ToString(); } } [ConfigurationDoc("aspera-scan-threadcount", "The number of threads the Aspera sender uses to scan directory contents. It takes effect on both client and server, when acting as a sender. The default of zero causes the Aspera sender to use its internal default. This is a performance-tuning parameter for an Aspera sender.", 0)] public int ScanThreadCount { get { return this.GetInt32Value("aspera-scan-threadcount", 0); } set { base["aspera-scan-threadcount"] = value.ToString(); } } [ConfigurationDoc("aspera-security-token", "The security token used to setup an ATS transfer.", "")] public string SecurityToken { get { return this.GetStringValue("aspera-security-token", string.Empty); } set { base["aspera-security-token"] = value; } } [ConfigurationDoc("aspera-ssh-private-key-file", "The SSH private key file used to support SSH public key authentication.", "")] public string SshPrivateKeyFile { get { return this.GetStringValue("aspera-ssh-private-key-file", null); } set { base["aspera-ssh-private-key-file"] = value; } } [ConfigurationDoc("aspera-ssh-passphrase", "The optional SSH passphrase used to secure the private key.", "")] public string SshPassphrase { get { return this.GetStringValue("aspera-ssh-passphrase", null); } set { base["aspera-ssh-passphrase"] = value; } } [ConfigurationDoc("aspera-tcp-port", "The TCP port used for transfer initialization.", 33001)] public int TcpPort { get { return this.GetInt32Value("aspera-tcp-port", 33001); } set { base["aspera-tcp-port"] = value.ToString(); } } [ConfigurationDoc("aspera-testconnection-destination-path", "The remote destination path where all test connection zero-byte files are transferred.", "/FTA/TestConnectionResults")] public string TestConnectionDestinationPath { get { return this.GetStringValue("aspera-testconnection-destination-path", "/FTA/TestConnectionResults"); } set { base["aspera-testconnection-destination-path"] = value; } } [ConfigurationDoc("aspera-udp-port-start-range", "The UDP start port range used for transferring data.", 33001)] public int UdpPortStartRange { get { return this.GetInt32Value("aspera-udp-port-start-range", 33001); } set { base["aspera-udp-port-start-range"] = value.ToString(); } } [ConfigurationDoc("aspera-udp-port-end-range", "The UDP end port range used for transferring data.", 33050)] public int UdpPortEndRange { get { return this.GetInt32Value("aspera-udp-port-end-range", 33050); } set { base["aspera-udp-port-end-range"] = value.ToString(); } } [ConfigurationDoc("aspera-write-threadcount", "The number of threads the Aspera receiver uses to write the file contents to the destination disk drive. It takes effect on both client and server, when acting as a receiver. The default of zero causes the Aspera receiver to use its internal default, which may vary by operating system. This is a performance-tuning parameter for an Aspera receiver.", 0)] public int WriteThreadCount { get { return this.GetInt32Value("aspera-write-threadcount", 0); } set { base["aspera-write-threadcount"] = value.ToString(); } } [ConfigurationDoc("ascp-version", "Dictates should Ascp be used in Stable or Experimental version", AscpVersion.Stable)] public AscpVersion AscpClientVersion { get { return this.GetEnumValue("ascp-version", AscpVersion.Stable); } set { base["ascp-version"] = value; } } [ConfigurationDoc("use-ascp4", "Dictates should Ascp or Ascp4 be used", false)] public bool UseAscp4 { get { return this.GetBooleanValue("use-ascp4", false); } set { base["use-ascp4"] = value; } } [ConfigurationDoc("aspera-datagram-size", "Specify the datagram size(MTU) for fasp to use.Otherwise fasp will automatically use the detected path MTU.Default: 0(use detected)", 0)] public int DatagramSize { get { int int32Value = this.GetInt32Value("aspera-datagram-size", 0); ValidateDatagramSize(int32Value); return int32Value; } set { ValidateDatagramSize(value); base["aspera-datagram-size"] = value.ToString(); } } public AsperaClientConfiguration() { Initialize(); } public AsperaClientConfiguration(IDictionary<string, object> properties) : base(properties) { Initialize(); } public AsperaClientConfiguration(ClientConfiguration configuration) : base(configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); base.Credential = configuration.Credential; } protected AsperaClientConfiguration(SerializationInfo info, StreamingContext context) : base(info, context) { Initialize(); } private static void ValidateDatagramSize(int datagramValue) { if (datagramValue != 0 && (datagramValue < 296 || datagramValue > 10000)) throw new ArgumentOutOfRangeException(string.Format(AsperaStrings.DatagramOutOfRangeMessage, 296, 10000)); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); } private void Initialize() { AccountPassword = string.Empty; AccountUserName = string.Empty; base.ClientId = new Guid("812A70A5-7311-46CC-BE53-07BB8C5F9A7D"); base.Client = WellKnownTransferClient.Aspera; CreateDirectories = true; DocRootLevels = 1; EncryptionCipher = "AES_256"; FaspDebugEnabled = false; Host = null; MetaThreadCount = 0; OverwritePolicy = "ALWAYS"; PartialFileSuffix = ".partial"; Policy = "FAIR"; ReadThreadCount = 0; ResumeCheck = "OFF"; SaveBeforeOverwriteEnabled = false; ScanThreadCount = 0; SshPassphrase = null; SshPrivateKeyFile = null; SecurityToken = string.Empty; TcpPort = 33001; TestConnectionDestinationPath = "/FTA/TestConnectionResults"; UdpPortEndRange = 33050; UdpPortStartRange = 33001; WriteThreadCount = 0; } } }