github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/expressroutecircuits_server.go (about)

     1  //go:build go1.18
     2  // +build go1.18
     3  
     4  // Copyright (c) Microsoft Corporation. All rights reserved.
     5  // Licensed under the MIT License. See License.txt in the project root for license information.
     6  // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  package fake
    10  
    11  import (
    12  	"context"
    13  	"errors"
    14  	"fmt"
    15  	azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
    16  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
    17  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
    18  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
    19  	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
    20  	"net/http"
    21  	"net/url"
    22  	"regexp"
    23  )
    24  
    25  // ExpressRouteCircuitsServer is a fake server for instances of the armnetwork.ExpressRouteCircuitsClient type.
    26  type ExpressRouteCircuitsServer struct {
    27  	// BeginCreateOrUpdate is the fake for method ExpressRouteCircuitsClient.BeginCreateOrUpdate
    28  	// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
    29  	BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, circuitName string, parameters armnetwork.ExpressRouteCircuit, options *armnetwork.ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
    30  
    31  	// BeginDelete is the fake for method ExpressRouteCircuitsClient.BeginDelete
    32  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
    33  	BeginDelete func(ctx context.Context, resourceGroupName string, circuitName string, options *armnetwork.ExpressRouteCircuitsClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientDeleteResponse], errResp azfake.ErrorResponder)
    34  
    35  	// Get is the fake for method ExpressRouteCircuitsClient.Get
    36  	// HTTP status codes to indicate success: http.StatusOK
    37  	Get func(ctx context.Context, resourceGroupName string, circuitName string, options *armnetwork.ExpressRouteCircuitsClientGetOptions) (resp azfake.Responder[armnetwork.ExpressRouteCircuitsClientGetResponse], errResp azfake.ErrorResponder)
    38  
    39  	// GetPeeringStats is the fake for method ExpressRouteCircuitsClient.GetPeeringStats
    40  	// HTTP status codes to indicate success: http.StatusOK
    41  	GetPeeringStats func(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *armnetwork.ExpressRouteCircuitsClientGetPeeringStatsOptions) (resp azfake.Responder[armnetwork.ExpressRouteCircuitsClientGetPeeringStatsResponse], errResp azfake.ErrorResponder)
    42  
    43  	// GetStats is the fake for method ExpressRouteCircuitsClient.GetStats
    44  	// HTTP status codes to indicate success: http.StatusOK
    45  	GetStats func(ctx context.Context, resourceGroupName string, circuitName string, options *armnetwork.ExpressRouteCircuitsClientGetStatsOptions) (resp azfake.Responder[armnetwork.ExpressRouteCircuitsClientGetStatsResponse], errResp azfake.ErrorResponder)
    46  
    47  	// NewListPager is the fake for method ExpressRouteCircuitsClient.NewListPager
    48  	// HTTP status codes to indicate success: http.StatusOK
    49  	NewListPager func(resourceGroupName string, options *armnetwork.ExpressRouteCircuitsClientListOptions) (resp azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListResponse])
    50  
    51  	// NewListAllPager is the fake for method ExpressRouteCircuitsClient.NewListAllPager
    52  	// HTTP status codes to indicate success: http.StatusOK
    53  	NewListAllPager func(options *armnetwork.ExpressRouteCircuitsClientListAllOptions) (resp azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListAllResponse])
    54  
    55  	// BeginListArpTable is the fake for method ExpressRouteCircuitsClient.BeginListArpTable
    56  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    57  	BeginListArpTable func(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *armnetwork.ExpressRouteCircuitsClientBeginListArpTableOptions) (resp azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListArpTableResponse], errResp azfake.ErrorResponder)
    58  
    59  	// BeginListRoutesTable is the fake for method ExpressRouteCircuitsClient.BeginListRoutesTable
    60  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    61  	BeginListRoutesTable func(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *armnetwork.ExpressRouteCircuitsClientBeginListRoutesTableOptions) (resp azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableResponse], errResp azfake.ErrorResponder)
    62  
    63  	// BeginListRoutesTableSummary is the fake for method ExpressRouteCircuitsClient.BeginListRoutesTableSummary
    64  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    65  	BeginListRoutesTableSummary func(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *armnetwork.ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (resp azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableSummaryResponse], errResp azfake.ErrorResponder)
    66  
    67  	// UpdateTags is the fake for method ExpressRouteCircuitsClient.UpdateTags
    68  	// HTTP status codes to indicate success: http.StatusOK
    69  	UpdateTags func(ctx context.Context, resourceGroupName string, circuitName string, parameters armnetwork.TagsObject, options *armnetwork.ExpressRouteCircuitsClientUpdateTagsOptions) (resp azfake.Responder[armnetwork.ExpressRouteCircuitsClientUpdateTagsResponse], errResp azfake.ErrorResponder)
    70  }
    71  
    72  // NewExpressRouteCircuitsServerTransport creates a new instance of ExpressRouteCircuitsServerTransport with the provided implementation.
    73  // The returned ExpressRouteCircuitsServerTransport instance is connected to an instance of armnetwork.ExpressRouteCircuitsClient via the
    74  // azcore.ClientOptions.Transporter field in the client's constructor parameters.
    75  func NewExpressRouteCircuitsServerTransport(srv *ExpressRouteCircuitsServer) *ExpressRouteCircuitsServerTransport {
    76  	return &ExpressRouteCircuitsServerTransport{
    77  		srv:                         srv,
    78  		beginCreateOrUpdate:         newTracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientCreateOrUpdateResponse]](),
    79  		beginDelete:                 newTracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientDeleteResponse]](),
    80  		newListPager:                newTracker[azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListResponse]](),
    81  		newListAllPager:             newTracker[azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListAllResponse]](),
    82  		beginListArpTable:           newTracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListArpTableResponse]](),
    83  		beginListRoutesTable:        newTracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableResponse]](),
    84  		beginListRoutesTableSummary: newTracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableSummaryResponse]](),
    85  	}
    86  }
    87  
    88  // ExpressRouteCircuitsServerTransport connects instances of armnetwork.ExpressRouteCircuitsClient to instances of ExpressRouteCircuitsServer.
    89  // Don't use this type directly, use NewExpressRouteCircuitsServerTransport instead.
    90  type ExpressRouteCircuitsServerTransport struct {
    91  	srv                         *ExpressRouteCircuitsServer
    92  	beginCreateOrUpdate         *tracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientCreateOrUpdateResponse]]
    93  	beginDelete                 *tracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientDeleteResponse]]
    94  	newListPager                *tracker[azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListResponse]]
    95  	newListAllPager             *tracker[azfake.PagerResponder[armnetwork.ExpressRouteCircuitsClientListAllResponse]]
    96  	beginListArpTable           *tracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListArpTableResponse]]
    97  	beginListRoutesTable        *tracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableResponse]]
    98  	beginListRoutesTableSummary *tracker[azfake.PollerResponder[armnetwork.ExpressRouteCircuitsClientListRoutesTableSummaryResponse]]
    99  }
   100  
   101  // Do implements the policy.Transporter interface for ExpressRouteCircuitsServerTransport.
   102  func (e *ExpressRouteCircuitsServerTransport) Do(req *http.Request) (*http.Response, error) {
   103  	rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
   104  	method, ok := rawMethod.(string)
   105  	if !ok {
   106  		return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
   107  	}
   108  
   109  	var resp *http.Response
   110  	var err error
   111  
   112  	switch method {
   113  	case "ExpressRouteCircuitsClient.BeginCreateOrUpdate":
   114  		resp, err = e.dispatchBeginCreateOrUpdate(req)
   115  	case "ExpressRouteCircuitsClient.BeginDelete":
   116  		resp, err = e.dispatchBeginDelete(req)
   117  	case "ExpressRouteCircuitsClient.Get":
   118  		resp, err = e.dispatchGet(req)
   119  	case "ExpressRouteCircuitsClient.GetPeeringStats":
   120  		resp, err = e.dispatchGetPeeringStats(req)
   121  	case "ExpressRouteCircuitsClient.GetStats":
   122  		resp, err = e.dispatchGetStats(req)
   123  	case "ExpressRouteCircuitsClient.NewListPager":
   124  		resp, err = e.dispatchNewListPager(req)
   125  	case "ExpressRouteCircuitsClient.NewListAllPager":
   126  		resp, err = e.dispatchNewListAllPager(req)
   127  	case "ExpressRouteCircuitsClient.BeginListArpTable":
   128  		resp, err = e.dispatchBeginListArpTable(req)
   129  	case "ExpressRouteCircuitsClient.BeginListRoutesTable":
   130  		resp, err = e.dispatchBeginListRoutesTable(req)
   131  	case "ExpressRouteCircuitsClient.BeginListRoutesTableSummary":
   132  		resp, err = e.dispatchBeginListRoutesTableSummary(req)
   133  	case "ExpressRouteCircuitsClient.UpdateTags":
   134  		resp, err = e.dispatchUpdateTags(req)
   135  	default:
   136  		err = fmt.Errorf("unhandled API %s", method)
   137  	}
   138  
   139  	if err != nil {
   140  		return nil, err
   141  	}
   142  
   143  	return resp, nil
   144  }
   145  
   146  func (e *ExpressRouteCircuitsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
   147  	if e.srv.BeginCreateOrUpdate == nil {
   148  		return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
   149  	}
   150  	beginCreateOrUpdate := e.beginCreateOrUpdate.get(req)
   151  	if beginCreateOrUpdate == nil {
   152  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   153  		regex := regexp.MustCompile(regexStr)
   154  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   155  		if matches == nil || len(matches) < 3 {
   156  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   157  		}
   158  		body, err := server.UnmarshalRequestAsJSON[armnetwork.ExpressRouteCircuit](req)
   159  		if err != nil {
   160  			return nil, err
   161  		}
   162  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   163  		if err != nil {
   164  			return nil, err
   165  		}
   166  		circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   167  		if err != nil {
   168  			return nil, err
   169  		}
   170  		respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, circuitNameParam, body, nil)
   171  		if respErr := server.GetError(errRespr, req); respErr != nil {
   172  			return nil, respErr
   173  		}
   174  		beginCreateOrUpdate = &respr
   175  		e.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
   176  	}
   177  
   178  	resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
   179  	if err != nil {
   180  		return nil, err
   181  	}
   182  
   183  	if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
   184  		e.beginCreateOrUpdate.remove(req)
   185  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
   186  	}
   187  	if !server.PollerResponderMore(beginCreateOrUpdate) {
   188  		e.beginCreateOrUpdate.remove(req)
   189  	}
   190  
   191  	return resp, nil
   192  }
   193  
   194  func (e *ExpressRouteCircuitsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
   195  	if e.srv.BeginDelete == nil {
   196  		return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
   197  	}
   198  	beginDelete := e.beginDelete.get(req)
   199  	if beginDelete == nil {
   200  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   201  		regex := regexp.MustCompile(regexStr)
   202  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   203  		if matches == nil || len(matches) < 3 {
   204  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   205  		}
   206  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   207  		if err != nil {
   208  			return nil, err
   209  		}
   210  		circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   211  		if err != nil {
   212  			return nil, err
   213  		}
   214  		respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, circuitNameParam, nil)
   215  		if respErr := server.GetError(errRespr, req); respErr != nil {
   216  			return nil, respErr
   217  		}
   218  		beginDelete = &respr
   219  		e.beginDelete.add(req, beginDelete)
   220  	}
   221  
   222  	resp, err := server.PollerResponderNext(beginDelete, req)
   223  	if err != nil {
   224  		return nil, err
   225  	}
   226  
   227  	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
   228  		e.beginDelete.remove(req)
   229  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
   230  	}
   231  	if !server.PollerResponderMore(beginDelete) {
   232  		e.beginDelete.remove(req)
   233  	}
   234  
   235  	return resp, nil
   236  }
   237  
   238  func (e *ExpressRouteCircuitsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
   239  	if e.srv.Get == nil {
   240  		return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
   241  	}
   242  	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   243  	regex := regexp.MustCompile(regexStr)
   244  	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   245  	if matches == nil || len(matches) < 3 {
   246  		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   247  	}
   248  	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   249  	if err != nil {
   250  		return nil, err
   251  	}
   252  	circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   253  	if err != nil {
   254  		return nil, err
   255  	}
   256  	respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, circuitNameParam, nil)
   257  	if respErr := server.GetError(errRespr, req); respErr != nil {
   258  		return nil, respErr
   259  	}
   260  	respContent := server.GetResponseContent(respr)
   261  	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
   262  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
   263  	}
   264  	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExpressRouteCircuit, req)
   265  	if err != nil {
   266  		return nil, err
   267  	}
   268  	return resp, nil
   269  }
   270  
   271  func (e *ExpressRouteCircuitsServerTransport) dispatchGetPeeringStats(req *http.Request) (*http.Response, error) {
   272  	if e.srv.GetPeeringStats == nil {
   273  		return nil, &nonRetriableError{errors.New("fake for method GetPeeringStats not implemented")}
   274  	}
   275  	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/peerings/(?P<peeringName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stats`
   276  	regex := regexp.MustCompile(regexStr)
   277  	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   278  	if matches == nil || len(matches) < 4 {
   279  		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   280  	}
   281  	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   282  	if err != nil {
   283  		return nil, err
   284  	}
   285  	circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   286  	if err != nil {
   287  		return nil, err
   288  	}
   289  	peeringNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peeringName")])
   290  	if err != nil {
   291  		return nil, err
   292  	}
   293  	respr, errRespr := e.srv.GetPeeringStats(req.Context(), resourceGroupNameParam, circuitNameParam, peeringNameParam, nil)
   294  	if respErr := server.GetError(errRespr, req); respErr != nil {
   295  		return nil, respErr
   296  	}
   297  	respContent := server.GetResponseContent(respr)
   298  	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
   299  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
   300  	}
   301  	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExpressRouteCircuitStats, req)
   302  	if err != nil {
   303  		return nil, err
   304  	}
   305  	return resp, nil
   306  }
   307  
   308  func (e *ExpressRouteCircuitsServerTransport) dispatchGetStats(req *http.Request) (*http.Response, error) {
   309  	if e.srv.GetStats == nil {
   310  		return nil, &nonRetriableError{errors.New("fake for method GetStats not implemented")}
   311  	}
   312  	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stats`
   313  	regex := regexp.MustCompile(regexStr)
   314  	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   315  	if matches == nil || len(matches) < 3 {
   316  		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   317  	}
   318  	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   319  	if err != nil {
   320  		return nil, err
   321  	}
   322  	circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   323  	if err != nil {
   324  		return nil, err
   325  	}
   326  	respr, errRespr := e.srv.GetStats(req.Context(), resourceGroupNameParam, circuitNameParam, nil)
   327  	if respErr := server.GetError(errRespr, req); respErr != nil {
   328  		return nil, respErr
   329  	}
   330  	respContent := server.GetResponseContent(respr)
   331  	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
   332  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
   333  	}
   334  	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExpressRouteCircuitStats, req)
   335  	if err != nil {
   336  		return nil, err
   337  	}
   338  	return resp, nil
   339  }
   340  
   341  func (e *ExpressRouteCircuitsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
   342  	if e.srv.NewListPager == nil {
   343  		return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
   344  	}
   345  	newListPager := e.newListPager.get(req)
   346  	if newListPager == nil {
   347  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits`
   348  		regex := regexp.MustCompile(regexStr)
   349  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   350  		if matches == nil || len(matches) < 2 {
   351  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   352  		}
   353  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   354  		if err != nil {
   355  			return nil, err
   356  		}
   357  		resp := e.srv.NewListPager(resourceGroupNameParam, nil)
   358  		newListPager = &resp
   359  		e.newListPager.add(req, newListPager)
   360  		server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetwork.ExpressRouteCircuitsClientListResponse, createLink func() string) {
   361  			page.NextLink = to.Ptr(createLink())
   362  		})
   363  	}
   364  	resp, err := server.PagerResponderNext(newListPager, req)
   365  	if err != nil {
   366  		return nil, err
   367  	}
   368  	if !contains([]int{http.StatusOK}, resp.StatusCode) {
   369  		e.newListPager.remove(req)
   370  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
   371  	}
   372  	if !server.PagerResponderMore(newListPager) {
   373  		e.newListPager.remove(req)
   374  	}
   375  	return resp, nil
   376  }
   377  
   378  func (e *ExpressRouteCircuitsServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) {
   379  	if e.srv.NewListAllPager == nil {
   380  		return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")}
   381  	}
   382  	newListAllPager := e.newListAllPager.get(req)
   383  	if newListAllPager == nil {
   384  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits`
   385  		regex := regexp.MustCompile(regexStr)
   386  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   387  		if matches == nil || len(matches) < 1 {
   388  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   389  		}
   390  		resp := e.srv.NewListAllPager(nil)
   391  		newListAllPager = &resp
   392  		e.newListAllPager.add(req, newListAllPager)
   393  		server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armnetwork.ExpressRouteCircuitsClientListAllResponse, createLink func() string) {
   394  			page.NextLink = to.Ptr(createLink())
   395  		})
   396  	}
   397  	resp, err := server.PagerResponderNext(newListAllPager, req)
   398  	if err != nil {
   399  		return nil, err
   400  	}
   401  	if !contains([]int{http.StatusOK}, resp.StatusCode) {
   402  		e.newListAllPager.remove(req)
   403  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
   404  	}
   405  	if !server.PagerResponderMore(newListAllPager) {
   406  		e.newListAllPager.remove(req)
   407  	}
   408  	return resp, nil
   409  }
   410  
   411  func (e *ExpressRouteCircuitsServerTransport) dispatchBeginListArpTable(req *http.Request) (*http.Response, error) {
   412  	if e.srv.BeginListArpTable == nil {
   413  		return nil, &nonRetriableError{errors.New("fake for method BeginListArpTable not implemented")}
   414  	}
   415  	beginListArpTable := e.beginListArpTable.get(req)
   416  	if beginListArpTable == nil {
   417  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/peerings/(?P<peeringName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arpTables/(?P<devicePath>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   418  		regex := regexp.MustCompile(regexStr)
   419  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   420  		if matches == nil || len(matches) < 5 {
   421  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   422  		}
   423  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   424  		if err != nil {
   425  			return nil, err
   426  		}
   427  		circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   428  		if err != nil {
   429  			return nil, err
   430  		}
   431  		peeringNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peeringName")])
   432  		if err != nil {
   433  			return nil, err
   434  		}
   435  		devicePathParam, err := url.PathUnescape(matches[regex.SubexpIndex("devicePath")])
   436  		if err != nil {
   437  			return nil, err
   438  		}
   439  		respr, errRespr := e.srv.BeginListArpTable(req.Context(), resourceGroupNameParam, circuitNameParam, peeringNameParam, devicePathParam, nil)
   440  		if respErr := server.GetError(errRespr, req); respErr != nil {
   441  			return nil, respErr
   442  		}
   443  		beginListArpTable = &respr
   444  		e.beginListArpTable.add(req, beginListArpTable)
   445  	}
   446  
   447  	resp, err := server.PollerResponderNext(beginListArpTable, req)
   448  	if err != nil {
   449  		return nil, err
   450  	}
   451  
   452  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   453  		e.beginListArpTable.remove(req)
   454  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   455  	}
   456  	if !server.PollerResponderMore(beginListArpTable) {
   457  		e.beginListArpTable.remove(req)
   458  	}
   459  
   460  	return resp, nil
   461  }
   462  
   463  func (e *ExpressRouteCircuitsServerTransport) dispatchBeginListRoutesTable(req *http.Request) (*http.Response, error) {
   464  	if e.srv.BeginListRoutesTable == nil {
   465  		return nil, &nonRetriableError{errors.New("fake for method BeginListRoutesTable not implemented")}
   466  	}
   467  	beginListRoutesTable := e.beginListRoutesTable.get(req)
   468  	if beginListRoutesTable == nil {
   469  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/peerings/(?P<peeringName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/routeTables/(?P<devicePath>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   470  		regex := regexp.MustCompile(regexStr)
   471  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   472  		if matches == nil || len(matches) < 5 {
   473  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   474  		}
   475  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   476  		if err != nil {
   477  			return nil, err
   478  		}
   479  		circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   480  		if err != nil {
   481  			return nil, err
   482  		}
   483  		peeringNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peeringName")])
   484  		if err != nil {
   485  			return nil, err
   486  		}
   487  		devicePathParam, err := url.PathUnescape(matches[regex.SubexpIndex("devicePath")])
   488  		if err != nil {
   489  			return nil, err
   490  		}
   491  		respr, errRespr := e.srv.BeginListRoutesTable(req.Context(), resourceGroupNameParam, circuitNameParam, peeringNameParam, devicePathParam, nil)
   492  		if respErr := server.GetError(errRespr, req); respErr != nil {
   493  			return nil, respErr
   494  		}
   495  		beginListRoutesTable = &respr
   496  		e.beginListRoutesTable.add(req, beginListRoutesTable)
   497  	}
   498  
   499  	resp, err := server.PollerResponderNext(beginListRoutesTable, req)
   500  	if err != nil {
   501  		return nil, err
   502  	}
   503  
   504  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   505  		e.beginListRoutesTable.remove(req)
   506  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   507  	}
   508  	if !server.PollerResponderMore(beginListRoutesTable) {
   509  		e.beginListRoutesTable.remove(req)
   510  	}
   511  
   512  	return resp, nil
   513  }
   514  
   515  func (e *ExpressRouteCircuitsServerTransport) dispatchBeginListRoutesTableSummary(req *http.Request) (*http.Response, error) {
   516  	if e.srv.BeginListRoutesTableSummary == nil {
   517  		return nil, &nonRetriableError{errors.New("fake for method BeginListRoutesTableSummary not implemented")}
   518  	}
   519  	beginListRoutesTableSummary := e.beginListRoutesTableSummary.get(req)
   520  	if beginListRoutesTableSummary == nil {
   521  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/peerings/(?P<peeringName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/routeTablesSummary/(?P<devicePath>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   522  		regex := regexp.MustCompile(regexStr)
   523  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   524  		if matches == nil || len(matches) < 5 {
   525  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   526  		}
   527  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   528  		if err != nil {
   529  			return nil, err
   530  		}
   531  		circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   532  		if err != nil {
   533  			return nil, err
   534  		}
   535  		peeringNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peeringName")])
   536  		if err != nil {
   537  			return nil, err
   538  		}
   539  		devicePathParam, err := url.PathUnescape(matches[regex.SubexpIndex("devicePath")])
   540  		if err != nil {
   541  			return nil, err
   542  		}
   543  		respr, errRespr := e.srv.BeginListRoutesTableSummary(req.Context(), resourceGroupNameParam, circuitNameParam, peeringNameParam, devicePathParam, nil)
   544  		if respErr := server.GetError(errRespr, req); respErr != nil {
   545  			return nil, respErr
   546  		}
   547  		beginListRoutesTableSummary = &respr
   548  		e.beginListRoutesTableSummary.add(req, beginListRoutesTableSummary)
   549  	}
   550  
   551  	resp, err := server.PollerResponderNext(beginListRoutesTableSummary, req)
   552  	if err != nil {
   553  		return nil, err
   554  	}
   555  
   556  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   557  		e.beginListRoutesTableSummary.remove(req)
   558  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   559  	}
   560  	if !server.PollerResponderMore(beginListRoutesTableSummary) {
   561  		e.beginListRoutesTableSummary.remove(req)
   562  	}
   563  
   564  	return resp, nil
   565  }
   566  
   567  func (e *ExpressRouteCircuitsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) {
   568  	if e.srv.UpdateTags == nil {
   569  		return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")}
   570  	}
   571  	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteCircuits/(?P<circuitName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   572  	regex := regexp.MustCompile(regexStr)
   573  	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   574  	if matches == nil || len(matches) < 3 {
   575  		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   576  	}
   577  	body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req)
   578  	if err != nil {
   579  		return nil, err
   580  	}
   581  	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   582  	if err != nil {
   583  		return nil, err
   584  	}
   585  	circuitNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("circuitName")])
   586  	if err != nil {
   587  		return nil, err
   588  	}
   589  	respr, errRespr := e.srv.UpdateTags(req.Context(), resourceGroupNameParam, circuitNameParam, body, nil)
   590  	if respErr := server.GetError(errRespr, req); respErr != nil {
   591  		return nil, respErr
   592  	}
   593  	respContent := server.GetResponseContent(respr)
   594  	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
   595  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
   596  	}
   597  	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExpressRouteCircuit, req)
   598  	if err != nil {
   599  		return nil, err
   600  	}
   601  	return resp, nil
   602  }