Пример #1
0
        public virtual Response <NamespaceAuthorizationRule> Get(string authorizationRuleName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName));

            using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.Get");
            scope.Start();
            try
            {
                var response = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken);
                if (response.Value == null)
                {
                    throw _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new NamespaceAuthorizationRule(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <NamespaceAuthorizationRule> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("NamespaceAuthorizationRule.Get");
     scope.Start();
     try
     {
         var response = _namespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new NamespaceAuthorizationRule(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }