public virtual async Task <ArmOperation <RouteFilterResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string routeFilterName, RouteFilterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(routeFilterName, nameof(routeFilterName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _routeFilterClientDiagnostics.CreateScope("RouteFilterCollection.CreateOrUpdate"); scope.Start(); try { var response = await _routeFilterRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, data, cancellationToken).ConfigureAwait(false); var operation = new NetworkArmOperation <RouteFilterResource>(new RouteFilterOperationSource(Client), _routeFilterClientDiagnostics, Pipeline, _routeFilterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual RouteFilterCreateOrUpdateOperation CreateOrUpdate(string routeFilterName, RouteFilterData routeFilterParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (routeFilterName == null) { throw new ArgumentNullException(nameof(routeFilterName)); } if (routeFilterParameters == null) { throw new ArgumentNullException(nameof(routeFilterParameters)); } using var scope = _clientDiagnostics.CreateScope("RouteFilterContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, routeFilterName, routeFilterParameters, cancellationToken); var operation = new RouteFilterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, routeFilterName, routeFilterParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual RouteFilterCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string routeFilterName, RouteFilterData routeFilterParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(routeFilterName, nameof(routeFilterName)); if (routeFilterParameters == null) { throw new ArgumentNullException(nameof(routeFilterParameters)); } using var scope = _routeFilterClientDiagnostics.CreateScope("RouteFilterCollection.CreateOrUpdate"); scope.Start(); try { var response = _routeFilterRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, routeFilterParameters, cancellationToken); var operation = new RouteFilterCreateOrUpdateOperation(ArmClient, _routeFilterClientDiagnostics, Pipeline, _routeFilterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, routeFilterParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }