public async virtual Task <EventHubCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string eventHubName, EventHubData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(eventHubName, nameof(eventHubName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.CreateOrUpdate"); scope.Start(); try { var response = await _eventHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventHubName, parameters, cancellationToken).ConfigureAwait(false); var operation = new EventHubCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual EventHubCreateOrUpdateOperation CreateOrUpdate(string eventHubName, EventHubData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (eventHubName == null) { throw new ArgumentNullException(nameof(eventHubName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("EventHubCollection.CreateOrUpdate"); scope.Start(); try { var response = _eventHubsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventHubName, parameters, cancellationToken); var operation = new EventHubCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }