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