public virtual Response <HubVirtualNetworkConnection> Get(string connectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); using var scope = _hubVirtualNetworkConnectionClientDiagnostics.CreateScope("HubVirtualNetworkConnectionCollection.Get"); scope.Start(); try { var response = _hubVirtualNetworkConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken); if (response.Value == null) { throw _hubVirtualNetworkConnectionClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new HubVirtualNetworkConnection(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <HubVirtualNetworkConnection> Get(string connectionName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionContainer.Get"); scope.Start(); try { if (connectionName == null) { throw new ArgumentNullException(nameof(connectionName)); } var response = _restClient.Get(Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new HubVirtualNetworkConnection(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <HubVirtualNetworkConnectionResource> Get(CancellationToken cancellationToken = default) { using var scope = _hubVirtualNetworkConnectionClientDiagnostics.CreateScope("HubVirtualNetworkConnectionResource.Get"); scope.Start(); try { var response = _hubVirtualNetworkConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new HubVirtualNetworkConnectionResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }