public virtual Response <VirtualWorkspace> Get(CancellationToken cancellationToken = default) { using var scope = _virtualWorkspaceWorkspacesClientDiagnostics.CreateScope("VirtualWorkspace.Get"); scope.Start(); try { var response = _virtualWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw _virtualWorkspaceWorkspacesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualWorkspace(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualWorkspaceResource> Get(string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); using var scope = _virtualWorkspaceWorkspacesClientDiagnostics.CreateScope("VirtualWorkspaceCollection.Get"); scope.Start(); try { var response = _virtualWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken); 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; } }