public virtual Response <DisasterRecoveryAuthorizationRule> Get(string authorizationRuleName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName));

            using var scope = _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateScope("DisasterRecoveryAuthorizationRuleCollection.Get");
            scope.Start();
            try
            {
                var response = _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken);
                if (response.Value == null)
                {
                    throw _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DisasterRecoveryAuthorizationRule(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 2
0
 public virtual Response <DisasterRecoveryAuthorizationRule> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateScope("DisasterRecoveryAuthorizationRule.Get");
     scope.Start();
     try
     {
         var response = _disasterRecoveryAuthorizationRuleDisasterRecoveryConfigsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken);
         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;
     }
 }