當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudFilesProvider.DeleteContainerMetadata方法代碼示例

本文整理匯總了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.DeleteContainerMetadata方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudFilesProvider.DeleteContainerMetadata方法的具體用法?C# CloudFilesProvider.DeleteContainerMetadata怎麽用?C# CloudFilesProvider.DeleteContainerMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.openstack.Providers.Rackspace.CloudFilesProvider的用法示例。


在下文中一共展示了CloudFilesProvider.DeleteContainerMetadata方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CleanupAllContainerMetadata

 public void CleanupAllContainerMetadata()
 {
     IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
     IEnumerable<Container> containers = ListAllContainers(provider);
     foreach (Container container in containers)
     {
         Dictionary<string, string> metadata = provider.GetContainerMetaData(container.Name);
         provider.DeleteContainerMetadata(container.Name, metadata.Keys);
     }
 }
開發者ID:nick-o,項目名稱:openstack.net,代碼行數:10,代碼來源:UserObjectStorageTests.cs

示例2: Should_Remove_Single_Metadata_For_Container_Item_Key1

        public void Should_Remove_Single_Metadata_For_Container_Item_Key1()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            provider.DeleteContainerMetadata(containerName, "key1");
        }
開發者ID:brendanseabrook,項目名稱:openstack.net,代碼行數:6,代碼來源:CloudFilesTests.cs

示例3: TestDeleteContainerMetadata

        public void TestDeleteContainerMetadata()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            string containerName = TestContainerPrefix + Path.GetRandomFileName();

            ObjectStore result = provider.CreateContainer(containerName);
            Assert.AreEqual(ObjectStore.ContainerCreated, result);

            Dictionary<string, string> metadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "Key1", "Value 1" },
                { "Key2", "Value ²" },
                { "Key3", "Value 3" },
                { "Key4", "Value 4" },
            };

            provider.UpdateContainerMetadata(containerName, new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase));

            Dictionary<string, string> actualMetadata = provider.GetContainerMetaData(containerName);
            Console.WriteLine("Container Metadata");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check the overload which takes a single key
             */
            // remove Key3 first to make sure we still have a ² character in a remaining value
            metadata.Remove("Key3");
            provider.DeleteContainerMetadata(containerName, "Key3");

            actualMetadata = provider.GetContainerMetaData(containerName);
            Console.WriteLine("Container Metadata after removing Key3");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check the overload which takes multiple keys
             */
            metadata.Remove("Key2");
            metadata.Remove("Key4");
            provider.DeleteContainerMetadata(containerName, new[] { "Key2", "Key4" });

            actualMetadata = provider.GetContainerMetaData(containerName);
            Console.WriteLine("Container Metadata after removing Key2, Key4");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check that duplicate removal is a NOP
             */
            metadata.Remove("Key2");
            metadata.Remove("Key4");
            provider.DeleteContainerMetadata(containerName, new[] { "Key2", "Key4" });

            actualMetadata = provider.GetContainerMetaData(containerName);
            Console.WriteLine("Container Metadata after removing Key2, Key4");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Cleanup
             */
            provider.DeleteContainer(containerName, deleteObjects: true);
        }
開發者ID:nick-o,項目名稱:openstack.net,代碼行數:68,代碼來源:UserObjectStorageTests.cs

示例4: Should_Remove_Multiple_Metadata_For_Container_Items_Key2_and_Key3

 public void Should_Remove_Multiple_Metadata_For_Container_Items_Key2_and_Key3()
 {
     var provider = new CloudFilesProvider(_testIdentity);
     var metaData = new Dictionary<string, string> {{"key2", "value2"}, {"key3", "value3"}};
     
     provider.DeleteContainerMetadata(containerName, metaData);
 }
開發者ID:brendanseabrook,項目名稱:openstack.net,代碼行數:7,代碼來源:CloudFilesTests.cs


注:本文中的net.openstack.Providers.Rackspace.CloudFilesProvider.DeleteContainerMetadata方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。