Beispiel #1
0
        /// <summary>
        /// 得到域名Host
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DomainResultDto GetHost(GetBucketHostParam request)
        {
            new GetBucketHostParamValidator().Validate(request).Check(HttpStatus.Err.Name);
            var    scheme = Core.Tools.GetScheme(_qiNiuConfig, request.PersistentOps.IsUseHttps);
            string url    =
                $"{scheme}api.qiniu.com/v6/domain/list?tbl={Core.Tools.GetBucket(_qiNiuConfig, request.PersistentOps.Bucket)}";

            _httpClient.Headers = new Dictionary <string, string>()
            {
                { "Authorization", $"{_storageProvider.GetManageToken(new GetManageTokenParam(url))}" }
            };

            try
            {
                string response = _httpClient.GetString(url);
                return(GetResponse(response, () => new DomainResultDto(true,
                                                                       _jsonProvider.Deserialize <List <string> >(response),
                                                                       "success"),
                                   resultResponse =>
                                   new DomainResultDto(false, null, $"{resultResponse.Error}|{resultResponse.ErrorCode}")));
            }
            catch (Exception ex)
            {
                this._logger?.LogError(ex.ExtractAllStackTrace());
                return(new DomainResultDto(false, null, $"lose {ex.Message}"));
            }
        }
 /// <summary>
 /// 获取空间域名信息
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public DomainResultDto GetHost(GetBucketHostParam request)
 {
     return(new DomainResultDto(false, default(List <string>), "不支持获取空间域"));
 }
 public DomainResultDto GetHost(GetBucketHostParam request)
 {
     throw new System.NotImplementedException();
 }