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