Esempio n. 1
0
        private ByteArrayContent ConvertToByteArray(LogStashCheckRecord entry)
        {
            var jsonEntry   = JsonConvert.SerializeObject(entry);
            var buffer      = Encoding.UTF8.GetBytes(jsonEntry);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            return(byteContent);
        }
Esempio n. 2
0
 private string GetEndpoint(LogStashCheckRecord entry) =>
 (entry.EnvironmentId == (int)EnvironmentsEnum.Prod) ? _settings.Value.LogStashEndpointBeta : _settings.Value.LogStashEndpointProd;
Esempio n. 3
0
 async Task PostLogTaskAsync(LogStashCheckRecord entry)
 {
     var endpoint = GetEndpoint(entry);
     var content  = ConvertToByteArray(entry);
     await _httpClient.PostAsync(endpoint, content);
 }