public virtual Response <EventHubAuthorizationRuleResource> Get(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); using var scope = _eventHubAuthorizationRuleEventHubsClientDiagnostics.CreateScope("EventHubAuthorizationRuleCollection.Get"); scope.Start(); try { var response = _eventHubAuthorizationRuleEventHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new EventHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <EventHubAuthorizationRule> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("EventHubAuthorizationRule.Get"); scope.Start(); try { var response = _eventHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new EventHubAuthorizationRule(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }