Exemplo n.º 1
0
        internal static Tuple<Uri, string> GetKeystoneToken()
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            Keystone.Core.KeystoneClient keystone = new Keystone.Core.KeystoneClient();
            var tsk = keystone.GetToken(keystoneServer, keystoneUser, keystoneUserPassword, keystoneTenant, tokenSource.Token);
            Keystone.Core.KeystoneResponse response = tsk.Result;

            System.Diagnostics.Trace.WriteLine("Swift endpoint: ");

            var zz = response.Access.ServiceCatalog.Where(c => c.Name.Equals(SWIFT_SERIVCE_NAME)).FirstOrDefault().EndpointsCollection.Where(e => !string.IsNullOrEmpty(e.PublicUrl)).Select(x => x);

            //zz.AsParallel().ForAll(e => System.Diagnostics.Trace.WriteLine(e.PublicUrl));

            //return response.Access.Token.Id;
            return new Tuple<Uri, string>(new Uri(zz.FirstOrDefault().PublicUrl), response.Access.Token.Id);
        }
Exemplo n.º 2
0
        internal static Tuple <Uri, string> GetKeystoneToken()
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();

            Keystone.Core.KeystoneClient keystone = new Keystone.Core.KeystoneClient();
            var tsk = keystone.GetToken(keystoneServer, keystoneUser, keystoneUserPassword, keystoneTenant, tokenSource.Token);

            Keystone.Core.KeystoneResponse response = tsk.Result;

            System.Diagnostics.Trace.WriteLine("Swift endpoint: ");

            var zz = response.Access.ServiceCatalog.Where(c => c.Name.Equals(SWIFT_SERIVCE_NAME)).FirstOrDefault().EndpointsCollection.Where(e => !string.IsNullOrEmpty(e.PublicUrl)).Select(x => x);

            //zz.AsParallel().ForAll(e => System.Diagnostics.Trace.WriteLine(e.PublicUrl));

            //return response.Access.Token.Id;
            return(new Tuple <Uri, string>(new Uri(zz.FirstOrDefault().PublicUrl), response.Access.Token.Id));
        }