// 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/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabricmanagedclusters/armservicefabricmanagedclusters"
	"net/http"
	"net/url"
	"regexp"
)

// NodeTypesServer is a fake server for instances of the armservicefabricmanagedclusters.NodeTypesClient type.
type NodeTypesServer struct {
	// BeginCreateOrUpdate is the fake for method NodeTypesClient.BeginCreateOrUpdate
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeType, options *armservicefabricmanagedclusters.NodeTypesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)

	// BeginDeallocate is the fake for method NodeTypesClient.BeginDeallocate
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginDeallocate func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginDeallocateOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeallocateResponse], errResp azfake.ErrorResponder)

	// BeginDelete is the fake for method NodeTypesClient.BeginDelete
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, options *armservicefabricmanagedclusters.NodeTypesClientBeginDeleteOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteResponse], errResp azfake.ErrorResponder)

	// BeginDeleteNode is the fake for method NodeTypesClient.BeginDeleteNode
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginDeleteNode func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginDeleteNodeOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteNodeResponse], errResp azfake.ErrorResponder)

	// Get is the fake for method NodeTypesClient.Get
	// HTTP status codes to indicate success: http.StatusOK
	Get func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, options *armservicefabricmanagedclusters.NodeTypesClientGetOptions) (resp azfake.Responder[armservicefabricmanagedclusters.NodeTypesClientGetResponse], errResp azfake.ErrorResponder)

	// GetFaultSimulation is the fake for method NodeTypesClient.GetFaultSimulation
	// HTTP status codes to indicate success: http.StatusOK
	GetFaultSimulation func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.FaultSimulationIDContent, options *armservicefabricmanagedclusters.NodeTypesClientGetFaultSimulationOptions) (resp azfake.Responder[armservicefabricmanagedclusters.NodeTypesClientGetFaultSimulationResponse], errResp azfake.ErrorResponder)

	// NewListByManagedClustersPager is the fake for method NodeTypesClient.NewListByManagedClustersPager
	// HTTP status codes to indicate success: http.StatusOK
	NewListByManagedClustersPager func(resourceGroupName string, clusterName string, options *armservicefabricmanagedclusters.NodeTypesClientListByManagedClustersOptions) (resp azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListByManagedClustersResponse])

	// NewListFaultSimulationPager is the fake for method NodeTypesClient.NewListFaultSimulationPager
	// HTTP status codes to indicate success: http.StatusOK
	NewListFaultSimulationPager func(resourceGroupName string, clusterName string, nodeTypeName string, options *armservicefabricmanagedclusters.NodeTypesClientListFaultSimulationOptions) (resp azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListFaultSimulationResponse])

	// BeginRedeploy is the fake for method NodeTypesClient.BeginRedeploy
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginRedeploy func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginRedeployOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRedeployResponse], errResp azfake.ErrorResponder)

	// BeginReimage is the fake for method NodeTypesClient.BeginReimage
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginReimage func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginReimageOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientReimageResponse], errResp azfake.ErrorResponder)

	// BeginRestart is the fake for method NodeTypesClient.BeginRestart
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginRestart func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginRestartOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRestartResponse], errResp azfake.ErrorResponder)

	// BeginStart is the fake for method NodeTypesClient.BeginStart
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginStart func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeActionParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginStartOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartResponse], errResp azfake.ErrorResponder)

	// BeginStartFaultSimulation is the fake for method NodeTypesClient.BeginStartFaultSimulation
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginStartFaultSimulation func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.FaultSimulationContentWrapper, options *armservicefabricmanagedclusters.NodeTypesClientBeginStartFaultSimulationOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartFaultSimulationResponse], errResp azfake.ErrorResponder)

	// BeginStopFaultSimulation is the fake for method NodeTypesClient.BeginStopFaultSimulation
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginStopFaultSimulation func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.FaultSimulationIDContent, options *armservicefabricmanagedclusters.NodeTypesClientBeginStopFaultSimulationOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStopFaultSimulationResponse], errResp azfake.ErrorResponder)

	// BeginUpdate is the fake for method NodeTypesClient.BeginUpdate
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginUpdate func(ctx context.Context, resourceGroupName string, clusterName string, nodeTypeName string, parameters armservicefabricmanagedclusters.NodeTypeUpdateParameters, options *armservicefabricmanagedclusters.NodeTypesClientBeginUpdateOptions) (resp azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientUpdateResponse], errResp azfake.ErrorResponder)
}

// NewNodeTypesServerTransport creates a new instance of NodeTypesServerTransport with the provided implementation.
// The returned NodeTypesServerTransport instance is connected to an instance of armservicefabricmanagedclusters.NodeTypesClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewNodeTypesServerTransport(srv *NodeTypesServer) *NodeTypesServerTransport {
	return &NodeTypesServerTransport{
		srv:                           srv,
		beginCreateOrUpdate:           newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientCreateOrUpdateResponse]](),
		beginDeallocate:               newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeallocateResponse]](),
		beginDelete:                   newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteResponse]](),
		beginDeleteNode:               newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteNodeResponse]](),
		newListByManagedClustersPager: newTracker[azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListByManagedClustersResponse]](),
		newListFaultSimulationPager:   newTracker[azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListFaultSimulationResponse]](),
		beginRedeploy:                 newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRedeployResponse]](),
		beginReimage:                  newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientReimageResponse]](),
		beginRestart:                  newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRestartResponse]](),
		beginStart:                    newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartResponse]](),
		beginStartFaultSimulation:     newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartFaultSimulationResponse]](),
		beginStopFaultSimulation:      newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStopFaultSimulationResponse]](),
		beginUpdate:                   newTracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientUpdateResponse]](),
	}
}

// NodeTypesServerTransport connects instances of armservicefabricmanagedclusters.NodeTypesClient to instances of NodeTypesServer.
// Don't use this type directly, use NewNodeTypesServerTransport instead.
type NodeTypesServerTransport struct {
	srv                           *NodeTypesServer
	beginCreateOrUpdate           *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientCreateOrUpdateResponse]]
	beginDeallocate               *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeallocateResponse]]
	beginDelete                   *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteResponse]]
	beginDeleteNode               *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientDeleteNodeResponse]]
	newListByManagedClustersPager *tracker[azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListByManagedClustersResponse]]
	newListFaultSimulationPager   *tracker[azfake.PagerResponder[armservicefabricmanagedclusters.NodeTypesClientListFaultSimulationResponse]]
	beginRedeploy                 *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRedeployResponse]]
	beginReimage                  *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientReimageResponse]]
	beginRestart                  *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientRestartResponse]]
	beginStart                    *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartResponse]]
	beginStartFaultSimulation     *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStartFaultSimulationResponse]]
	beginStopFaultSimulation      *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientStopFaultSimulationResponse]]
	beginUpdate                   *tracker[azfake.PollerResponder[armservicefabricmanagedclusters.NodeTypesClientUpdateResponse]]
}

// Do implements the policy.Transporter interface for NodeTypesServerTransport.
func (n *NodeTypesServerTransport) 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 n.dispatchToMethodFake(req, method)
}

func (n *NodeTypesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
	resultChan := make(chan result)
	defer close(resultChan)

	go func() {
		var intercepted bool
		var res result
		if nodeTypesServerTransportInterceptor != nil {
			res.resp, res.err, intercepted = nodeTypesServerTransportInterceptor.Do(req)
		}
		if !intercepted {
			switch method {
			case "NodeTypesClient.BeginCreateOrUpdate":
				res.resp, res.err = n.dispatchBeginCreateOrUpdate(req)
			case "NodeTypesClient.BeginDeallocate":
				res.resp, res.err = n.dispatchBeginDeallocate(req)
			case "NodeTypesClient.BeginDelete":
				res.resp, res.err = n.dispatchBeginDelete(req)
			case "NodeTypesClient.BeginDeleteNode":
				res.resp, res.err = n.dispatchBeginDeleteNode(req)
			case "NodeTypesClient.Get":
				res.resp, res.err = n.dispatchGet(req)
			case "NodeTypesClient.GetFaultSimulation":
				res.resp, res.err = n.dispatchGetFaultSimulation(req)
			case "NodeTypesClient.NewListByManagedClustersPager":
				res.resp, res.err = n.dispatchNewListByManagedClustersPager(req)
			case "NodeTypesClient.NewListFaultSimulationPager":
				res.resp, res.err = n.dispatchNewListFaultSimulationPager(req)
			case "NodeTypesClient.BeginRedeploy":
				res.resp, res.err = n.dispatchBeginRedeploy(req)
			case "NodeTypesClient.BeginReimage":
				res.resp, res.err = n.dispatchBeginReimage(req)
			case "NodeTypesClient.BeginRestart":
				res.resp, res.err = n.dispatchBeginRestart(req)
			case "NodeTypesClient.BeginStart":
				res.resp, res.err = n.dispatchBeginStart(req)
			case "NodeTypesClient.BeginStartFaultSimulation":
				res.resp, res.err = n.dispatchBeginStartFaultSimulation(req)
			case "NodeTypesClient.BeginStopFaultSimulation":
				res.resp, res.err = n.dispatchBeginStopFaultSimulation(req)
			case "NodeTypesClient.BeginUpdate":
				res.resp, res.err = n.dispatchBeginUpdate(req)
			default:
				res.err = fmt.Errorf("unhandled API %s", method)
			}

		}
		select {
		case resultChan <- res:
		case <-req.Context().Done():
		}
	}()

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

func (n *NodeTypesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
	if n.srv.BeginCreateOrUpdate == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
	}
	beginCreateOrUpdate := n.beginCreateOrUpdate.get(req)
	if beginCreateOrUpdate == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeType](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginCreateOrUpdate = &respr
		n.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
	}

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

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

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginDeallocate(req *http.Request) (*http.Response, error) {
	if n.srv.BeginDeallocate == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginDeallocate not implemented")}
	}
	beginDeallocate := n.beginDeallocate.get(req)
	if beginDeallocate == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deallocate`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginDeallocate(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginDeallocate = &respr
		n.beginDeallocate.add(req, beginDeallocate)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginDeallocate.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(beginDeallocate) {
		n.beginDeallocate.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
	if n.srv.BeginDelete == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
	}
	beginDelete := n.beginDelete.get(req)
	if beginDelete == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginDelete = &respr
		n.beginDelete.add(req, beginDelete)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginDelete.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(beginDelete) {
		n.beginDelete.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginDeleteNode(req *http.Request) (*http.Response, error) {
	if n.srv.BeginDeleteNode == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginDeleteNode not implemented")}
	}
	beginDeleteNode := n.beginDeleteNode.get(req)
	if beginDeleteNode == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteNode`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginDeleteNode(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginDeleteNode = &respr
		n.beginDeleteNode.add(req, beginDeleteNode)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginDeleteNode.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(beginDeleteNode) {
		n.beginDeleteNode.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
	if n.srv.Get == nil {
		return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if len(matches) < 5 {
		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
	}
	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
	if err != nil {
		return nil, err
	}
	clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
	if err != nil {
		return nil, err
	}
	nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, nil)
	if respErr := server.GetError(errRespr, req); respErr != nil {
		return nil, respErr
	}
	respContent := server.GetResponseContent(respr)
	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
	}
	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NodeType, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchGetFaultSimulation(req *http.Request) (*http.Response, error) {
	if n.srv.GetFaultSimulation == nil {
		return nil, &nonRetriableError{errors.New("fake for method GetFaultSimulation not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFaultSimulation`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if len(matches) < 5 {
		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
	}
	body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.FaultSimulationIDContent](req)
	if err != nil {
		return nil, err
	}
	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
	if err != nil {
		return nil, err
	}
	clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
	if err != nil {
		return nil, err
	}
	nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := n.srv.GetFaultSimulation(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
	if respErr := server.GetError(errRespr, req); respErr != nil {
		return nil, respErr
	}
	respContent := server.GetResponseContent(respr)
	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
	}
	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FaultSimulation, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchNewListByManagedClustersPager(req *http.Request) (*http.Response, error) {
	if n.srv.NewListByManagedClustersPager == nil {
		return nil, &nonRetriableError{errors.New("fake for method NewListByManagedClustersPager not implemented")}
	}
	newListByManagedClustersPager := n.newListByManagedClustersPager.get(req)
	if newListByManagedClustersPager == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 4 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		resp := n.srv.NewListByManagedClustersPager(resourceGroupNameParam, clusterNameParam, nil)
		newListByManagedClustersPager = &resp
		n.newListByManagedClustersPager.add(req, newListByManagedClustersPager)
		server.PagerResponderInjectNextLinks(newListByManagedClustersPager, req, func(page *armservicefabricmanagedclusters.NodeTypesClientListByManagedClustersResponse, createLink func() string) {
			page.NextLink = to.Ptr(createLink())
		})
	}
	resp, err := server.PagerResponderNext(newListByManagedClustersPager, req)
	if err != nil {
		return nil, err
	}
	if !contains([]int{http.StatusOK}, resp.StatusCode) {
		n.newListByManagedClustersPager.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
	}
	if !server.PagerResponderMore(newListByManagedClustersPager) {
		n.newListByManagedClustersPager.remove(req)
	}
	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchNewListFaultSimulationPager(req *http.Request) (*http.Response, error) {
	if n.srv.NewListFaultSimulationPager == nil {
		return nil, &nonRetriableError{errors.New("fake for method NewListFaultSimulationPager not implemented")}
	}
	newListFaultSimulationPager := n.newListFaultSimulationPager.get(req)
	if newListFaultSimulationPager == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listFaultSimulation`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		resp := n.srv.NewListFaultSimulationPager(resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, nil)
		newListFaultSimulationPager = &resp
		n.newListFaultSimulationPager.add(req, newListFaultSimulationPager)
		server.PagerResponderInjectNextLinks(newListFaultSimulationPager, req, func(page *armservicefabricmanagedclusters.NodeTypesClientListFaultSimulationResponse, createLink func() string) {
			page.NextLink = to.Ptr(createLink())
		})
	}
	resp, err := server.PagerResponderNext(newListFaultSimulationPager, req)
	if err != nil {
		return nil, err
	}
	if !contains([]int{http.StatusOK}, resp.StatusCode) {
		n.newListFaultSimulationPager.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
	}
	if !server.PagerResponderMore(newListFaultSimulationPager) {
		n.newListFaultSimulationPager.remove(req)
	}
	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginRedeploy(req *http.Request) (*http.Response, error) {
	if n.srv.BeginRedeploy == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginRedeploy not implemented")}
	}
	beginRedeploy := n.beginRedeploy.get(req)
	if beginRedeploy == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/redeploy`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginRedeploy(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginRedeploy = &respr
		n.beginRedeploy.add(req, beginRedeploy)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginRedeploy.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(beginRedeploy) {
		n.beginRedeploy.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginReimage(req *http.Request) (*http.Response, error) {
	if n.srv.BeginReimage == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginReimage not implemented")}
	}
	beginReimage := n.beginReimage.get(req)
	if beginReimage == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reimage`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginReimage(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginReimage = &respr
		n.beginReimage.add(req, beginReimage)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginReimage.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(beginReimage) {
		n.beginReimage.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) {
	if n.srv.BeginRestart == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")}
	}
	beginRestart := n.beginRestart.get(req)
	if beginRestart == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginRestart(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginRestart = &respr
		n.beginRestart.add(req, beginRestart)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginRestart.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(beginRestart) {
		n.beginRestart.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) {
	if n.srv.BeginStart == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")}
	}
	beginStart := n.beginStart.get(req)
	if beginStart == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeActionParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginStart(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginStart = &respr
		n.beginStart.add(req, beginStart)
	}

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

	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
		n.beginStart.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(beginStart) {
		n.beginStart.remove(req)
	}

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginStartFaultSimulation(req *http.Request) (*http.Response, error) {
	if n.srv.BeginStartFaultSimulation == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginStartFaultSimulation not implemented")}
	}
	beginStartFaultSimulation := n.beginStartFaultSimulation.get(req)
	if beginStartFaultSimulation == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/startFaultSimulation`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.FaultSimulationContentWrapper](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginStartFaultSimulation(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginStartFaultSimulation = &respr
		n.beginStartFaultSimulation.add(req, beginStartFaultSimulation)
	}

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

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

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginStopFaultSimulation(req *http.Request) (*http.Response, error) {
	if n.srv.BeginStopFaultSimulation == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginStopFaultSimulation not implemented")}
	}
	beginStopFaultSimulation := n.beginStopFaultSimulation.get(req)
	if beginStopFaultSimulation == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stopFaultSimulation`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.FaultSimulationIDContent](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginStopFaultSimulation(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginStopFaultSimulation = &respr
		n.beginStopFaultSimulation.add(req, beginStopFaultSimulation)
	}

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

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

	return resp, nil
}

func (n *NodeTypesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) {
	if n.srv.BeginUpdate == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")}
	}
	beginUpdate := n.beginUpdate.get(req)
	if beginUpdate == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceFabric/managedClusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodeTypes/(?P<nodeTypeName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if len(matches) < 5 {
			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
		}
		body, err := server.UnmarshalRequestAsJSON[armservicefabricmanagedclusters.NodeTypeUpdateParameters](req)
		if err != nil {
			return nil, err
		}
		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
		if err != nil {
			return nil, err
		}
		clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")])
		if err != nil {
			return nil, err
		}
		nodeTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodeTypeName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, nodeTypeNameParam, body, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginUpdate = &respr
		n.beginUpdate.add(req, beginUpdate)
	}

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

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

	return resp, nil
}

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