public async virtual Task <Response <NetworkVirtualApplianceSku> > GetAsync(string skuName, CancellationToken cancellationToken = default) { if (skuName == null) { throw new ArgumentNullException(nameof(skuName)); } using var scope = _clientDiagnostics.CreateScope("NetworkVirtualApplianceSkuCollection.Get"); scope.Start(); try { var response = await _virtualApplianceSkusRestClient.GetAsync(Id.SubscriptionId, skuName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new NetworkVirtualApplianceSku(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <NetworkVirtualApplianceSku> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _networkVirtualApplianceSkuVirtualApplianceSkusClientDiagnostics.CreateScope("NetworkVirtualApplianceSku.Get"); scope.Start(); try { var response = await _networkVirtualApplianceSkuVirtualApplianceSkusRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new NetworkVirtualApplianceSku(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <NetworkVirtualApplianceSkuResource> > GetAsync(string skuName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); using var scope = _networkVirtualApplianceSkuVirtualApplianceSkusClientDiagnostics.CreateScope("NetworkVirtualApplianceSkuCollection.Get"); scope.Start(); try { var response = await _networkVirtualApplianceSkuVirtualApplianceSkusRestClient.GetAsync(Id.SubscriptionId, skuName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new NetworkVirtualApplianceSkuResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }