示例#1
0
 /// 获取存储桶日志服务
 public void GetBucketLogging()
 {
     //.cssg-snippet-body-start:[get-bucket-logging]
     try
     {
         string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID
         GetBucketLoggingRequest request = new GetBucketLoggingRequest(bucket);
         //执行请求
         GetBucketLoggingResult getResult = cosXml.GetBucketLogging(request);
         //请求成功
         BucketLoggingStatus status = getResult.bucketLoggingStatus;
         if (status != null && status.loggingEnabled != null)
         {
             string targetBucket = status.loggingEnabled.targetBucket;
             string targetPrefix = status.loggingEnabled.targetPrefix;
         }
     }
     catch (COSXML.CosException.CosClientException clientEx)
     {
         //请求失败
         Console.WriteLine("CosClientException: " + clientEx);
     }
     catch (COSXML.CosException.CosServerException serverEx)
     {
         //请求失败
         Console.WriteLine("CosServerException: " + serverEx.GetInfo());
     }
     //.cssg-snippet-body-end
 }