// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package fake

import (
	"context"
	"errors"
	"fmt"
	azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resiliencemanagement/armresiliencemanagement"
	"net/http"
	"net/url"
	"reflect"
	"regexp"
	"slices"
)

// RecoveryPlanActionsServer is a fake server for instances of the armresiliencemanagement.RecoveryPlanActionsClient type.
type RecoveryPlanActionsServer struct {
	// BeginCheckReadiness is the fake for method RecoveryPlanActionsClient.BeginCheckReadiness
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginCheckReadiness func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginCheckReadinessOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientCheckReadinessResponse], errResp azfake.ErrorResponder)

	// BeginFailover is the fake for method RecoveryPlanActionsClient.BeginFailover
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginFailover func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.FailoverRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginFailoverOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverResponse], errResp azfake.ErrorResponder)

	// BeginFailoverCommit is the fake for method RecoveryPlanActionsClient.BeginFailoverCommit
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginFailoverCommit func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginFailoverCommitOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverCommitResponse], errResp azfake.ErrorResponder)

	// BeginFinalize is the fake for method RecoveryPlanActionsClient.BeginFinalize
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginFinalize func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginFinalizeOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFinalizeResponse], errResp azfake.ErrorResponder)

	// BeginReprotect is the fake for method RecoveryPlanActionsClient.BeginReprotect
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginReprotect func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginReprotectOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientReprotectResponse], errResp azfake.ErrorResponder)

	// BeginTestFailover is the fake for method RecoveryPlanActionsClient.BeginTestFailover
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginTestFailover func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.FailoverRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginTestFailoverOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverResponse], errResp azfake.ErrorResponder)

	// BeginTestFailoverCleanup is the fake for method RecoveryPlanActionsClient.BeginTestFailoverCleanup
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginTestFailoverCleanup func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.TestFailoverCleanupRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginTestFailoverCleanupOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverCleanupResponse], errResp azfake.ErrorResponder)

	// BeginUpdateResources is the fake for method RecoveryPlanActionsClient.BeginUpdateResources
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginUpdateResources func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.UpdateRecoveryResourcesRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginUpdateResourcesOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientUpdateResourcesResponse], errResp azfake.ErrorResponder)

	// BeginValidateForFailover is the fake for method RecoveryPlanActionsClient.BeginValidateForFailover
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForFailover func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.FailoverRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForFailoverOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverResponse], errResp azfake.ErrorResponder)

	// BeginValidateForFailoverCommit is the fake for method RecoveryPlanActionsClient.BeginValidateForFailoverCommit
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForFailoverCommit func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForFailoverCommitOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverCommitResponse], errResp azfake.ErrorResponder)

	// BeginValidateForOperation is the fake for method RecoveryPlanActionsClient.BeginValidateForOperation
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForOperation func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.ValidateForOperationRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForOperationOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForOperationResponse], errResp azfake.ErrorResponder)

	// BeginValidateForReprotect is the fake for method RecoveryPlanActionsClient.BeginValidateForReprotect
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForReprotect func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForReprotectOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForReprotectResponse], errResp azfake.ErrorResponder)

	// BeginValidateForTestFailover is the fake for method RecoveryPlanActionsClient.BeginValidateForTestFailover
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForTestFailover func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, body armresiliencemanagement.FailoverRequest, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForTestFailoverOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverResponse], errResp azfake.ErrorResponder)

	// BeginValidateForTestFailoverCleanup is the fake for method RecoveryPlanActionsClient.BeginValidateForTestFailoverCleanup
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginValidateForTestFailoverCleanup func(ctx context.Context, serviceGroupName string, operationID string, recoveryPlanName string, options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForTestFailoverCleanupOptions) (resp azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverCleanupResponse], errResp azfake.ErrorResponder)
}

// NewRecoveryPlanActionsServerTransport creates a new instance of RecoveryPlanActionsServerTransport with the provided implementation.
// The returned RecoveryPlanActionsServerTransport instance is connected to an instance of armresiliencemanagement.RecoveryPlanActionsClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewRecoveryPlanActionsServerTransport(srv *RecoveryPlanActionsServer) *RecoveryPlanActionsServerTransport {
	return &RecoveryPlanActionsServerTransport{
		srv:                                 srv,
		beginCheckReadiness:                 newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientCheckReadinessResponse]](),
		beginFailover:                       newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverResponse]](),
		beginFailoverCommit:                 newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverCommitResponse]](),
		beginFinalize:                       newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFinalizeResponse]](),
		beginReprotect:                      newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientReprotectResponse]](),
		beginTestFailover:                   newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverResponse]](),
		beginTestFailoverCleanup:            newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverCleanupResponse]](),
		beginUpdateResources:                newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientUpdateResourcesResponse]](),
		beginValidateForFailover:            newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverResponse]](),
		beginValidateForFailoverCommit:      newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverCommitResponse]](),
		beginValidateForOperation:           newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForOperationResponse]](),
		beginValidateForReprotect:           newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForReprotectResponse]](),
		beginValidateForTestFailover:        newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverResponse]](),
		beginValidateForTestFailoverCleanup: newTracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverCleanupResponse]](),
	}
}

// RecoveryPlanActionsServerTransport connects instances of armresiliencemanagement.RecoveryPlanActionsClient to instances of RecoveryPlanActionsServer.
// Don't use this type directly, use NewRecoveryPlanActionsServerTransport instead.
type RecoveryPlanActionsServerTransport struct {
	srv                                 *RecoveryPlanActionsServer
	beginCheckReadiness                 *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientCheckReadinessResponse]]
	beginFailover                       *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverResponse]]
	beginFailoverCommit                 *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFailoverCommitResponse]]
	beginFinalize                       *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientFinalizeResponse]]
	beginReprotect                      *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientReprotectResponse]]
	beginTestFailover                   *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverResponse]]
	beginTestFailoverCleanup            *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientTestFailoverCleanupResponse]]
	beginUpdateResources                *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientUpdateResourcesResponse]]
	beginValidateForFailover            *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverResponse]]
	beginValidateForFailoverCommit      *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForFailoverCommitResponse]]
	beginValidateForOperation           *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForOperationResponse]]
	beginValidateForReprotect           *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForReprotectResponse]]
	beginValidateForTestFailover        *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverResponse]]
	beginValidateForTestFailoverCleanup *tracker[azfake.PollerResponder[armresiliencemanagement.RecoveryPlanActionsClientValidateForTestFailoverCleanupResponse]]
}

// Do implements the policy.Transporter interface for RecoveryPlanActionsServerTransport.
func (r *RecoveryPlanActionsServerTransport) Do(req *http.Request) (*http.Response, error) {
	rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
	method, ok := rawMethod.(string)
	if !ok {
		return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
	}

	return r.dispatchToMethodFake(req, method)
}

func (r *RecoveryPlanActionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
	resultChan := make(chan result, 1)
	go func() {
		var intercepted bool
		var res result
		if recoveryPlanActionsServerTransportInterceptor != nil {
			res.resp, res.err, intercepted = recoveryPlanActionsServerTransportInterceptor.Do(req)
		}
		if !intercepted {
			switch method {
			case "RecoveryPlanActionsClient.BeginCheckReadiness":
				res.resp, res.err = r.dispatchBeginCheckReadiness(req)
			case "RecoveryPlanActionsClient.BeginFailover":
				res.resp, res.err = r.dispatchBeginFailover(req)
			case "RecoveryPlanActionsClient.BeginFailoverCommit":
				res.resp, res.err = r.dispatchBeginFailoverCommit(req)
			case "RecoveryPlanActionsClient.BeginFinalize":
				res.resp, res.err = r.dispatchBeginFinalize(req)
			case "RecoveryPlanActionsClient.BeginReprotect":
				res.resp, res.err = r.dispatchBeginReprotect(req)
			case "RecoveryPlanActionsClient.BeginTestFailover":
				res.resp, res.err = r.dispatchBeginTestFailover(req)
			case "RecoveryPlanActionsClient.BeginTestFailoverCleanup":
				res.resp, res.err = r.dispatchBeginTestFailoverCleanup(req)
			case "RecoveryPlanActionsClient.BeginUpdateResources":
				res.resp, res.err = r.dispatchBeginUpdateResources(req)
			case "RecoveryPlanActionsClient.BeginValidateForFailover":
				res.resp, res.err = r.dispatchBeginValidateForFailover(req)
			case "RecoveryPlanActionsClient.BeginValidateForFailoverCommit":
				res.resp, res.err = r.dispatchBeginValidateForFailoverCommit(req)
			case "RecoveryPlanActionsClient.BeginValidateForOperation":
				res.resp, res.err = r.dispatchBeginValidateForOperation(req)
			case "RecoveryPlanActionsClient.BeginValidateForReprotect":
				res.resp, res.err = r.dispatchBeginValidateForReprotect(req)
			case "RecoveryPlanActionsClient.BeginValidateForTestFailover":
				res.resp, res.err = r.dispatchBeginValidateForTestFailover(req)
			case "RecoveryPlanActionsClient.BeginValidateForTestFailoverCleanup":
				res.resp, res.err = r.dispatchBeginValidateForTestFailoverCleanup(req)
			default:
				res.err = fmt.Errorf("unhandled API %s", method)
			}

		}
		resultChan <- res
	}()

	select {
	case <-req.Context().Done():
		return nil, req.Context().Err()
	case res := <-resultChan:
		return res.resp, res.err
	}
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginCheckReadiness(req *http.Request) (*http.Response, error) {
	if r.srv.BeginCheckReadiness == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginCheckReadiness not implemented")}
	}
	beginCheckReadiness := r.beginCheckReadiness.get(req)
	if beginCheckReadiness == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkReadiness`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginCheckReadiness(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginCheckReadiness = &respr
		r.beginCheckReadiness.add(req, beginCheckReadiness)
	}

	resp, err := server.PollerResponderNext(beginCheckReadiness, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		r.beginCheckReadiness.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginCheckReadiness) {
		r.beginCheckReadiness.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginFailover(req *http.Request) (*http.Response, error) {
	if r.srv.BeginFailover == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginFailover not implemented")}
	}
	beginFailover := r.beginFailover.get(req)
	if beginFailover == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failover`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.FailoverRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginFailover(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginFailover = &respr
		r.beginFailover.add(req, beginFailover)
	}

	resp, err := server.PollerResponderNext(beginFailover, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginFailover.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginFailover) {
		r.beginFailover.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginFailoverCommit(req *http.Request) (*http.Response, error) {
	if r.srv.BeginFailoverCommit == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginFailoverCommit not implemented")}
	}
	beginFailoverCommit := r.beginFailoverCommit.get(req)
	if beginFailoverCommit == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failoverCommit`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginFailoverCommit(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginFailoverCommit = &respr
		r.beginFailoverCommit.add(req, beginFailoverCommit)
	}

	resp, err := server.PollerResponderNext(beginFailoverCommit, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginFailoverCommit.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginFailoverCommit) {
		r.beginFailoverCommit.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginFinalize(req *http.Request) (*http.Response, error) {
	if r.srv.BeginFinalize == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginFinalize not implemented")}
	}
	beginFinalize := r.beginFinalize.get(req)
	if beginFinalize == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/finalize`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginFinalize(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginFinalize = &respr
		r.beginFinalize.add(req, beginFinalize)
	}

	resp, err := server.PollerResponderNext(beginFinalize, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginFinalize.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginFinalize) {
		r.beginFinalize.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginReprotect(req *http.Request) (*http.Response, error) {
	if r.srv.BeginReprotect == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginReprotect not implemented")}
	}
	beginReprotect := r.beginReprotect.get(req)
	if beginReprotect == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reprotect`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.ReprotectRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		var options *armresiliencemanagement.RecoveryPlanActionsClientBeginReprotectOptions
		if !reflect.ValueOf(body).IsZero() {
			options = &armresiliencemanagement.RecoveryPlanActionsClientBeginReprotectOptions{
				Body: &body,
			}
		}
		respr, errRespr := r.srv.BeginReprotect(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, options)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginReprotect = &respr
		r.beginReprotect.add(req, beginReprotect)
	}

	resp, err := server.PollerResponderNext(beginReprotect, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginReprotect.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginReprotect) {
		r.beginReprotect.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginTestFailover(req *http.Request) (*http.Response, error) {
	if r.srv.BeginTestFailover == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginTestFailover not implemented")}
	}
	beginTestFailover := r.beginTestFailover.get(req)
	if beginTestFailover == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/testFailover`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.FailoverRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginTestFailover(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginTestFailover = &respr
		r.beginTestFailover.add(req, beginTestFailover)
	}

	resp, err := server.PollerResponderNext(beginTestFailover, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginTestFailover.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginTestFailover) {
		r.beginTestFailover.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginTestFailoverCleanup(req *http.Request) (*http.Response, error) {
	if r.srv.BeginTestFailoverCleanup == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginTestFailoverCleanup not implemented")}
	}
	beginTestFailoverCleanup := r.beginTestFailoverCleanup.get(req)
	if beginTestFailoverCleanup == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/testFailoverCleanup`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.TestFailoverCleanupRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginTestFailoverCleanup(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginTestFailoverCleanup = &respr
		r.beginTestFailoverCleanup.add(req, beginTestFailoverCleanup)
	}

	resp, err := server.PollerResponderNext(beginTestFailoverCleanup, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginTestFailoverCleanup.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginTestFailoverCleanup) {
		r.beginTestFailoverCleanup.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginUpdateResources(req *http.Request) (*http.Response, error) {
	if r.srv.BeginUpdateResources == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginUpdateResources not implemented")}
	}
	beginUpdateResources := r.beginUpdateResources.get(req)
	if beginUpdateResources == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateResources`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.UpdateRecoveryResourcesRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginUpdateResources(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginUpdateResources = &respr
		r.beginUpdateResources.add(req, beginUpdateResources)
	}

	resp, err := server.PollerResponderNext(beginUpdateResources, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginUpdateResources.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginUpdateResources) {
		r.beginUpdateResources.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForFailover(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForFailover == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForFailover not implemented")}
	}
	beginValidateForFailover := r.beginValidateForFailover.get(req)
	if beginValidateForFailover == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForFailover`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.FailoverRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginValidateForFailover(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForFailover = &respr
		r.beginValidateForFailover.add(req, beginValidateForFailover)
	}

	resp, err := server.PollerResponderNext(beginValidateForFailover, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForFailover.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForFailover) {
		r.beginValidateForFailover.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForFailoverCommit(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForFailoverCommit == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForFailoverCommit not implemented")}
	}
	beginValidateForFailoverCommit := r.beginValidateForFailoverCommit.get(req)
	if beginValidateForFailoverCommit == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForFailoverCommit`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginValidateForFailoverCommit(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForFailoverCommit = &respr
		r.beginValidateForFailoverCommit.add(req, beginValidateForFailoverCommit)
	}

	resp, err := server.PollerResponderNext(beginValidateForFailoverCommit, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForFailoverCommit.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForFailoverCommit) {
		r.beginValidateForFailoverCommit.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForOperation(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForOperation == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForOperation not implemented")}
	}
	beginValidateForOperation := r.beginValidateForOperation.get(req)
	if beginValidateForOperation == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForOperation`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.ValidateForOperationRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginValidateForOperation(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForOperation = &respr
		r.beginValidateForOperation.add(req, beginValidateForOperation)
	}

	resp, err := server.PollerResponderNext(beginValidateForOperation, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForOperation.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForOperation) {
		r.beginValidateForOperation.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForReprotect(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForReprotect == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForReprotect not implemented")}
	}
	beginValidateForReprotect := r.beginValidateForReprotect.get(req)
	if beginValidateForReprotect == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForReprotect`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.ReprotectRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		var options *armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForReprotectOptions
		if !reflect.ValueOf(body).IsZero() {
			options = &armresiliencemanagement.RecoveryPlanActionsClientBeginValidateForReprotectOptions{
				Body: &body,
			}
		}
		respr, errRespr := r.srv.BeginValidateForReprotect(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, options)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForReprotect = &respr
		r.beginValidateForReprotect.add(req, beginValidateForReprotect)
	}

	resp, err := server.PollerResponderNext(beginValidateForReprotect, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForReprotect.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForReprotect) {
		r.beginValidateForReprotect.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForTestFailover(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForTestFailover == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForTestFailover not implemented")}
	}
	beginValidateForTestFailover := r.beginValidateForTestFailover.get(req)
	if beginValidateForTestFailover == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForTestFailover`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armresiliencemanagement.FailoverRequest](req)
		if err != nil {
			return nil, err
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginValidateForTestFailover(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForTestFailover = &respr
		r.beginValidateForTestFailover.add(req, beginValidateForTestFailover)
	}

	resp, err := server.PollerResponderNext(beginValidateForTestFailover, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForTestFailover.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForTestFailover) {
		r.beginValidateForTestFailover.remove(req)
	}

	return resp, nil
}

func (r *RecoveryPlanActionsServerTransport) dispatchBeginValidateForTestFailoverCleanup(req *http.Request) (*http.Response, error) {
	if r.srv.BeginValidateForTestFailoverCleanup == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginValidateForTestFailoverCleanup not implemented")}
	}
	beginValidateForTestFailoverCleanup := r.beginValidateForTestFailoverCleanup.get(req)
	if beginValidateForTestFailoverCleanup == nil {
		const regexStr = `/providers/Microsoft\.Management/serviceGroups/(?P<serviceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureResilienceManagement/recoveryPlans/(?P<recoveryPlanName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateForTestFailoverCleanup`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 3 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		serviceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceGroupName")])
		if err != nil {
			return nil, err
		}
		recoveryPlanNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPlanName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := r.srv.BeginValidateForTestFailoverCleanup(req.Context(), serviceGroupNameParam, getHeaderValue(req.Header, "operation-id"), recoveryPlanNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginValidateForTestFailoverCleanup = &respr
		r.beginValidateForTestFailoverCleanup.add(req, beginValidateForTestFailoverCleanup)
	}

	resp, err := server.PollerResponderNext(beginValidateForTestFailoverCleanup, req)
	if err != nil {
		return nil, err
	}

	if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
		r.beginValidateForTestFailoverCleanup.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
	}
	if !server.PollerResponderMore(beginValidateForTestFailoverCleanup) {
		r.beginValidateForTestFailoverCleanup.remove(req)
	}

	return resp, nil
}

// set this to conditionally intercept incoming requests to RecoveryPlanActionsServerTransport
var recoveryPlanActionsServerTransportInterceptor interface {
	// Do returns true if the server transport should use the returned response/error
	Do(*http.Request) (*http.Response, error, bool)
}
