示例#1
0
        public async Task <IHttpActionResult> Get()
        {
            ServiceUriBuilder builder        = new ServiceUriBuilder("ClusterService");
            IClusterService   clusterService = ServiceProxy.Create <IClusterService>(builder.ToUri(), new ServicePartitionKey(1));

            IEnumerable <ClusterView> clusters = await clusterService.GetClusterListAsync();

            return(this.Ok(
                       clusters.Select(
                           x => new
            {
                ClusterId = x.ClusterId,
                Name = this.GetClusterName(x.ClusterId),
                ApplicationCount = x.ApplicationCount,
                ServiceCount = x.ServiceCount,
                Capacity = this.GetUserCapacity(x.UserCount, x.MaxUsers),
                UserCount = x.UserCount,
                MaxUsers = x.MaxUsers,
                TimeRemaining = x.TimeRemaining > TimeSpan.Zero
                            ? String.Format("{0:hh\\:mm\\:ss}", x.TimeRemaining)
                            : "expired"
            })));
        }