public virtual AfdEndpointCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string endpointName, AfdEndpointData endpointInput, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); if (endpointInput == null) { throw new ArgumentNullException(nameof(endpointInput)); } using var scope = _afdEndpointClientDiagnostics.CreateScope("AfdEndpointCollection.CreateOrUpdate"); scope.Start(); try { var response = _afdEndpointRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, endpointInput, cancellationToken); var operation = new AfdEndpointCreateOrUpdateOperation(ArmClient, _afdEndpointClientDiagnostics, Pipeline, _afdEndpointRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, endpointInput).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }