public virtual RouteCreateOrUpdateOperation CreateOrUpdate(string routeName, RouteData routeParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (routeName == null) { throw new ArgumentNullException(nameof(routeName)); } if (routeParameters == null) { throw new ArgumentNullException(nameof(routeParameters)); } using var scope = _clientDiagnostics.CreateScope("RouteContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, routeName, routeParameters, cancellationToken); var operation = new RouteCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, routeName, routeParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual RouteCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string routeName, RouteData routeParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); if (routeParameters == null) { throw new ArgumentNullException(nameof(routeParameters)); } using var scope = _routeClientDiagnostics.CreateScope("RouteCollection.CreateOrUpdate"); scope.Start(); try { var response = _routeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeName, routeParameters, cancellationToken); var operation = new RouteCreateOrUpdateOperation(ArmClient, _routeClientDiagnostics, Pipeline, _routeRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeName, routeParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }