internal StorageClient(StorageServiceCenter serviceCenter)
		{
			if(serviceCenter == null)
				throw new ArgumentNullException("serviceCenter");

			_serviceCenter = serviceCenter;
		}
		public StorageSearchResultResolver(StorageServiceCenter serviceCenter, HttpClient client, Func<string, string> getUrl = null)
		{
			if(serviceCenter == null)
				throw new ArgumentNullException("serviceCenter");

			if(client == null)
				throw new ArgumentNullException("client");

			_client = client;
			_serviceCenter = serviceCenter;
			_getUrl = getUrl;
		}
Esempio n. 3
0
        private StorageClient CreateClient(string bucketName)
        {
            //确认OSS对象存储配置
            var configuration = this.EnsureConfiguration();

            //获取指定名称的存储器配置项
            configuration.Buckets.TryGet(bucketName, out var bucket);

            var region      = this.GetRegion(bucket);
            var center      = StorageServiceCenter.GetInstance(region, Aliyun.Configuration.Instance.IsInternal);
            var certificate = this.GetCertificate(bucket);

            return(new StorageClient(center, certificate));
        }
Esempio n. 4
0
        public StorageSearchResultResolver(StorageServiceCenter serviceCenter, HttpClient client, Func <string, string> getUrl = null)
        {
            if (serviceCenter == null)
            {
                throw new ArgumentNullException("serviceCenter");
            }

            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            _client        = client;
            _serviceCenter = serviceCenter;
            _getUrl        = getUrl;
        }
Esempio n. 5
0
        public string GetUrl(Zongsoft.IO.Path path)
        {
            if (path == null || path.Segments.Length == 0)
            {
                return(null);
            }

            //确认OSS对象存储配置
            var configuration = this.EnsureConfiguration();

            //获取当前路径对应的存储器配置项,注:BucketName即为路径中的第一节
            configuration.Buckets.TryGet(path.Segments[0], out var bucket);

            //获取当前路径对应的服务区域
            var region = this.GetRegion(bucket);

            return(StorageServiceCenter.GetInstance(region, false).GetRequestUrl(path.FullPath));
        }
Esempio n. 6
0
 internal StorageClient(StorageServiceCenter serviceCenter, ICertificate certificate)
 {
     _serviceCenter = serviceCenter ?? throw new ArgumentNullException(nameof(serviceCenter));
     _certificate   = certificate ?? throw new ArgumentNullException(nameof(certificate));
     _http          = new HttpClient(new HttpClientHandler(certificate, StorageAuthenticator.Instance));
 }