Ejemplo n.º 1
0
        public static async Task <IEnumerable <string> > GetSubscriptions()
        {
            if (_subscriptions == null)
            {
                // Load all subscriptions
                var csmSubscriptions = await CsmManager.GetSubscriptionNamesToIdMap();

                _subscriptions = (SimpleSettings.Subscriptions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Concat(SimpleSettings.LinuxSubscriptions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)))
                                 //It can be either a displayName or a subscriptionId
                                 //For Linux it needs to be subscriptionId
                                 .Select(s => s.Trim())
                                 .Where(n =>
                {
                    Guid temp;
                    return(csmSubscriptions.ContainsKey(n) || Guid.TryParse(n, out temp));
                })
                                 .Select(sn =>
                {
                    Guid temp;
                    if (Guid.TryParse(sn, out temp))
                    {
                        return(sn);
                    }
                    else
                    {
                        return(csmSubscriptions[sn]);
                    }
                });
            }
            return(_subscriptions);
        }
Ejemplo n.º 2
0
        public static async Task <IEnumerable <string> > GetSubscriptions()
        {
            if (_subscriptions == null)
            {
                // Load all subscriptions
                var csmSubscriptions = await CsmManager.GetSubscriptionNamesToIdMap();

                _subscriptions = csmSubscriptions
                                 .Select(sn =>
                {
                    return(csmSubscriptions[sn.Key]);
                });
            }
            return(_subscriptions);
        }