public async virtual Task <Response <NetworkInterfaceIPConfiguration> > GetAsync(string ipConfigurationName, CancellationToken cancellationToken = default)
        {
            if (ipConfigurationName == null)
            {
                throw new ArgumentNullException(nameof(ipConfigurationName));
            }

            using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationCollection.Get");
            scope.Start();
            try
            {
                var response = await _networkInterfaceIPConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigurationName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new NetworkInterfaceIPConfiguration(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
        public virtual async Task <Response <NetworkInterfaceIPConfiguration> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _networkInterfaceIPConfigurationClientDiagnostics.CreateScope("NetworkInterfaceIPConfiguration.Get");
            scope.Start();
            try
            {
                var response = await _networkInterfaceIPConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new NetworkInterfaceIPConfiguration(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }