/// <summary>
        ///     Starts Azure Site Recovery test failover cleanup.
        /// </summary>
        /// <param name="recoveryPlanName">Recovery Plan Name.</param>
        /// <param name="input">Recovery Plan Test Failover cleanup input.</param>
        /// <returns>Job response</returns>
        public PSSiteRecoveryLongRunningOperation StartAzureSiteRecoveryTestFailoverCleanup(
            string recoveryPlanName,
            RecoveryPlanTestFailoverCleanupInput input)
        {
            var op = this.GetSiteRecoveryClient()
                     .ReplicationRecoveryPlans.BeginTestFailoverCleanupWithHttpMessagesAsync(
                recoveryPlanName,
                input,
                this.GetRequestHeaders(true))
                     .GetAwaiter()
                     .GetResult();

            var result = SiteRecoveryAutoMapperProfile.Mapper.Map <PSSiteRecoveryLongRunningOperation>(op);

            return(result);
        }
        /// <summary>
        ///     Starts RP Test failover cleanup.
        /// </summary>
        private void StartRpTestFailoverCleanup()
        {
            var recoveryPlanTestFailoverCleanupInputProperties =
                new RecoveryPlanTestFailoverCleanupInputProperties
            {
                Comments = this.Comment
            };

            var recoveryPlanTestFailoverCleanupInput = new RecoveryPlanTestFailoverCleanupInput
            {
                Properties = recoveryPlanTestFailoverCleanupInputProperties
            };

            var response = this.RecoveryServicesClient.StartAzureSiteRecoveryTestFailoverCleanup(
                this.RecoveryPlan.Name,
                recoveryPlanTestFailoverCleanupInput);

            var jobResponse = this.RecoveryServicesClient
                              .GetAzureSiteRecoveryJobDetails(
                PSRecoveryServicesClient
                .GetJobIdFromReponseLocation(response.Location));

            this.WriteObject(new ASRJob(jobResponse));
        }
 /// <summary>
 /// Execute test failover cleanup of the recovery plan.
 /// </summary>
 /// <remarks>
 /// The operation to cleanup test failover of a recovery plan.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='recoveryPlanName'>
 /// Recovery plan name.
 /// </param>
 /// <param name='input'>
 /// Recovery plan test failover cleanup input.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <RecoveryPlan> BeginTestFailoverCleanupAsync(this IReplicationRecoveryPlansOperations operations, string recoveryPlanName, RecoveryPlanTestFailoverCleanupInput input, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginTestFailoverCleanupWithHttpMessagesAsync(recoveryPlanName, input, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Execute test failover cleanup of the recovery plan.
 /// </summary>
 /// <remarks>
 /// The operation to cleanup test failover of a recovery plan.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='recoveryPlanName'>
 /// Recovery plan name.
 /// </param>
 /// <param name='input'>
 /// Recovery plan test failover cleanup input.
 /// </param>
 public static RecoveryPlan BeginTestFailoverCleanup(this IReplicationRecoveryPlansOperations operations, string recoveryPlanName, RecoveryPlanTestFailoverCleanupInput input)
 {
     return(operations.BeginTestFailoverCleanupAsync(recoveryPlanName, input).GetAwaiter().GetResult());
 }