コード例 #1
0
        public object Get()
        {
            //
            // Filter by WorkerProcess
            string wpUuid = Context.Request.Query[Defines.IDENTIFIER];

            if (string.IsNullOrEmpty(wpUuid))
            {
                return(NotFound());
            }

            WorkerProcess wp = WorkerProcessHelper.GetWorkerProcess(new WorkerProcessId(wpUuid).Id);

            if (wp == null)
            {
                return(NotFound());
            }

            IEnumerable <Site> sites = SitesHelper.GetSites(wp);

            //
            // Set HTTP header for total count
            this.Context.Response.SetItemsCount(sites.Count());

            Fields fields = Context.Request.GetFields();

            var obj = new {
                websites = sites.Select(site => Sites.SiteHelper.ToJsonModelRef(site, fields))
            };

            return(obj);
        }
コード例 #2
0
        public object Get(string id)
        {
            var target = WorkerProcessHelper.GetWorkerProcess(new WorkerProcessId(id).Id);

            if (target == null)
            {
                return(NotFound());
            }

            return(WorkerProcessHelper.WpToJsonModel(target, Context.Request.GetFields()));
        }
コード例 #3
0
        public void Delete(string id)
        {
            var target = WorkerProcessHelper.GetWorkerProcess(new WorkerProcessId(id).Id);

            if (target != null)
            {
                WorkerProcessHelper.Kill(target);
            }

            // Success
            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
        }
コード例 #4
0
        public object Get()
        {
            IEnumerable <WorkerProcess> wps = null;

            //
            // Filter by AppPool
            string appPoolUuid = Context.Request.Query[AppPools.Defines.IDENTIFIER];

            if (!string.IsNullOrEmpty(appPoolUuid))
            {
                ApplicationPool pool = AppPoolHelper.GetAppPool(AppPoolId.CreateFromUuid(appPoolUuid).Name);

                if (pool == null)
                {
                    return(NotFound());
                }

                wps = WorkerProcessHelper.GetWorkerProcesses(pool);
            }

            //
            // All
            if (wps == null)
            {
                wps = WorkerProcessHelper.GetWorkerProcesses();
            }

            //
            // Set HTTP header for total count
            this.Context.Response.SetItemsCount(wps.Count());

            Fields fields = Context.Request.GetFields();

            var obj = new {
                worker_processes = wps.Select(wp => WorkerProcessHelper.ToJsonModelRef(wp, fields))
            };

            return(obj);
        }