public static void AsynGetBucketReplication(COSXML.CosXml cosXml, string bucket) { GetBucketReplicationRequest request = new GetBucketReplicationRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); ///执行请求 cosXml.GetBucketReplication(request, delegate(CosResult cosResult) { GetBucketReplicationResult result = cosResult as GetBucketReplicationResult; 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 GetBucketReplication() { try { GetBucketReplicationRequest request = new GetBucketReplicationRequest(bucket); //执行请求 GetBucketReplicationResult result = cosXml.GetBucketReplication(request); var replication = result.replicationConfiguration; // Console.WriteLine(result.GetResultInfo()); Assert.IsNotEmpty((result.GetResultInfo())); Assert.AreEqual(result.httpCode, 200); Assert.NotNull(replication.role); Assert.NotZero(replication.rules.Count); Assert.NotNull(replication.rules[0].id); Assert.NotNull(replication.rules[0].prefix); Assert.AreEqual(replication.rules[0].status, "Enabled"); Assert.NotNull(replication.rules[0].destination); Assert.NotNull(replication.rules[0].destination.bucket); Assert.NotNull(replication.rules[0].destination.storageClass); } 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 GetBucketReplication(COSXML.CosXml cosXml, string bucket) { try { GetBucketReplicationRequest request = new GetBucketReplicationRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 GetBucketReplicationResult result = cosXml.GetBucketReplication(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()); } }