in src/Infrastructure/Providers/Concrete/AmbariApiContentProvider.cs [40:66]
public async Task<string> GetResponseContentAsync(string uriEndpoint)
{
if (uriEndpoint == null || uriEndpoint.Equals(string.Empty) ||
!Uri.IsWellFormedUriString(uriEndpoint, UriKind.Absolute))
{
throw new ArgumentException($"Invalid argument was passed." +
$"UriEndpoint - cannot be null/empty: {uriEndpoint}.");
}
try
{
using (var response = await _httpClient.GetAsync(uriEndpoint))
{
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpRequestException($"Status code: {response.StatusCode} isnt Ok.");
}
return await response.Content.ReadAsStringAsync();
}
}
catch (Exception e)
{
_logger.LogError(e, $"Failed to get response from Ambari: {uriEndpoint}.");
throw;
}
}