示例#1
0
        public virtual Response <AfdRuleSet> Get(string ruleSetName, CancellationToken cancellationToken = default)
        {
            if (ruleSetName == null)
            {
                throw new ArgumentNullException(nameof(ruleSetName));
            }

            using var scope = _clientDiagnostics.CreateScope("AfdRuleSetCollection.Get");
            scope.Start();
            try
            {
                var response = _afdRuleSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new AfdRuleSet(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#2
0
 public virtual Response <AfdRuleSetResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _afdRuleSetClientDiagnostics.CreateScope("AfdRuleSetResource.Get");
     scope.Start();
     try
     {
         var response = _afdRuleSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new AfdRuleSetResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }