public virtual async Task <Response <VirtualApplicationResource> > GetAsync(string applicationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); using var scope = _virtualApplicationApplicationsClientDiagnostics.CreateScope("VirtualApplicationCollection.Get"); scope.Start(); try { var response = await _virtualApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualApplicationResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <VirtualApplication> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _virtualApplicationApplicationsClientDiagnostics.CreateScope("VirtualApplication.Get"); scope.Start(); try { var response = await _virtualApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _virtualApplicationApplicationsClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualApplication(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }