Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.78 KB

File metadata and controls

51 lines (39 loc) · 1.78 KB

简介

本文档提供关于恢复归档对象操作相关的 API 概览以及 SDK 示例代码。

API 操作名 操作描述
POST Object restore 恢复归档对象 将归档类型的对象取回访问

SDK API 参考

SDK 所有接口的具体参数与方法说明,请参考 SDK API

恢复归档对象

功能说明

将归档类型的对象取回访问(POST Object restore)。

示例代码

try
{
  // 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
  string bucket = "examplebucket-1250000000";
  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());
}

?更多完整示例,请前往 GitHub 查看。