public static void AsynGetBucketVersioning(COSXML.CosXml cosXml, string bucket) { GetBucketVersioningRequest request = new GetBucketVersioningRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 cosXml.GetBucketVersioning(request, delegate(CosResult cosResult) { GetBucketVersioningResult result = cosResult as GetBucketVersioningResult; Console.WriteLine(result.GetResultInfo()); }, delegate(CosClientException clientEx, CosServerException serverEx) { if (clientEx != null) { QLog.D("XIAO", clientEx.Message); Console.WriteLine("CosClientException: " + clientEx.Message); } if (serverEx != null) { QLog.D("XIAO", serverEx.Message); Console.WriteLine("CosServerException: " + serverEx.GetInfo()); } }); }
private void GetBucketVersioning() { try { GetBucketVersioningRequest request = new GetBucketVersioningRequest(bucket); //执行请求 GetBucketVersioningResult result = cosXml.GetBucketVersioning(request); var versioning = result.versioningConfiguration; // Console.WriteLine(result.GetResultInfo()); Assert.IsNotEmpty((result.GetResultInfo())); Assert.AreEqual(result.httpCode, 200); Assert.NotNull(versioning); Assert.Contains(versioning.status, new List <String>() { "Enabled", "Suspended" }); } catch (COSXML.CosException.CosClientException clientEx) { Console.WriteLine("CosClientException: " + clientEx.Message); Assert.Fail(); } catch (COSXML.CosException.CosServerException serverEx) { Console.WriteLine("CosServerException: " + serverEx.GetInfo()); Assert.Fail(); } }
public static void GetBucketVersioning(COSXML.CosXml cosXml, string bucket) { try { GetBucketVersioningRequest request = new GetBucketVersioningRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 GetBucketVersioningResult result = cosXml.GetBucketVersioning(request); Console.WriteLine(result.GetResultInfo()); } catch (COSXML.CosException.CosClientException clientEx) { QLog.D("XIAO", clientEx.Message); Console.WriteLine("CosClientException: " + clientEx.Message); } catch (COSXML.CosException.CosServerException serverEx) { QLog.D("XIAO", serverEx.Message); Console.WriteLine("CosServerException: " + serverEx.GetInfo()); } }