当前位置: 首页>>代码示例>>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;未经允许,请勿转载。