/* * Copyright (C) Alibaba Cloud Computing * All rights reserved. * * 版权所有 (C)阿里云计算有限公司 */ using System; using System.Collections.Generic; using System.Text; using System.Reflection; using Aliyun.Api.LOG.Utilities; namespace Aliyun.Api.LOG.Utilities { /// /// 表示访问阿里云服务的配置信息。 /// internal class ClientConfiguration : ICloneable { private string _userAgent = LogConsts.CONST_USER_AGENT_PREFIX + typeof(ClientConfiguration).Assembly.GetName().Version.ToString(); private int _connectionTimeout = LogConsts.DEFAULT_SLS_CONNECT_TIMEOUT; private int _maxErrorRetry = LogConsts.DEFAULT_SLS_RETRY_TIME; private int _readWrtTimeout = LogConsts.DEFAULT_SLS_READWRT_TIMEOUT; private int _retryInterval = LogConsts.DEFAULT_SLS_RETRY_INTERVALBASE; public int RetryIntervalBase { get { return _retryInterval; } set { _retryInterval = value; } } public int ReadWriteTimeout { get { return _readWrtTimeout; } set { _readWrtTimeout = value; } } /// /// 获取设置访问请求的User-Agent。 /// public string UserAgent { get { return _userAgent; } set { _userAgent = value; } } /// /// 获取或设置代理服务器的地址。 /// public string ProxyHost { get; set; } /// /// 获取或设置代理服务器的端口。 /// public int ProxyPort {get; set; } /// /// 获取或设置用户名。 /// public string ProxyUserName { get; set; } /// /// 获取或设置密码。 /// public string ProxyPassword { get; set; } /// /// 获取或设置代理服务器授权用户所在的域。 /// public string ProxyDomain { get; set; } /// /// 获取或设置连接的超时时间,单位为毫秒。 /// public int ConnectionTimeout { get { return _connectionTimeout; } set { _connectionTimeout = value; } } /// /// 获取或设置请求发生错误时最大的重试次数。 /// public int MaxErrorRetry { get { return _maxErrorRetry; } set { _maxErrorRetry = value; } } /// /// 初始化新的的实例。 /// public ClientConfiguration() { } /// /// 获取该实例的拷贝。 /// /// 该实例的拷贝。 public object Clone() { ClientConfiguration config = new ClientConfiguration(); config.ConnectionTimeout = this.ConnectionTimeout; config.MaxErrorRetry = this.MaxErrorRetry; config.ProxyDomain = this.ProxyDomain; config.ProxyHost = this.ProxyHost; config.ProxyPassword = this.ProxyPassword; config.ProxyPort = this.ProxyPort; config.ProxyUserName = this.ProxyUserName; config.UserAgent = this.UserAgent; return config; } } }