//go:build go1.18
// +build go1.18

// 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) AutoRest Code Generator. DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

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/azurestackhci/armazurestackhci/v2"
	"net/http"
	"net/url"
	"regexp"
)

// ArcSettingsServer is a fake server for instances of the armazurestackhci.ArcSettingsClient type.
type ArcSettingsServer struct {
	// ConsentAndInstallDefaultExtensions is the fake for method ArcSettingsClient.ConsentAndInstallDefaultExtensions
	// HTTP status codes to indicate success: http.StatusOK
	ConsentAndInstallDefaultExtensions func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsResponse], errResp azfake.ErrorResponder)

	// Create is the fake for method ArcSettingsClient.Create
	// HTTP status codes to indicate success: http.StatusOK
	Create func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSetting, options *armazurestackhci.ArcSettingsClientCreateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientCreateResponse], errResp azfake.ErrorResponder)

	// BeginCreateIdentity is the fake for method ArcSettingsClient.BeginCreateIdentity
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginCreateIdentity func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginCreateIdentityOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse], errResp azfake.ErrorResponder)

	// BeginDelete is the fake for method ArcSettingsClient.BeginDelete
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
	BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse], errResp azfake.ErrorResponder)

	// GeneratePassword is the fake for method ArcSettingsClient.GeneratePassword
	// HTTP status codes to indicate success: http.StatusOK
	GeneratePassword func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGeneratePasswordOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGeneratePasswordResponse], errResp azfake.ErrorResponder)

	// Get is the fake for method ArcSettingsClient.Get
	// HTTP status codes to indicate success: http.StatusOK
	Get func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGetResponse], errResp azfake.ErrorResponder)

	// BeginInitializeDisableProcess is the fake for method ArcSettingsClient.BeginInitializeDisableProcess
	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
	BeginInitializeDisableProcess func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginInitializeDisableProcessOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse], errResp azfake.ErrorResponder)

	// NewListByClusterPager is the fake for method ArcSettingsClient.NewListByClusterPager
	// HTTP status codes to indicate success: http.StatusOK
	NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.ArcSettingsClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse])

	// Update is the fake for method ArcSettingsClient.Update
	// HTTP status codes to indicate success: http.StatusOK
	Update func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSettingsPatch, options *armazurestackhci.ArcSettingsClientUpdateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientUpdateResponse], errResp azfake.ErrorResponder)
}

// NewArcSettingsServerTransport creates a new instance of ArcSettingsServerTransport with the provided implementation.
// The returned ArcSettingsServerTransport instance is connected to an instance of armazurestackhci.ArcSettingsClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewArcSettingsServerTransport(srv *ArcSettingsServer) *ArcSettingsServerTransport {
	return &ArcSettingsServerTransport{
		srv:                           srv,
		beginCreateIdentity:           newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]](),
		beginDelete:                   newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]](),
		beginInitializeDisableProcess: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]](),
		newListByClusterPager:         newTracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]](),
	}
}

// ArcSettingsServerTransport connects instances of armazurestackhci.ArcSettingsClient to instances of ArcSettingsServer.
// Don't use this type directly, use NewArcSettingsServerTransport instead.
type ArcSettingsServerTransport struct {
	srv                           *ArcSettingsServer
	beginCreateIdentity           *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]]
	beginDelete                   *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]]
	beginInitializeDisableProcess *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]]
	newListByClusterPager         *tracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]]
}

// Do implements the policy.Transporter interface for ArcSettingsServerTransport.
func (a *ArcSettingsServerTransport) 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")}
	}

	var resp *http.Response
	var err error

	switch method {
	case "ArcSettingsClient.ConsentAndInstallDefaultExtensions":
		resp, err = a.dispatchConsentAndInstallDefaultExtensions(req)
	case "ArcSettingsClient.Create":
		resp, err = a.dispatchCreate(req)
	case "ArcSettingsClient.BeginCreateIdentity":
		resp, err = a.dispatchBeginCreateIdentity(req)
	case "ArcSettingsClient.BeginDelete":
		resp, err = a.dispatchBeginDelete(req)
	case "ArcSettingsClient.GeneratePassword":
		resp, err = a.dispatchGeneratePassword(req)
	case "ArcSettingsClient.Get":
		resp, err = a.dispatchGet(req)
	case "ArcSettingsClient.BeginInitializeDisableProcess":
		resp, err = a.dispatchBeginInitializeDisableProcess(req)
	case "ArcSettingsClient.NewListByClusterPager":
		resp, err = a.dispatchNewListByClusterPager(req)
	case "ArcSettingsClient.Update":
		resp, err = a.dispatchUpdate(req)
	default:
		err = fmt.Errorf("unhandled API %s", method)
	}

	if err != nil {
		return nil, err
	}

	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchConsentAndInstallDefaultExtensions(req *http.Request) (*http.Response, error) {
	if a.srv.ConsentAndInstallDefaultExtensions == nil {
		return nil, &nonRetriableError{errors.New("fake for method ConsentAndInstallDefaultExtensions not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/consentAndInstallDefaultExtensions`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if matches == nil || 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
	}
	arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := a.srv.ConsentAndInstallDefaultExtensions(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) {
	if a.srv.Create == nil {
		return nil, &nonRetriableError{errors.New("fake for method Create not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if matches == nil || len(matches) < 4 {
		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
	}
	body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ArcSetting](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
	}
	arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchBeginCreateIdentity(req *http.Request) (*http.Response, error) {
	if a.srv.BeginCreateIdentity == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginCreateIdentity not implemented")}
	}
	beginCreateIdentity := a.beginCreateIdentity.get(req)
	if beginCreateIdentity == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createArcIdentity`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if matches == nil || 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
		}
		arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := a.srv.BeginCreateIdentity(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginCreateIdentity = &respr
		a.beginCreateIdentity.add(req, beginCreateIdentity)
	}

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

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

	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
	if a.srv.BeginDelete == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
	}
	beginDelete := a.beginDelete.get(req)
	if beginDelete == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if matches == nil || 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
		}
		arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginDelete = &respr
		a.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) {
		a.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) {
		a.beginDelete.remove(req)
	}

	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchGeneratePassword(req *http.Request) (*http.Response, error) {
	if a.srv.GeneratePassword == nil {
		return nil, &nonRetriableError{errors.New("fake for method GeneratePassword not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generatePassword`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if matches == nil || 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
	}
	arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := a.srv.GeneratePassword(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).PasswordCredential, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
	if a.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\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if matches == nil || 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
	}
	arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchBeginInitializeDisableProcess(req *http.Request) (*http.Response, error) {
	if a.srv.BeginInitializeDisableProcess == nil {
		return nil, &nonRetriableError{errors.New("fake for method BeginInitializeDisableProcess not implemented")}
	}
	beginInitializeDisableProcess := a.beginInitializeDisableProcess.get(req)
	if beginInitializeDisableProcess == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/initializeDisableProcess`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if matches == nil || 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
		}
		arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
		if err != nil {
			return nil, err
		}
		respr, errRespr := a.srv.BeginInitializeDisableProcess(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil)
		if respErr := server.GetError(errRespr, req); respErr != nil {
			return nil, respErr
		}
		beginInitializeDisableProcess = &respr
		a.beginInitializeDisableProcess.add(req, beginInitializeDisableProcess)
	}

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

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

	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) {
	if a.srv.NewListByClusterPager == nil {
		return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")}
	}
	newListByClusterPager := a.newListByClusterPager.get(req)
	if newListByClusterPager == nil {
		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings`
		regex := regexp.MustCompile(regexStr)
		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
		if matches == nil || len(matches) < 3 {
			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 := a.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil)
		newListByClusterPager = &resp
		a.newListByClusterPager.add(req, newListByClusterPager)
		server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.ArcSettingsClientListByClusterResponse, createLink func() string) {
			page.NextLink = to.Ptr(createLink())
		})
	}
	resp, err := server.PagerResponderNext(newListByClusterPager, req)
	if err != nil {
		return nil, err
	}
	if !contains([]int{http.StatusOK}, resp.StatusCode) {
		a.newListByClusterPager.remove(req)
		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
	}
	if !server.PagerResponderMore(newListByClusterPager) {
		a.newListByClusterPager.remove(req)
	}
	return resp, nil
}

func (a *ArcSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) {
	if a.srv.Update == nil {
		return nil, &nonRetriableError{errors.New("fake for method Update not implemented")}
	}
	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P<clusterName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P<arcSettingName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
	regex := regexp.MustCompile(regexStr)
	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
	if matches == nil || len(matches) < 4 {
		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
	}
	body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ArcSettingsPatch](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
	}
	arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")])
	if err != nil {
		return nil, err
	}
	respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
