public static void AsynGetBuckeLocation(COSXML.CosXml cosXml, string bucket) { GetBucketLocationRequest request = new GetBucketLocationRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); ///执行请求 cosXml.GetBucketLocation(request, delegate(CosResult cosResult) { GetBucketLocationResult result = cosResult as GetBucketLocationResult; 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()); } }); }
public void TestGetBucketLocation() { if (init()) { GetBucketLocationResult bucketLocation = ks3Client.getBucketLocation(bucketName); Assert.IsNotNull(bucketLocation); } }
private static bool getBucketLocation() { try { Console.WriteLine("--- getBucketLocation: ---"); Console.WriteLine("Bucket Name: " + bucketName); GetBucketLocationResult bucketLocation = ks3Client.getBucketLocation(bucketName); Console.WriteLine("Success."); Console.WriteLine("----------------------\n"); } catch (System.Exception e) { Console.WriteLine("getBucketLocation Fail! " + e.ToString()); return(false); } return(true); }
public static void GetBuckeLocation(COSXML.CosXml cosXml, string bucket) { try { GetBucketLocationRequest request = new GetBucketLocationRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 GetBucketLocationResult result = cosXml.GetBucketLocation(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()); } }