Ejemplo n.º 1
0
        public HttpResponseMessage GetTriggeredJobHistory(string jobName)
        {
            string etag = GetRequestETag();

            string currentETag;
            TriggeredJobHistory history = _triggeredJobsManager.GetJobHistory(jobName, etag, out currentETag);

            if (history == null && currentETag == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            HttpResponseMessage response;

            if (etag == currentETag)
            {
                response = Request.CreateResponse(HttpStatusCode.NotModified);
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.OK, history);
            }
            response.Headers.ETag = new EntityTagHeaderValue(currentETag);
            return(response);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetTriggeredJobHistory(string jobName)
        {
            string etag = GetRequestETag();

            string currentETag;
            TriggeredJobHistory history = _triggeredJobsManager.GetJobHistory(jobName, etag, out currentETag);

            if (history == null && currentETag == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            HttpResponseMessage response;

            if (etag == currentETag)
            {
                response = Request.CreateResponse(HttpStatusCode.NotModified);
            }
            else
            {
                object triggeredJobHistoryResponse =
                    history != null && ArmUtils.IsArmRequest(Request) ? ArmUtils.AddEnvelopeOnArmRequest(history.TriggeredJobRuns, Request) : history;

                response = Request.CreateResponse(HttpStatusCode.OK, triggeredJobHistoryResponse);
            }
            response.Headers.ETag = new EntityTagHeaderValue(currentETag);
            return(response);
        }