Exemplo n.º 1
0
        private List <CloudService> GetStoreCloudServices()
        {
            CloudServiceList    cloudServices = storeChannel.ListCloudServices(subscriptionId);
            List <CloudService> storeServices = cloudServices.FindAll(
                c => CultureInfo.CurrentCulture.CompareInfo.IsPrefix(c.Name, StoreServicePrefix));

            return(storeServices);
        }
Exemplo n.º 2
0
        internal static string SerializeListContainersResult(IEnumerable <ClusterDetails> containers, string deploymentNamespace, bool writeError, bool writeExtendedError)
        {
            var serviceList = new CloudServiceList();

            foreach (var containerGroup in containers.GroupBy(container => container.Location))
            {
                serviceList.Add(new CloudService()
                {
                    GeoRegion = containerGroup.Key,
                    Resources = new ResourceList(from container in containerGroup
                                                 select ListClusterContainerResult_ToInternal(container, deploymentNamespace, writeError, writeExtendedError))
                });
            }

            return(serviceList.SerializeToXml());
        }
Exemplo n.º 3
0
        public HttpResponseMessage ListCloudServicesAsync(string subscriptionId)
        {
            var requestMessage = this.Request;
            var detailLevel    = requestMessage.RequestUri.ParseQueryString()["detailLevel"];

            List <Cluster> clusters;
            bool           subExists = _clustersAvailable.TryGetValue(subscriptionId, out clusters);

            if (!subExists)
            {
                return(this.Request.CreateResponse(HttpStatusCode.Accepted, new CloudServiceList()));
            }

            var clustersByLocation = clusters.GroupBy(c => c.Location);

            var cloudServiceList = new CloudServiceList();

            foreach (var locationcluster in clustersByLocation)
            {
                var cloudService = new CloudService();
                cloudService.Description = "test description";
                cloudService.GeoRegion   = locationcluster.Key;
                cloudService.Label       = "test label";
                cloudService.Resources   = new ResourceList();
                foreach (Cluster cluster in locationcluster)
                {
                    var resource = new Resource();
                    resource.Name        = cluster.DnsName;
                    resource.Type        = ClustersPocoClient.ClustersResourceType;
                    resource.State       = cluster.State.ToString();
                    resource.OutputItems = this.GetOutputItems(cluster);
                    cloudService.Resources.Add(resource);
                }
                cloudServiceList.Add(cloudService);
            }

            return(this.Request.CreateResponse(HttpStatusCode.Accepted, cloudServiceList));;
        }
        public HttpResponseMessage ListCloudServicesAsync(string subscriptionId)
        {
            var requestMessage = this.Request;
            var detailLevel = requestMessage.RequestUri.ParseQueryString()["detailLevel"];
            
            List<Cluster> clusters;
            bool subExists = _clustersAvailable.TryGetValue(subscriptionId, out clusters);
            if (!subExists)
            {
                return this.Request.CreateResponse(HttpStatusCode.Accepted, new CloudServiceList());
            }

            var clustersByLocation = clusters.GroupBy(c => c.Location);

            var cloudServiceList = new CloudServiceList();

            foreach (var locationcluster in clustersByLocation)
            {
                var cloudService = new CloudService();
                cloudService.Description = "test description";
                cloudService.GeoRegion = locationcluster.Key;
                cloudService.Label = "test label";
                cloudService.Resources = new ResourceList();
                foreach (Cluster cluster in locationcluster)
                {
                    var resource = new Resource();
                    resource.Name = cluster.DnsName;
                    resource.Type = ClustersPocoClient.ClustersResourceType;
                    resource.State = cluster.State.ToString();
                    resource.OutputItems = this.GetOutputItems(cluster);
                    cloudService.Resources.Add(resource);
                }
                cloudServiceList.Add(cloudService);
            }

            return this.Request.CreateResponse(HttpStatusCode.Accepted, cloudServiceList);;
        }