public async virtual Task <Response <DisasterRecoveryAuthorizationRule> > GetAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { if (authorizationRuleName == null) { throw new ArgumentNullException(nameof(authorizationRuleName)); } using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryAuthorizationRuleCollection.Get"); scope.Start(); try { var response = await _disasterRecoveryConfigsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new DisasterRecoveryAuthorizationRule(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <DisasterRecoveryAuthorizationRule> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateScope("DisasterRecoveryAuthorizationRule.Get"); scope.Start(); try { var response = await _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DisasterRecoveryAuthorizationRule(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }