/// 删除存储桶
        public void DeleteBucket()
        {
            //.cssg-snippet-body-start:[delete-bucket]
            try
            {
                string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID
                DeleteBucketRequest request = new DeleteBucketRequest(bucket);
                //执行请求
                DeleteBucketResult result = cosXml.DeleteBucket(request);
                //请求成功
                Console.WriteLine(result.GetResultInfo());
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }

            //.cssg-snippet-body-end
        }
Beispiel #2
0
        public Task <bool> RemoveBucketAsync(string bucketName)
        {
            if (string.IsNullOrEmpty(bucketName))
            {
                throw new ArgumentNullException(nameof(bucketName));
            }
            bucketName = ConvertBucketName(bucketName);
            DeleteBucketRequest request = new DeleteBucketRequest(bucketName);
            //执行请求
            DeleteBucketResult result = _client.DeleteBucket(request);

            return(Task.FromResult(result.IsSuccessful()));
        }