Пример #1
0
        public async virtual Task <Response <NetworkRuleSet> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _networkRuleSetNamespacesClientDiagnostics.CreateScope("NetworkRuleSet.Get");
            scope.Start();
            try
            {
                var response = await _networkRuleSetNamespacesRestClient.GetNetworkRuleSetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _networkRuleSetNamespacesClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new NetworkRuleSet(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }