Ejemplo n.º 1
0
        public static void AsynDeleteBucketReplication(COSXML.CosXml cosXml, string bucket)
        {
            DeleteBucketReplicationRequest request = new DeleteBucketReplicationRequest(bucket);

            //设置签名有效时长
            request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600);


            ///执行请求
            cosXml.DeleteBucketReplication(request,
                                           delegate(CosResult cosResult)
            {
                DeleteBucketReplicationResult result = cosResult as DeleteBucketReplicationResult;
                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());
                }
            });
        }
Ejemplo n.º 2
0
        public static void DeleteBucketReplication(COSXML.CosXml cosXml, string bucket)
        {
            try
            {
                DeleteBucketReplicationRequest request = new DeleteBucketReplicationRequest(bucket);
                //设置签名有效时长
                request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600);
                //执行请求
                DeleteBucketReplicationResult result = cosXml.DeleteBucketReplication(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());
            }
        }
Ejemplo n.º 3
0
        private void DeleteBucketReplication()
        {
            try
            {
                DeleteBucketReplicationRequest request = new DeleteBucketReplicationRequest(bucket);


                //执行请求
                DeleteBucketReplicationResult result = cosXml.DeleteBucketReplication(request);


                Assert.True(result.IsSuccessful());
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                Console.WriteLine("CosClientException: " + clientEx.Message);
                Assert.Fail();
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
                Assert.Fail();
            }
        }