public async virtual Task <ConsumerGroupCreateOrUpdateOperation> CreateOrUpdateAsync(string consumerGroupName, ConsumerGroupData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (consumerGroupName == null) { throw new ArgumentNullException(nameof(consumerGroupName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ConsumerGroupCollection.CreateOrUpdate"); scope.Start(); try { var response = await _consumerGroupsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ConsumerGroupCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <ConsumerGroupResource> > UpdateAsync(WaitUntil waitUntil, ConsumerGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _consumerGroupClientDiagnostics.CreateScope("ConsumerGroupResource.Update"); scope.Start(); try { var response = await _consumerGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); var operation = new EventHubsArmOperation <ConsumerGroupResource>(Response.FromValue(new ConsumerGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <ConsumerGroup> > CreateOrUpdateAsync(bool waitForCompletion, string consumerGroupName, ConsumerGroupData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(consumerGroupName, nameof(consumerGroupName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _consumerGroupClientDiagnostics.CreateScope("ConsumerGroupCollection.CreateOrUpdate"); scope.Start(); try { var response = await _consumerGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, parameters, cancellationToken).ConfigureAwait(false); var operation = new EventHubsArmOperation <ConsumerGroup>(Response.FromValue(new ConsumerGroup(Client, response), response.GetRawResponse())); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }