public virtual Response <DefaultSecurityRuleResource> Get(string defaultSecurityRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(defaultSecurityRuleName, nameof(defaultSecurityRuleName)); using var scope = _defaultSecurityRuleClientDiagnostics.CreateScope("DefaultSecurityRuleCollection.Get"); scope.Start(); try { var response = _defaultSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultSecurityRuleName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DefaultSecurityRuleResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DefaultSecurityRule> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DefaultSecurityRule.Get"); scope.Start(); try { var response = _defaultSecurityRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DefaultSecurityRule(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }