public async Task BatchDeleteAfterDaysTest() { await BatchCopyTest(); var config = new Config { Zone = Zone.ZoneCnEast }; var mac = new Mac(AccessKey, SecretKey); var bucketManager = new BucketManager(mac, config); string[] keys = { "qiniu-0.png", "qiniu-1.png", "qiniu-2.png" }; var ops = new List <string>(); foreach (var key in keys) { var op = bucketManager.DeleteAfterDaysOp(Bucket, key, 7); ops.Add(op); } var ret = await bucketManager.Batch(ops); if (ret.Code / 100 != 2) { Assert.True(false, "batch error: " + ret); } foreach (var info in ret.Result) { if (info.Code == (int)HttpCode.OK) { Console.WriteLine("deleteAfterDays success"); } else { Console.WriteLine(info.Data.Error); } } }
public void BatchDeleteAfterDaysTest() { BatchCopyTest(); Config config = new Config(); config.Zone = Zone.ZONE_CN_East; //config.Region = Region.Region_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); string[] keys = { "qiniu-0.png", "qiniu-1.png", "qiniu-2.png" }; List <string> ops = new List <string>(); foreach (string key in keys) { string op = bucketManager.DeleteAfterDaysOp(Bucket, key, 7); ops.Add(op); } BatchResult ret = bucketManager.Batch(ops); if (ret.Code / 100 != 2) { Assert.Fail("batch error: " + ret.ToString()); } foreach (BatchInfo info in ret.Result) { if (info.Code == (int)HttpCode.OK) { Console.WriteLine("deleteAfterDays success"); } else { Console.WriteLine(info.Data.Error); } } }