Пример #1
0
 private void SetException(VictorOpsAlert payload, PostAlertOptions options)
 {
     if (!string.IsNullOrEmpty(options.Exception))
     {
         payload.Exception = options.Exception.Substring(0, 1124); // https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#note-vo_annotate-s-note
     }
 }
Пример #2
0
        private string GetPayloadJson(PostAlertOptions options)
        {
            var payload = new VictorOpsAlert()
            {
                Tool        = AlertSource.Seq,
                MessageType = options.Type,
                Title       = options.Title,
                Message     = options.Message,
                Id          = options.Id
            };

            SetException(payload, options);

            var jo = (JObject)JToken.FromObject(payload);

            foreach (var property in options.Properties)
            {
                jo.Add(property.Key, property.Value);
            }

            var payloadJson = JsonConvert.SerializeObject(jo);

            return(payloadJson);
        }