Beispiel #1
0
        /// <summary>
        /// 设置桶存储类型
        /// </summary>
        /// <param name="bucketName">储存桶名称</param>
        /// <param name="type">类型</param>
        /// <returns></returns>
        /// <remarks>
        /// 标准存储(StorageClassEnum.Standard) 标准存储拥有低访问时延和较高的吞吐量,适用于有大量热点对象(平均一个月多次)或小对象(<1MB),且需要频繁访问数据的业务场景。
        /// 低频访问存储(StorageClassEnum.Warm) 低频访问存储适用于不频繁访问(平均一年少于12次)但在需要时也要求能够快速访问数据的业务场景。
        /// 归档存储(StorageClassEnum.Cold) 归档存储适用于很少访问(平均一年访问一次)数据的业务场景。
        /// </remarks>
        public Task <bool> SetBucketStoragePolicyAsync(string bucketName, StorageClassEnum type)
        {
            SetBucketStoragePolicyRequest request = new SetBucketStoragePolicyRequest
            {
                BucketName   = bucketName,
                StorageClass = type,
            };
            SetBucketStoragePolicyResponse response = _client.SetBucketStoragePolicy(request);

            return(Task.FromResult(response != null && response.StatusCode == HttpStatusCode.OK));
        }
 protected override void TransSetBucketStoragePolicyContent(XmlWriter xmlWriter, StorageClassEnum storageClass)
 {
     xmlWriter.WriteElementString("StorageClass", TransStorageClass(storageClass));
 }
 protected override string TransStorageClass(StorageClassEnum storageClass)
 {
     return(storageClass.ToString().ToUpper());
 }