internal ServiceBusSubscription(ArmResource options, ServiceBusSubscriptionData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _subscriptionsRestClient = new SubscriptionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
public virtual async Task <ArmOperation <ServiceBusSubscription> > CreateOrUpdateAsync(WaitUntil waitUntil, string subscriptionName, ServiceBusSubscriptionData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionName, nameof(subscriptionName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _serviceBusSubscriptionSubscriptionsClientDiagnostics.CreateScope("ServiceBusSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _serviceBusSubscriptionSubscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, subscriptionName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ServiceBusArmOperation <ServiceBusSubscription>(Response.FromValue(new ServiceBusSubscription(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ServiceBusSubscription(ArmClient armClient, ServiceBusSubscriptionData data) : this(armClient, data.Id) { HasData = true; _data = data; }
public virtual ServiceBusSubscriptionCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string subscriptionName, ServiceBusSubscriptionData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionName, nameof(subscriptionName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _serviceBusSubscriptionSubscriptionsClientDiagnostics.CreateScope("ServiceBusSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { var response = _serviceBusSubscriptionSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, subscriptionName, parameters, cancellationToken); var operation = new ServiceBusSubscriptionCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <SubscriptionCreateOrUpdateOperation> CreateOrUpdateAsync(string subscriptionName, ServiceBusSubscriptionData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (subscriptionName == null) { throw new ArgumentNullException(nameof(subscriptionName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ServiceBusSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _subscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, subscriptionName, parameters, cancellationToken).ConfigureAwait(false); var operation = new SubscriptionCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ServiceBusSubscriptionResource(ArmClient client, ServiceBusSubscriptionData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <ServiceBusSubscriptionResource> Update(WaitUntil waitUntil, ServiceBusSubscriptionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _serviceBusSubscriptionSubscriptionsClientDiagnostics.CreateScope("ServiceBusSubscriptionResource.Update"); scope.Start(); try { var response = _serviceBusSubscriptionSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new ServiceBusArmOperation <ServiceBusSubscriptionResource>(Response.FromValue(new ServiceBusSubscriptionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }