public void ListBucketInventoryAsync(ListBucketInventoryRequest request, OnSuccessCallback <CosResult> successCallback, OnFailedCallback failCallback) { Schedue(request, new Model.Bucket.ListBucketInventoryResult(), successCallback, failCallback); }
public void TestBucketInventory() { try { string inventoryId = "id1"; PutBucketInventoryRequest putRequest = new PutBucketInventoryRequest(bucket, inventoryId); putRequest.IsEnable(true); putRequest.SetScheduleFrequency("Daily"); putRequest.SetIncludedObjectVersions("All"); putRequest.SetDestination("CSV", QCloudServer.Instance().uin, QCloudServer.Instance().bucketForObjectTest, region, "list1"); putRequest.SetFilter("dir/"); putRequest.SetOptionalFields("SIZE"); putRequest.SetOptionalFields("ETag"); putRequest.EnableSSE(); PutBucketInventoryResult putResult = cosXml.PutBucketInventory(putRequest); Assert.IsTrue(putResult.httpCode == 200); GetBucketInventoryRequest getRequest = new GetBucketInventoryRequest(bucket); getRequest.SetInventoryId(inventoryId); GetBucketInventoryResult getResult = cosXml.GetBucketInventory(getRequest); InventoryConfiguration testConfig = getResult.inventoryConfiguration; // Console.WriteLine(getResult.GetResultInfo()); Assert.IsNotEmpty((getResult.GetResultInfo())); ListBucketInventoryRequest listRequest = new ListBucketInventoryRequest(bucket); ListBucketInventoryResult listResult = cosXml.ListBucketInventory(listRequest); Assert.IsTrue(listResult.httpCode == 200); Assert.NotNull(listResult.GetResultInfo()); Assert.IsEmpty(listResult.listInventoryConfiguration.continuationToken); Assert.False(listResult.listInventoryConfiguration.isTruncated); Assert.AreEqual(listResult.listInventoryConfiguration.inventoryConfigurations.Count, 1); InventoryConfiguration testConfig2 = listResult.listInventoryConfiguration.inventoryConfigurations[0]; InventoryConfiguration[] configurations = new InventoryConfiguration[] { testConfig, testConfig2 }; foreach (InventoryConfiguration configuration in configurations) { Assert.NotNull(configuration); Assert.NotNull(configuration.destination.cosBucketDestination.accountId); Assert.NotNull(configuration.destination.cosBucketDestination.bucket); Assert.NotNull(configuration.destination.cosBucketDestination.encryption.sSECOS); Assert.NotNull(configuration.destination.cosBucketDestination.format); Assert.NotNull(configuration.destination.cosBucketDestination.prefix); Assert.True(configuration.isEnabled); Assert.NotNull(configuration.schedule.frequency); Assert.NotNull(configuration.includedObjectVersions); Assert.NotNull(configuration.filter.prefix); Assert.AreEqual(configuration.optionalFields.fields.Count, 2); } DeleteBucketInventoryRequest deleteRequest = new DeleteBucketInventoryRequest(bucket); deleteRequest.SetInventoryId(inventoryId); DeleteBucketInventoryResult deleteResult = cosXml.DeleteBucketInventory(deleteRequest); Assert.IsTrue(putResult.httpCode == 200); } catch (COSXML.CosException.CosClientException clientEx) { Console.WriteLine("CosClientException: " + clientEx.Message); Assert.Fail(); } catch (COSXML.CosException.CosServerException serverEx) { Console.WriteLine("CosServerException: " + serverEx.GetInfo()); if (serverEx.statusCode != 409 && serverEx.statusCode != 451) { Assert.Fail(); } } }
public ListBucketInventoryResult ListBucketInventory(ListBucketInventoryRequest request) { return((Model.Bucket.ListBucketInventoryResult)Excute(request, new Model.Bucket.ListBucketInventoryResult())); }