public virtual ArmOperation Delete(WaitUntil waitUntil, bool?force = null, CancellationToken cancellationToken = default) { using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetworkResource.Delete"); scope.Start(); try { var response = _virtualNetworkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force, cancellationToken); var operation = new ConnectedVMwarevSphereArmOperation(_virtualNetworkClientDiagnostics, Pipeline, _virtualNetworkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualNetworkDeleteOperation Delete(bool waitForCompletion, bool?force = null, CancellationToken cancellationToken = default) { using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetwork.Delete"); scope.Start(); try { var response = _virtualNetworkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force, cancellationToken); var operation = new VirtualNetworkDeleteOperation(_virtualNetworkClientDiagnostics, Pipeline, _virtualNetworkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force).Request, response); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }