public virtual Response <VirtualHubResource> Get(CancellationToken cancellationToken = default) { using var scope = _virtualHubClientDiagnostics.CreateScope("VirtualHubResource.Get"); scope.Start(); try { var response = _virtualHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualHubResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualHub> Get(string virtualHubName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualHubName, nameof(virtualHubName)); using var scope = _virtualHubClientDiagnostics.CreateScope("VirtualHubCollection.Get"); scope.Start(); try { var response = _virtualHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualHubName, cancellationToken); if (response.Value == null) { throw _virtualHubClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualHub(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualHub> Get(string virtualHubName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualHubContainer.Get"); scope.Start(); try { if (virtualHubName == null) { throw new ArgumentNullException(nameof(virtualHubName)); } var response = _restClient.Get(Id.ResourceGroupName, virtualHubName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualHub(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }