Exemplo n.º 1
0
        /// 恢复归档对象
        public void RestoreObject()
        {
            //.cssg-snippet-body-start:[restore-object]
            try
            {
                string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
                string key    = "exampleobject";            //对象键
                RestoreObjectRequest request = new RestoreObjectRequest(bucket, key);
                //恢复时间
                request.SetExpireDays(3);
                request.SetTier(COSXML.Model.Tag.RestoreConfigure.Tier.Bulk);

                //执行请求
                RestoreObjectResult result = cosXml.RestoreObject(request);
                //请求成功
                Console.WriteLine(result.GetResultInfo());
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }

            //.cssg-snippet-body-end
        }