当前位置: 首页>>代码示例>>C#>>正文


C# Domain.CloudIdentity类代码示例

本文整理汇总了C#中net.openstack.Core.Domain.CloudIdentity的典型用法代码示例。如果您正苦于以下问题:C# CloudIdentity类的具体用法?C# CloudIdentity怎么用?C# CloudIdentity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloudIdentity类属于net.openstack.Core.Domain命名空间,在下文中一共展示了CloudIdentity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateProvider

 public void CreateProvider()
 {
     #region CreateProvider
     var identity = new CloudIdentity { Username = "{username}", APIKey = "{apiKey}" };
     var provider = new CloudIdentityProvider(identity);
     #endregion
 }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:7,代码来源:IdentityProviderExamples.cs

示例2: FindAService

        public void FindAService()
        {
            var identity = new CloudIdentity { Username = "{username}", APIKey = "{api-key}" };
            IIdentityProvider identityProvider = new CloudIdentityProvider(identity);
            var service = new ContentDeliveryNetworkService(identityProvider, "DFW");

            IPage<Service> currentPage = service.ListServices();

            Service myService;
            do
            {
                myService = currentPage.FirstOrDefault(x => x.Name == "MyService");
                if (myService != null)
                    break;

                currentPage = currentPage.GetNextPage();
            } while (currentPage.Any());

            if (myService == null)
            {
                Console.Error.WriteLine("Could not find MyService!");
                return;
            }

            Console.WriteLine("MyService: {0}", myService.Status);
        }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:26,代码来源:ContentDeliveryNetworkExample.cs

示例3: ListAllObjects

        private static IEnumerable<ContainerObject> ListAllObjects(
            IObjectStorageProvider provider,
            string containerName,
            int? blockSize = null,
            string prefix = null,
            string region = null,
            bool useInternalUrl = false,
            CloudIdentity identity = null)
        {
            if (blockSize <= 0)
                throw new ArgumentOutOfRangeException("blockSize");

            ContainerObject lastContainerObject = null;

            do
            {
                string marker = lastContainerObject != null ? lastContainerObject.Name : null;
                IEnumerable<ContainerObject> containerObjects =
                    provider.ListObjects(containerName, blockSize, marker, null, prefix, region, useInternalUrl, identity);
                lastContainerObject = null;
                foreach (ContainerObject containerObject in containerObjects)
                {
                    lastContainerObject = containerObject;
                    yield return containerObject;
                }
            } while (lastContainerObject != null);
        }
开发者ID:asmajlovic,项目名称:openstack.net,代码行数:27,代码来源:ObjectStorageProviderExamples.cs

示例4: CloudFilesProvider

 internal CloudFilesProvider(CloudIdentity defaultIdentity, ICloudIdentityProvider cloudIdentityProvider, IRestService restService, ICloudFilesValidator cloudFilesValidator, ICloudFilesMetadataProcessor cloudFilesMetadataProcessor, IEncodeDecodeProvider encodeDecodeProvider)
     : base(defaultIdentity, cloudIdentityProvider, restService)
 {
     _cloudFilesValidator = cloudFilesValidator;
     _cloudFilesMetadataProcessor = cloudFilesMetadataProcessor;
     _encodeDecodeProvider = encodeDecodeProvider;
 }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:7,代码来源:CloudFilesProvider.cs

示例5: CreateProviderWithPassword

 public void CreateProviderWithPassword()
 {
     #region CreateProviderWithPassword
     var identity = new CloudIdentity { Username = "{username}", Password = "{password}" };
     var provider = new CloudIdentityProvider(identity);
     #endregion
 }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:7,代码来源:IdentityProviderExamples.cs

示例6: Run

    public async Task Run(string username, string apiKey, string region)
    {
        // Configure authentication
        var identity = new CloudIdentity
        {
            Username = username,
            APIKey = apiKey
        };
        var identityService = new CloudIdentityProvider(identity);
        var networkService = new CloudNetworkService(identityService, region);

        Console.WriteLine("Creating Sample Network... ");
        var networkDefinition = new NetworkDefinition {Name = "Sample"};
        var sampleNetwork = await networkService.CreateNetworkAsync(networkDefinition);

        Console.WriteLine("Adding a subnet to Sample Network...");
        var subnetDefinition = new SubnetCreateDefinition(sampleNetwork.Id, IPVersion.IPv4, "192.0.2.0/24")
        {
            Name = "Sample"
        };
        var sampleSubnet = await networkService.CreateSubnetAsync(subnetDefinition);

        Console.WriteLine("Attaching a port to Sample Network...");
        var portDefinition = new PortCreateDefinition(sampleNetwork.Id)
        {
            Name = "Sample"
        };
        var samplePort = await networkService.CreatePortAsync(portDefinition);

        Console.WriteLine("Listing Networks...");
        var networks = await networkService.ListNetworksAsync();
        foreach (Network network in networks)
        {
            Console.WriteLine($"{network.Id}\t\t\t{network.Name}");
        }

        Console.WriteLine();
        Console.WriteLine("Sample Network Information:");
        Console.WriteLine();
        Console.WriteLine($"Network Id: {sampleNetwork.Id}");
        Console.WriteLine($"Network Name: {sampleNetwork.Name}");
        Console.WriteLine($"Network Status: {sampleNetwork.Status}");
        Console.WriteLine();
        Console.WriteLine($"Subnet Id: {sampleSubnet.Id}");
        Console.WriteLine($"Subnet Name: {sampleSubnet.Name}");
        Console.WriteLine($"Subnet IPs: {sampleSubnet.AllocationPools.First().Start} - {sampleSubnet.AllocationPools.First().End}");
        Console.WriteLine();
        Console.WriteLine($"Port Id: {samplePort.Id}");
        Console.WriteLine($"Port Name: {samplePort.Name}");
        Console.WriteLine($"Port Address: {samplePort.MACAddress}");
        Console.WriteLine($"Port Status: {samplePort.Status}");
        Console.WriteLine();

        Console.WriteLine("Deleting Sample Network...");
        await networkService.DeletePortAsync(samplePort.Id);
        await networkService.DeleteNetworkAsync(sampleNetwork.Id);
    }
开发者ID:rackspace,项目名称:rackspace-net-sdk,代码行数:57,代码来源:CloudNetworkSamples.cs

示例7: FromCloudIdentity

 public static AuthRequest FromCloudIdentity(CloudIdentity identity)
 {
     var creds = new AuthDetails();
     if (string.IsNullOrWhiteSpace(identity.Password))
         creds.APIKeyCredentials = new Credentials() { Username = identity.Username, APIKey = identity.APIKey};
     else
         creds.PasswordCredentials = new Credentials(){Username = identity.Username, Password = identity.Password};
     return new AuthRequest { Credencials = creds };
 }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:9,代码来源:AuthRequest.cs

示例8: CloudFilesAssetWorker

 public CloudFilesAssetWorker(int readTimeout, int writeTimeout)
 {
     CloudIdentity identity = new CloudIdentity { Username = Config.Settings.Instance.CFUsername, APIKey = Config.Settings.Instance.CFApiKey };
     IRestService restService = new CoreExt.ExtendedJsonRestServices(readTimeout, writeTimeout);
     _provider = new CoreExt.ExtendedCloudFilesProvider(identity, Config.Settings.Instance.CFDefaultRegion, null, restService);
     
     //warm up
     _provider.GetAccountHeaders(useInternalUrl: Config.Settings.Instance.CFUseInternalURL, region: Config.Settings.Instance.CFDefaultRegion);
 }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:9,代码来源:CloudFilesAssetWorker.cs

示例9: Init

        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);
            
            var provider = new CloudServersProvider(_testIdentity);

            _initImage = provider.ListImages(imageName: "CentOS 6.3").First();
            _initFlavor = provider.ListFlavors().OrderBy(f => f.Id).First();
        }
开发者ID:amitgandhinz,项目名称:openstack.net,代码行数:9,代码来源:CloudServersTests.cs

示例10: DeleteRoleFromUser

        public void DeleteRoleFromUser()
        {
            var identity = new CloudIdentity { Username = "{username}", APIKey = "{apiKey}" };
            var provider = new CloudIdentityProvider(identity);

            #region DeleteRoleFromUser
            User user = provider.GetUserByName("{username}", null);
            provider.DeleteRoleFromUser(user.Id, "{roleId}", null);
            #endregion
        }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:10,代码来源:IdentityProviderExamples.cs

示例11: ShowNetwork

        public CloudNetwork ShowNetwork(string networkId, string region = null, CloudIdentity identity = null)
        {
            var urlPath = new Uri(string.Format("{0}/os-networksv2/{1}", GetServiceEndpoint(identity, region), networkId));
            var response = ExecuteRESTRequest<CloudNetworkResponse>(identity, urlPath, HttpMethod.GET);

            if (response == null || response.Data == null)
                return null;

            return response.Data.Network;
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:10,代码来源:CloudNetworksProvider.cs

示例12: ResetApiKey

        public void ResetApiKey()
        {
            var identity = new CloudIdentity { Username = "{username}", APIKey = "{apiKey}" };
            var provider = new CloudIdentityProvider(identity);

            #region ResetApiKey
            UserCredential credential = provider.ResetApiKey("{userId}");
            string newApiKey = credential.APIKey;
            #endregion
        }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:10,代码来源:IdentityProviderExamples.cs

示例13: ListNetworks

        public IEnumerable<CloudNetwork> ListNetworks(string region = null, CloudIdentity identity = null)
        {
            var urlPath = new Uri(string.Format("{0}/os-networksv2", GetServiceEndpoint(identity, region)));
            var response = ExecuteRESTRequest<ListCloudNetworksResponse>(identity, urlPath, HttpMethod.GET);

            if (response == null || response.Data == null)
                return null;

            return response.Data.Networks;
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:10,代码来源:CloudNetworksProvider.cs

示例14: ComputeTests

 public ComputeTests()
 {
     _testIdentity = new CloudIdentity()
     {
         APIKey = ConfigurationManager.AppSettings["TestIdentityAPIKey"],
         Password = ConfigurationManager.AppSettings["TestIdentityPassword"],
         Region = ConfigurationManager.AppSettings["TestIdentityRegion"],
         Username = ConfigurationManager.AppSettings["TestIdentityUserName"],
     };
 }
开发者ID:ejwebb,项目名称:openstack.net,代码行数:10,代码来源:ComputeTests.cs

示例15: Rackspace

        private string username; //private variable for username

        #endregion Fields

        #region Constructors

        //Constructor accpeting the username, password or apikey
        public Rackspace(string username, string apiKey)
        {
            this.username = username; //setting the username property
            this.apiKey = apiKey; //setting the apikey property
            //Creating an instance of CloudIdentity
            identity = new CloudIdentity();

            identity.Username = username;
            identity.APIKey = apiKey;
        }
开发者ID:vcholan,项目名称:generic-cloud-storage-client,代码行数:17,代码来源:Rackspace.cs


注:本文中的net.openstack.Core.Domain.CloudIdentity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。