in src/Microsoft.Azure.NotificationHubs/NamespaceManager.cs [195:236]
public async Task<NotificationHubDescription> GetNotificationHubAsync(string path, CancellationToken cancellationToken)
{
if (path == null)
{
throw new ArgumentNullException(nameof(path));
}
var requestUri = new UriBuilder(_baseUri)
{
Scheme = Uri.UriSchemeHttps,
Path = path,
Query = $"api-version={ManagementStrings.ApiVersion}"
};
return await _retryPolicy.RunOperation(async (ct) =>
{
using (var response = await SendAsync(() =>
{
var httpRequestMessage = CreateHttpRequest(HttpMethod.Get, requestUri.Uri);
return httpRequestMessage;
}, ct).ConfigureAwait(false))
{
var trackingId = string.Empty;
if (response.Headers.TryGetValues(TrackingIdHeaderKey, out var values))
{
trackingId = values.FirstOrDefault();
}
var xmlResponse = await GetXmlContent(response, trackingId).ConfigureAwait(false);
if (xmlResponse.NodeType != XmlNodeType.None)
{
var model = GetModelFromResponse<NotificationHubDescription>(xmlResponse, trackingId);
model.Path = path;
return model;
}
else
{
throw new MessagingEntityNotFoundException(new MessagingExceptionDetail(ExceptionErrorCodes.ConflictGeneric, "Notification Hub not found", ErrorLevelType.UserError, response.StatusCode, trackingId));
}
};
}, cancellationToken);
}