public virtual ConsumerGroupCreateOrUpdateOperation CreateOrUpdate(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 = _consumerGroupsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, parameters, cancellationToken); var operation = new ConsumerGroupCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ConsumerGroupResource> Update(WaitUntil waitUntil, ConsumerGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _consumerGroupClientDiagnostics.CreateScope("ConsumerGroupResource.Update"); scope.Start(); try { var response = _consumerGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new EventHubsArmOperation <ConsumerGroupResource>(Response.FromValue(new ConsumerGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ConsumerGroup> CreateOrUpdate(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 = _consumerGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, parameters, cancellationToken); var operation = new EventHubsArmOperation <ConsumerGroup>(Response.FromValue(new ConsumerGroup(Client, response), response.GetRawResponse())); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }