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


C# CloudFilesProvider.ListContainers方法代碼示例

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


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

示例1: Should_Return_Container_List

        public void Should_Return_Container_List()
        {
            var provider = new CloudFilesProvider();
            var containerList = provider.ListContainers(identity: _testIdentity);

            Assert.IsNotNull(containerList);
            Assert.IsTrue(containerList.Any());
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs

示例2: Should_Return_Container_List_With_Internal_Url

        public void Should_Return_Container_List_With_Internal_Url()
        {
            var provider = new CloudFilesProvider();
            var containerList = provider.ListContainers(useInternalUrl:true, identity: _testIdentity);

            Assert.IsNotNull(containerList);
            Assert.IsTrue(containerList.Any());
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs

示例3: CFProviderListContainers

        protected void CFProviderListContainers(string dcregion, bool dcsnet = true)
        {
            var identity = new RackspaceCloudIdentity() { Username = CFUsernameText.Text, APIKey = CFApiKeyText.Text };

            CloudIdentityProvider identityProvider = new net.openstack.Providers.Rackspace.CloudIdentityProvider(identity);
            CloudFilesProvider CloudFilesProvider = new net.openstack.Providers.Rackspace.CloudFilesProvider(identity);

            var CfContainers = CloudFilesProvider.ListContainers(null, null, null, dcregion, dcsnet);

            CFContainerDDL.DataSource = CfContainers;
            CFContainerDDL.DataTextField = "Name";
            CFContainerDDL.DataBind();
        }
開發者ID:ravikamachi,項目名稱:OpenStackDotNet-Test,代碼行數:13,代碼來源:CloudFiles.aspx.cs

示例4: ListContainers

        private IEnumerable<Container> ListContainers(CloudIdentity cloudIdentity, int? limit = null, string region = null, bool useInternalUrl = false) {
            var provider = new CloudFilesProvider(cloudIdentity);

            Container lastContainer = null;

            do {
                string marker = lastContainer != null ? lastContainer.Name : null;
                IEnumerable<Container> containerObjects = provider.ListContainers(limit, marker, null, region, useInternalUrl, cloudIdentity);
                lastContainer = null;
                foreach (Container containerObject in containerObjects) {
                    lastContainer = containerObject;
                    yield return containerObject;
                }
            } while (lastContainer != null);

        }
開發者ID:pjcunningham,項目名稱:SwiftClient.Net,代碼行數:16,代碼來源:Provider.cs

示例5: Should_Return_Container_List_With_Limit

        public void Should_Return_Container_List_With_Limit()
        {
            var provider = new CloudFilesProvider();
            var containerList = provider.ListContainers(1, identity: _testIdentity);

            Assert.IsNotNull(containerList);
            Assert.AreEqual(1, containerList.Count());
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs

示例6: Should_Return_Container_List_With_End_Marker_Lower_Case

        public void Should_Return_Container_List_With_End_Marker_Lower_Case()
        {
            var provider = new CloudFilesProvider();
            var containerList = provider.ListContainers(null, null, "l", identity: _testIdentity);

            Assert.IsNotNull(containerList);
            Assert.IsTrue(containerList.Any());
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs

示例7: Should_Purge_Objects_Before_Deleting_The_Conatiner

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

            provider.DeleteContainer(containerName2);

            var containers = provider.ListContainers();
            Assert.IsFalse(containers.Any(c => c.Name.Equals(containerName2)));
        }
開發者ID:jonwalton,項目名稱:openstack.net,代碼行數:9,代碼來源:CloudFilesTests.cs

示例8: Should_Create_New_Test_Container_2

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

            provider.CreateContainer(containerName2);

            var containers = provider.ListContainers();
            Assert.IsTrue(containers.Any(c => c.Name.Equals(containerName2)));
        }
開發者ID:jonwalton,項目名稱:openstack.net,代碼行數:9,代碼來源:CloudFilesTests.cs

示例9: Main

        public static void Main(string[] args)
        {
            Boolean containerExists = false;
            if (args.Length < 4 || args.Length > 5)
            {
                Console.WriteLine("Usage: {0} username api_key target_container path_to_file [region (US|UK)]", Environment.CommandLine);
                Environment.Exit(1);
            }
            RackspaceCloudIdentity auth = new RackspaceCloudIdentity();
            IEnumerable<Container> containerList = null;
            auth.Username = args[0];
            auth.APIKey = args[1];
            targetContainer = args[2];
            filePath = args[3];
            if (args.Length == 5)
            {
                if (args[4] != "UK" && args[4] != "US")
                {
                    Console.WriteLine("region must be either US or UK", Environment.CommandLine);
                    Environment.Exit(1);
                }
                switch (args[4])
                {
                    case "UK": {auth.CloudInstance = CloudInstance.UK;};break;
                    case "US": { auth.CloudInstance = CloudInstance.Default;}; break;
                }
            }

            try
            {
                IIdentityProvider identityProvider = new CloudIdentityProvider();
                var userAccess = identityProvider.Authenticate(auth);
            }
            catch (ResponseException ex2)
            {
                Console.WriteLine("Authentication failed with the following message: {0}",ex2.Message);
                Environment.Exit(1);
            }

            try
            {
                var cloudFilesProvider = new CloudFilesProvider(auth);
                containerList = cloudFilesProvider.ListContainers();

                foreach (Container container in containerList)
                {
                    if (container.Name == targetContainer)
                    {
                        containerExists = true;
                        break;
                    }
                }

                if (!containerExists)
                {
                    Console.WriteLine("Container \"{0}\" does not exist on the provided CloudFiles account.", targetContainer);
                    Environment.Exit(1);
                }
                if (!File.Exists(filePath))
                {
                    Console.WriteLine("The file specified ({0}) does not exist", filePath);
                    Environment.Exit(1);
                }
                cloudFilesProvider.CreateObjectFromFile(targetContainer, @filePath, Path.GetFileName(filePath));
            }
            catch (Exception ex2)
            {
                Console.WriteLine(ex2.Message);
                Environment.Exit(1);
            }
            Console.WriteLine("*SUCCESS* File: \"{0}\" uploaded to \"{1}\"", filePath, targetContainer);
        }
開發者ID:nick-o,項目名稱:CloudFilesUpload,代碼行數:72,代碼來源:Program.cs


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