public virtual LocalNetworkGatewayCreateOrUpdateOperation CreateOrUpdate(string localNetworkGatewayName, LocalNetworkGatewayData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (localNetworkGatewayName == null) { throw new ArgumentNullException(nameof(localNetworkGatewayName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewayContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, localNetworkGatewayName, parameters, cancellationToken); var operation = new LocalNetworkGatewayCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, localNetworkGatewayName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual LocalNetworkGatewayCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string localNetworkGatewayName, LocalNetworkGatewayData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(localNetworkGatewayName, nameof(localNetworkGatewayName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _localNetworkGatewayClientDiagnostics.CreateScope("LocalNetworkGatewayCollection.CreateOrUpdate"); scope.Start(); try { var response = _localNetworkGatewayRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, localNetworkGatewayName, parameters, cancellationToken); var operation = new LocalNetworkGatewayCreateOrUpdateOperation(ArmClient, _localNetworkGatewayClientDiagnostics, Pipeline, _localNetworkGatewayRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, localNetworkGatewayName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }