Skip to content

Commit 206da3a

Browse files
author
fengyunhai
committed
增加“更新文件的生命周期”
1 parent 54dcc05 commit 206da3a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Qiniu/Storage/BucketManager.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,25 @@ public ListFilesResult listFiles(string bucket,string prefix,string marker,int l
442442
return result;
443443
}
444444

445+
public HttpResult updateLifecycle(string bucket,string key,int deleteAfterDays)
446+
{
447+
HttpResult updateResult = null;
448+
449+
string updateUrl = string.Format("{0}{1}", Config.ZONE.RsHost, updateLifecycleOp(bucket, key, deleteAfterDays));
450+
string accessToken = Auth.createManageToken(updateUrl, null, this.mac);
451+
Dictionary<string, string> updateHeaders = new Dictionary<string, string>();
452+
updateHeaders.Add("Authorization", accessToken);
453+
CompletionHandler updateCompletionHandler = new CompletionHandler(delegate (ResponseInfo respInfo, string response)
454+
{
455+
updateResult = new HttpResult();
456+
updateResult.Response = response;
457+
updateResult.ResponseInfo = respInfo;
458+
});
459+
460+
this.mHttpManager.postForm(updateUrl, updateHeaders, null, updateCompletionHandler);
461+
return updateResult;
462+
}
463+
445464
public string statOp(string bucket, string key)
446465
{
447466
return string.Format("/stat/{0}", StringUtils.encodedEntry(bucket, key));
@@ -497,5 +516,10 @@ public string prefetchOp(string bucket, string key)
497516
{
498517
return string.Format("/prefetch/{0}", StringUtils.encodedEntry(bucket, key));
499518
}
519+
520+
public string updateLifecycleOp(string bucket,string key,int deleteAfterDays)
521+
{
522+
return string.Format("/deleteAfterDays/{0}/{1}", StringUtils.encodedEntry(bucket, key), deleteAfterDays);
523+
}
500524
}
501525
}

0 commit comments

Comments
 (0)