public async virtual Task <Response <NetworkInterface> > GetAsync(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceContainer.Get"); scope.Start(); try { if (networkInterfaceName == null) { throw new ArgumentNullException(nameof(networkInterfaceName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, networkInterfaceName, expand, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new NetworkInterface(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task<Response<NetworkInterface>> GetAsync(string expand = null, CancellationToken cancellationToken = default) { using var scope = _networkInterfaceClientDiagnostics.CreateScope("NetworkInterface.Get"); scope.Start(); try { var response = await _networkInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new NetworkInterface(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <NetworkInterface> > GetAsync(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(networkInterfaceName, nameof(networkInterfaceName)); using var scope = _networkInterfaceClientDiagnostics.CreateScope("NetworkInterfaceCollection.Get"); scope.Start(); try { var response = await _networkInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkInterfaceName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _networkInterfaceClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new NetworkInterface(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }