public virtual VirtualHubCreateOrUpdateOperation CreateOrUpdate(string virtualHubName, VirtualHubData virtualHubParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (virtualHubName == null) { throw new ArgumentNullException(nameof(virtualHubName)); } if (virtualHubParameters == null) { throw new ArgumentNullException(nameof(virtualHubParameters)); } using var scope = _clientDiagnostics.CreateScope("VirtualHubContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, virtualHubName, virtualHubParameters, cancellationToken); var operation = new VirtualHubCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, virtualHubName, virtualHubParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualHubCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string virtualHubName, VirtualHubData virtualHubParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualHubName, nameof(virtualHubName)); if (virtualHubParameters == null) { throw new ArgumentNullException(nameof(virtualHubParameters)); } using var scope = _virtualHubClientDiagnostics.CreateScope("VirtualHubCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, virtualHubName, virtualHubParameters, cancellationToken); var operation = new VirtualHubCreateOrUpdateOperation(ArmClient, _virtualHubClientDiagnostics, Pipeline, _virtualHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualHubName, virtualHubParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }