示例#1
0
        /// <summary>
        /// UpdateTTL is used to update the TTL of a check
        /// </summary>
        /// <param name="checkID">The check ID</param>
        /// <param name="output">An optional, arbitrary string to write to the check status</param>
        /// <param name="status">The state to set the check to</param>
        /// <returns>An empty write result</returns>
        public Task <WriteResult> UpdateTTL(string checkID, string output, TTLStatus status, CancellationToken ct = default(CancellationToken))
        {
            var u = new CheckUpdate
            {
                Status = status.Status,
                Output = output
            };

            return(_client.Put(string.Format("/v1/agent/check/update/{0}", checkID), u).Execute(ct));
        }
示例#2
0
        /// <summary>
        /// LegacyUpdateTTL is used to update the TTL of a check
        /// </summary>
        /// <param name="checkID">The check ID</param>
        /// <param name="note">An optional, arbitrary string to note on the check status</param>
        /// <param name="status">The state to set the check to</param>
        /// <returns>An empty write result</returns>
        private Task <WriteResult> LegacyUpdateTTL(string checkID, string note, TTLStatus status, CancellationToken ct = default(CancellationToken))
        {
            var request = _client.PutNothing(string.Format("/v1/agent/check/{0}/{1}", status.LegacyStatus, checkID));

            if (!string.IsNullOrEmpty(note))
            {
                request.Params.Add("note", note);
            }
            return(request.Execute(ct));
        }
示例#3
0
        /// <summary>
        /// UpdateTTL is used to update the TTL of a check
        /// </summary>
        /// <param name="checkID">The check ID</param>
        /// <param name="note">An optional, arbitrary string to write to the check status</param>
        /// <param name="status">The state to set the check to</param>
        /// <returns>An empty write result</returns>
        public WriteResult UpdateTTL(string checkID, string note, TTLStatus status)
        {
            var request = _client.CreateWrite(string.Format("/v1/agent/check/{0}/{1}", status.Status, checkID));

            if (!string.IsNullOrEmpty(note))
            {
                request.Params.Add("note", HttpUtility.UrlPathEncode(note));
            }
            return(request.Execute());
        }