public virtual InstanceFailoverGroupFailoverOperation Failover(bool waitForCompletion = true, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("InstanceFailoverGroup.Failover");
     scope.Start();
     try
     {
         var response  = _instanceFailoverGroupsRestClient.Failover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         var operation = new InstanceFailoverGroupFailoverOperation(_clientDiagnostics, Pipeline, _instanceFailoverGroupsRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response);
         if (waitForCompletion)
         {
             operation.WaitForCompletion(cancellationToken);
         }
         return(operation);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public async virtual Task <InstanceFailoverGroupFailoverOperation> FailoverAsync(bool waitForCompletion, CancellationToken cancellationToken = default)
        {
            using var scope = _instanceFailoverGroupClientDiagnostics.CreateScope("InstanceFailoverGroup.Failover");
            scope.Start();
            try
            {
                var response = await _instanceFailoverGroupRestClient.FailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);

                var operation = new InstanceFailoverGroupFailoverOperation(_instanceFailoverGroupClientDiagnostics, Pipeline, _instanceFailoverGroupRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }