예제 #1
0
        public async Task CloneBucket()
        {
            var source = await _bucketsApi.CreateBucket(GenerateName("robot sensor"), RetentionRule(), _organization);

            var properties = new Dictionary <string, string> {
                { "color", "green" }, { "location", "west" }
            };

            var label = await Client.GetLabelsApi()
                        .CreateLabel(GenerateName("Cool Resource"), properties, _organization.Id);

            await _bucketsApi.AddLabel(label, source);

            var name = GenerateName("cloned");

            var cloned = await _bucketsApi.CloneBucket(name, source);

            Assert.AreEqual(name, cloned.Name);
            Assert.AreEqual(_organization.Id, cloned.OrgID);
            Assert.IsNull(cloned.Rp);
            Assert.AreEqual(1, cloned.RetentionRules.Count);
            Assert.AreEqual(3600, cloned.RetentionRules[0].EverySeconds);
            Assert.AreEqual(BucketRetentionRules.TypeEnum.Expire, cloned.RetentionRules[0].Type);

            var labels = await _bucketsApi.GetLabels(cloned);

            Assert.AreEqual(1, labels.Count);
            Assert.AreEqual(label.Id, labels[0].Id);
        }