Exemplo n.º 1
0
        public virtual Response <FirewallRule> Get(string firewallRuleName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName));

            using var scope = _firewallRuleClientDiagnostics.CreateScope("FirewallRuleCollection.Get");
            scope.Start();
            try
            {
                var response = _firewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new FirewallRule(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <FirewallRuleResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _firewallRuleClientDiagnostics.CreateScope("FirewallRuleResource.Get");
     scope.Start();
     try
     {
         var response = _firewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new FirewallRuleResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }