public virtual ApplicationGatewayCreateOrUpdateOperation CreateOrUpdate(string applicationGatewayName, ApplicationGatewayData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (applicationGatewayName == null) { throw new ArgumentNullException(nameof(applicationGatewayName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ApplicationGatewayContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, applicationGatewayName, parameters, cancellationToken); var operation = new ApplicationGatewayCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, applicationGatewayName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ApplicationGatewayCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string applicationGatewayName, ApplicationGatewayData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(applicationGatewayName, nameof(applicationGatewayName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _applicationGatewayClientDiagnostics.CreateScope("ApplicationGatewayCollection.CreateOrUpdate"); scope.Start(); try { var response = _applicationGatewayRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, applicationGatewayName, parameters, cancellationToken); var operation = new ApplicationGatewayCreateOrUpdateOperation(ArmClient, _applicationGatewayClientDiagnostics, Pipeline, _applicationGatewayRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, applicationGatewayName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }