github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/p2svpngateways_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  // P2SVPNGatewaysServer is a fake server for instances of the armnetwork.P2SVPNGatewaysClient type.
    26  type P2SVPNGatewaysServer struct {
    27  	// BeginCreateOrUpdate is the fake for method P2SVPNGatewaysClient.BeginCreateOrUpdate
    28  	// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
    29  	BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters armnetwork.P2SVPNGateway, options *armnetwork.P2SVPNGatewaysClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
    30  
    31  	// BeginDelete is the fake for method P2SVPNGatewaysClient.BeginDelete
    32  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
    33  	BeginDelete func(ctx context.Context, resourceGroupName string, gatewayName string, options *armnetwork.P2SVPNGatewaysClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDeleteResponse], errResp azfake.ErrorResponder)
    34  
    35  	// BeginDisconnectP2SVPNConnections is the fake for method P2SVPNGatewaysClient.BeginDisconnectP2SVPNConnections
    36  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    37  	BeginDisconnectP2SVPNConnections func(ctx context.Context, resourceGroupName string, p2SVPNGatewayName string, request armnetwork.P2SVPNConnectionRequest, options *armnetwork.P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse], errResp azfake.ErrorResponder)
    38  
    39  	// BeginGenerateVPNProfile is the fake for method P2SVPNGatewaysClient.BeginGenerateVPNProfile
    40  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    41  	BeginGenerateVPNProfile func(ctx context.Context, resourceGroupName string, gatewayName string, parameters armnetwork.P2SVPNProfileParameters, options *armnetwork.P2SVPNGatewaysClientBeginGenerateVPNProfileOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGenerateVPNProfileResponse], errResp azfake.ErrorResponder)
    42  
    43  	// Get is the fake for method P2SVPNGatewaysClient.Get
    44  	// HTTP status codes to indicate success: http.StatusOK
    45  	Get func(ctx context.Context, resourceGroupName string, gatewayName string, options *armnetwork.P2SVPNGatewaysClientGetOptions) (resp azfake.Responder[armnetwork.P2SVPNGatewaysClientGetResponse], errResp azfake.ErrorResponder)
    46  
    47  	// BeginGetP2SVPNConnectionHealth is the fake for method P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealth
    48  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    49  	BeginGetP2SVPNConnectionHealth func(ctx context.Context, resourceGroupName string, gatewayName string, options *armnetwork.P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse], errResp azfake.ErrorResponder)
    50  
    51  	// BeginGetP2SVPNConnectionHealthDetailed is the fake for method P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealthDetailed
    52  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    53  	BeginGetP2SVPNConnectionHealthDetailed func(ctx context.Context, resourceGroupName string, gatewayName string, request armnetwork.P2SVPNConnectionHealthRequest, options *armnetwork.P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse], errResp azfake.ErrorResponder)
    54  
    55  	// NewListPager is the fake for method P2SVPNGatewaysClient.NewListPager
    56  	// HTTP status codes to indicate success: http.StatusOK
    57  	NewListPager func(options *armnetwork.P2SVPNGatewaysClientListOptions) (resp azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListResponse])
    58  
    59  	// NewListByResourceGroupPager is the fake for method P2SVPNGatewaysClient.NewListByResourceGroupPager
    60  	// HTTP status codes to indicate success: http.StatusOK
    61  	NewListByResourceGroupPager func(resourceGroupName string, options *armnetwork.P2SVPNGatewaysClientListByResourceGroupOptions) (resp azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListByResourceGroupResponse])
    62  
    63  	// BeginReset is the fake for method P2SVPNGatewaysClient.BeginReset
    64  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    65  	BeginReset func(ctx context.Context, resourceGroupName string, gatewayName string, options *armnetwork.P2SVPNGatewaysClientBeginResetOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientResetResponse], errResp azfake.ErrorResponder)
    66  
    67  	// BeginUpdateTags is the fake for method P2SVPNGatewaysClient.BeginUpdateTags
    68  	// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
    69  	BeginUpdateTags func(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters armnetwork.TagsObject, options *armnetwork.P2SVPNGatewaysClientBeginUpdateTagsOptions) (resp azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientUpdateTagsResponse], errResp azfake.ErrorResponder)
    70  }
    71  
    72  // NewP2SVPNGatewaysServerTransport creates a new instance of P2SVPNGatewaysServerTransport with the provided implementation.
    73  // The returned P2SVPNGatewaysServerTransport instance is connected to an instance of armnetwork.P2SVPNGatewaysClient via the
    74  // azcore.ClientOptions.Transporter field in the client's constructor parameters.
    75  func NewP2SVPNGatewaysServerTransport(srv *P2SVPNGatewaysServer) *P2SVPNGatewaysServerTransport {
    76  	return &P2SVPNGatewaysServerTransport{
    77  		srv:                                    srv,
    78  		beginCreateOrUpdate:                    newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientCreateOrUpdateResponse]](),
    79  		beginDelete:                            newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDeleteResponse]](),
    80  		beginDisconnectP2SVPNConnections:       newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse]](),
    81  		beginGenerateVPNProfile:                newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGenerateVPNProfileResponse]](),
    82  		beginGetP2SVPNConnectionHealth:         newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse]](),
    83  		beginGetP2SVPNConnectionHealthDetailed: newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse]](),
    84  		newListPager:                           newTracker[azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListResponse]](),
    85  		newListByResourceGroupPager:            newTracker[azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListByResourceGroupResponse]](),
    86  		beginReset:                             newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientResetResponse]](),
    87  		beginUpdateTags:                        newTracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientUpdateTagsResponse]](),
    88  	}
    89  }
    90  
    91  // P2SVPNGatewaysServerTransport connects instances of armnetwork.P2SVPNGatewaysClient to instances of P2SVPNGatewaysServer.
    92  // Don't use this type directly, use NewP2SVPNGatewaysServerTransport instead.
    93  type P2SVPNGatewaysServerTransport struct {
    94  	srv                                    *P2SVPNGatewaysServer
    95  	beginCreateOrUpdate                    *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientCreateOrUpdateResponse]]
    96  	beginDelete                            *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDeleteResponse]]
    97  	beginDisconnectP2SVPNConnections       *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse]]
    98  	beginGenerateVPNProfile                *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGenerateVPNProfileResponse]]
    99  	beginGetP2SVPNConnectionHealth         *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse]]
   100  	beginGetP2SVPNConnectionHealthDetailed *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse]]
   101  	newListPager                           *tracker[azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListResponse]]
   102  	newListByResourceGroupPager            *tracker[azfake.PagerResponder[armnetwork.P2SVPNGatewaysClientListByResourceGroupResponse]]
   103  	beginReset                             *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientResetResponse]]
   104  	beginUpdateTags                        *tracker[azfake.PollerResponder[armnetwork.P2SVPNGatewaysClientUpdateTagsResponse]]
   105  }
   106  
   107  // Do implements the policy.Transporter interface for P2SVPNGatewaysServerTransport.
   108  func (p *P2SVPNGatewaysServerTransport) Do(req *http.Request) (*http.Response, error) {
   109  	rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
   110  	method, ok := rawMethod.(string)
   111  	if !ok {
   112  		return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
   113  	}
   114  
   115  	var resp *http.Response
   116  	var err error
   117  
   118  	switch method {
   119  	case "P2SVPNGatewaysClient.BeginCreateOrUpdate":
   120  		resp, err = p.dispatchBeginCreateOrUpdate(req)
   121  	case "P2SVPNGatewaysClient.BeginDelete":
   122  		resp, err = p.dispatchBeginDelete(req)
   123  	case "P2SVPNGatewaysClient.BeginDisconnectP2SVPNConnections":
   124  		resp, err = p.dispatchBeginDisconnectP2SVPNConnections(req)
   125  	case "P2SVPNGatewaysClient.BeginGenerateVPNProfile":
   126  		resp, err = p.dispatchBeginGenerateVPNProfile(req)
   127  	case "P2SVPNGatewaysClient.Get":
   128  		resp, err = p.dispatchGet(req)
   129  	case "P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealth":
   130  		resp, err = p.dispatchBeginGetP2SVPNConnectionHealth(req)
   131  	case "P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealthDetailed":
   132  		resp, err = p.dispatchBeginGetP2SVPNConnectionHealthDetailed(req)
   133  	case "P2SVPNGatewaysClient.NewListPager":
   134  		resp, err = p.dispatchNewListPager(req)
   135  	case "P2SVPNGatewaysClient.NewListByResourceGroupPager":
   136  		resp, err = p.dispatchNewListByResourceGroupPager(req)
   137  	case "P2SVPNGatewaysClient.BeginReset":
   138  		resp, err = p.dispatchBeginReset(req)
   139  	case "P2SVPNGatewaysClient.BeginUpdateTags":
   140  		resp, err = p.dispatchBeginUpdateTags(req)
   141  	default:
   142  		err = fmt.Errorf("unhandled API %s", method)
   143  	}
   144  
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  
   149  	return resp, nil
   150  }
   151  
   152  func (p *P2SVPNGatewaysServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
   153  	if p.srv.BeginCreateOrUpdate == nil {
   154  		return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
   155  	}
   156  	beginCreateOrUpdate := p.beginCreateOrUpdate.get(req)
   157  	if beginCreateOrUpdate == nil {
   158  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   159  		regex := regexp.MustCompile(regexStr)
   160  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   161  		if matches == nil || len(matches) < 3 {
   162  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   163  		}
   164  		body, err := server.UnmarshalRequestAsJSON[armnetwork.P2SVPNGateway](req)
   165  		if err != nil {
   166  			return nil, err
   167  		}
   168  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   169  		if err != nil {
   170  			return nil, err
   171  		}
   172  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   173  		if err != nil {
   174  			return nil, err
   175  		}
   176  		respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil)
   177  		if respErr := server.GetError(errRespr, req); respErr != nil {
   178  			return nil, respErr
   179  		}
   180  		beginCreateOrUpdate = &respr
   181  		p.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
   182  	}
   183  
   184  	resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
   185  	if err != nil {
   186  		return nil, err
   187  	}
   188  
   189  	if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
   190  		p.beginCreateOrUpdate.remove(req)
   191  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
   192  	}
   193  	if !server.PollerResponderMore(beginCreateOrUpdate) {
   194  		p.beginCreateOrUpdate.remove(req)
   195  	}
   196  
   197  	return resp, nil
   198  }
   199  
   200  func (p *P2SVPNGatewaysServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
   201  	if p.srv.BeginDelete == nil {
   202  		return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
   203  	}
   204  	beginDelete := p.beginDelete.get(req)
   205  	if beginDelete == nil {
   206  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   207  		regex := regexp.MustCompile(regexStr)
   208  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   209  		if matches == nil || len(matches) < 3 {
   210  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   211  		}
   212  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   213  		if err != nil {
   214  			return nil, err
   215  		}
   216  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   217  		if err != nil {
   218  			return nil, err
   219  		}
   220  		respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, gatewayNameParam, nil)
   221  		if respErr := server.GetError(errRespr, req); respErr != nil {
   222  			return nil, respErr
   223  		}
   224  		beginDelete = &respr
   225  		p.beginDelete.add(req, beginDelete)
   226  	}
   227  
   228  	resp, err := server.PollerResponderNext(beginDelete, req)
   229  	if err != nil {
   230  		return nil, err
   231  	}
   232  
   233  	if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
   234  		p.beginDelete.remove(req)
   235  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
   236  	}
   237  	if !server.PollerResponderMore(beginDelete) {
   238  		p.beginDelete.remove(req)
   239  	}
   240  
   241  	return resp, nil
   242  }
   243  
   244  func (p *P2SVPNGatewaysServerTransport) dispatchBeginDisconnectP2SVPNConnections(req *http.Request) (*http.Response, error) {
   245  	if p.srv.BeginDisconnectP2SVPNConnections == nil {
   246  		return nil, &nonRetriableError{errors.New("fake for method BeginDisconnectP2SVPNConnections not implemented")}
   247  	}
   248  	beginDisconnectP2SVPNConnections := p.beginDisconnectP2SVPNConnections.get(req)
   249  	if beginDisconnectP2SVPNConnections == nil {
   250  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<p2sVpnGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/disconnectP2sVpnConnections`
   251  		regex := regexp.MustCompile(regexStr)
   252  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   253  		if matches == nil || len(matches) < 3 {
   254  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   255  		}
   256  		body, err := server.UnmarshalRequestAsJSON[armnetwork.P2SVPNConnectionRequest](req)
   257  		if err != nil {
   258  			return nil, err
   259  		}
   260  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   261  		if err != nil {
   262  			return nil, err
   263  		}
   264  		p2SVPNGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("p2sVpnGatewayName")])
   265  		if err != nil {
   266  			return nil, err
   267  		}
   268  		respr, errRespr := p.srv.BeginDisconnectP2SVPNConnections(req.Context(), resourceGroupNameParam, p2SVPNGatewayNameParam, body, nil)
   269  		if respErr := server.GetError(errRespr, req); respErr != nil {
   270  			return nil, respErr
   271  		}
   272  		beginDisconnectP2SVPNConnections = &respr
   273  		p.beginDisconnectP2SVPNConnections.add(req, beginDisconnectP2SVPNConnections)
   274  	}
   275  
   276  	resp, err := server.PollerResponderNext(beginDisconnectP2SVPNConnections, req)
   277  	if err != nil {
   278  		return nil, err
   279  	}
   280  
   281  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   282  		p.beginDisconnectP2SVPNConnections.remove(req)
   283  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   284  	}
   285  	if !server.PollerResponderMore(beginDisconnectP2SVPNConnections) {
   286  		p.beginDisconnectP2SVPNConnections.remove(req)
   287  	}
   288  
   289  	return resp, nil
   290  }
   291  
   292  func (p *P2SVPNGatewaysServerTransport) dispatchBeginGenerateVPNProfile(req *http.Request) (*http.Response, error) {
   293  	if p.srv.BeginGenerateVPNProfile == nil {
   294  		return nil, &nonRetriableError{errors.New("fake for method BeginGenerateVPNProfile not implemented")}
   295  	}
   296  	beginGenerateVPNProfile := p.beginGenerateVPNProfile.get(req)
   297  	if beginGenerateVPNProfile == nil {
   298  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generatevpnprofile`
   299  		regex := regexp.MustCompile(regexStr)
   300  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   301  		if matches == nil || len(matches) < 3 {
   302  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   303  		}
   304  		body, err := server.UnmarshalRequestAsJSON[armnetwork.P2SVPNProfileParameters](req)
   305  		if err != nil {
   306  			return nil, err
   307  		}
   308  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   309  		if err != nil {
   310  			return nil, err
   311  		}
   312  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   313  		if err != nil {
   314  			return nil, err
   315  		}
   316  		respr, errRespr := p.srv.BeginGenerateVPNProfile(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil)
   317  		if respErr := server.GetError(errRespr, req); respErr != nil {
   318  			return nil, respErr
   319  		}
   320  		beginGenerateVPNProfile = &respr
   321  		p.beginGenerateVPNProfile.add(req, beginGenerateVPNProfile)
   322  	}
   323  
   324  	resp, err := server.PollerResponderNext(beginGenerateVPNProfile, req)
   325  	if err != nil {
   326  		return nil, err
   327  	}
   328  
   329  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   330  		p.beginGenerateVPNProfile.remove(req)
   331  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   332  	}
   333  	if !server.PollerResponderMore(beginGenerateVPNProfile) {
   334  		p.beginGenerateVPNProfile.remove(req)
   335  	}
   336  
   337  	return resp, nil
   338  }
   339  
   340  func (p *P2SVPNGatewaysServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
   341  	if p.srv.Get == nil {
   342  		return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
   343  	}
   344  	const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   345  	regex := regexp.MustCompile(regexStr)
   346  	matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   347  	if matches == nil || len(matches) < 3 {
   348  		return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   349  	}
   350  	resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   351  	if err != nil {
   352  		return nil, err
   353  	}
   354  	gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   355  	if err != nil {
   356  		return nil, err
   357  	}
   358  	respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, gatewayNameParam, nil)
   359  	if respErr := server.GetError(errRespr, req); respErr != nil {
   360  		return nil, respErr
   361  	}
   362  	respContent := server.GetResponseContent(respr)
   363  	if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
   364  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
   365  	}
   366  	resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).P2SVPNGateway, req)
   367  	if err != nil {
   368  		return nil, err
   369  	}
   370  	return resp, nil
   371  }
   372  
   373  func (p *P2SVPNGatewaysServerTransport) dispatchBeginGetP2SVPNConnectionHealth(req *http.Request) (*http.Response, error) {
   374  	if p.srv.BeginGetP2SVPNConnectionHealth == nil {
   375  		return nil, &nonRetriableError{errors.New("fake for method BeginGetP2SVPNConnectionHealth not implemented")}
   376  	}
   377  	beginGetP2SVPNConnectionHealth := p.beginGetP2SVPNConnectionHealth.get(req)
   378  	if beginGetP2SVPNConnectionHealth == nil {
   379  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getP2sVpnConnectionHealth`
   380  		regex := regexp.MustCompile(regexStr)
   381  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   382  		if matches == nil || len(matches) < 3 {
   383  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   384  		}
   385  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   386  		if err != nil {
   387  			return nil, err
   388  		}
   389  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   390  		if err != nil {
   391  			return nil, err
   392  		}
   393  		respr, errRespr := p.srv.BeginGetP2SVPNConnectionHealth(req.Context(), resourceGroupNameParam, gatewayNameParam, nil)
   394  		if respErr := server.GetError(errRespr, req); respErr != nil {
   395  			return nil, respErr
   396  		}
   397  		beginGetP2SVPNConnectionHealth = &respr
   398  		p.beginGetP2SVPNConnectionHealth.add(req, beginGetP2SVPNConnectionHealth)
   399  	}
   400  
   401  	resp, err := server.PollerResponderNext(beginGetP2SVPNConnectionHealth, req)
   402  	if err != nil {
   403  		return nil, err
   404  	}
   405  
   406  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   407  		p.beginGetP2SVPNConnectionHealth.remove(req)
   408  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   409  	}
   410  	if !server.PollerResponderMore(beginGetP2SVPNConnectionHealth) {
   411  		p.beginGetP2SVPNConnectionHealth.remove(req)
   412  	}
   413  
   414  	return resp, nil
   415  }
   416  
   417  func (p *P2SVPNGatewaysServerTransport) dispatchBeginGetP2SVPNConnectionHealthDetailed(req *http.Request) (*http.Response, error) {
   418  	if p.srv.BeginGetP2SVPNConnectionHealthDetailed == nil {
   419  		return nil, &nonRetriableError{errors.New("fake for method BeginGetP2SVPNConnectionHealthDetailed not implemented")}
   420  	}
   421  	beginGetP2SVPNConnectionHealthDetailed := p.beginGetP2SVPNConnectionHealthDetailed.get(req)
   422  	if beginGetP2SVPNConnectionHealthDetailed == nil {
   423  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getP2sVpnConnectionHealthDetailed`
   424  		regex := regexp.MustCompile(regexStr)
   425  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   426  		if matches == nil || len(matches) < 3 {
   427  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   428  		}
   429  		body, err := server.UnmarshalRequestAsJSON[armnetwork.P2SVPNConnectionHealthRequest](req)
   430  		if err != nil {
   431  			return nil, err
   432  		}
   433  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   434  		if err != nil {
   435  			return nil, err
   436  		}
   437  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   438  		if err != nil {
   439  			return nil, err
   440  		}
   441  		respr, errRespr := p.srv.BeginGetP2SVPNConnectionHealthDetailed(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil)
   442  		if respErr := server.GetError(errRespr, req); respErr != nil {
   443  			return nil, respErr
   444  		}
   445  		beginGetP2SVPNConnectionHealthDetailed = &respr
   446  		p.beginGetP2SVPNConnectionHealthDetailed.add(req, beginGetP2SVPNConnectionHealthDetailed)
   447  	}
   448  
   449  	resp, err := server.PollerResponderNext(beginGetP2SVPNConnectionHealthDetailed, req)
   450  	if err != nil {
   451  		return nil, err
   452  	}
   453  
   454  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   455  		p.beginGetP2SVPNConnectionHealthDetailed.remove(req)
   456  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   457  	}
   458  	if !server.PollerResponderMore(beginGetP2SVPNConnectionHealthDetailed) {
   459  		p.beginGetP2SVPNConnectionHealthDetailed.remove(req)
   460  	}
   461  
   462  	return resp, nil
   463  }
   464  
   465  func (p *P2SVPNGatewaysServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
   466  	if p.srv.NewListPager == nil {
   467  		return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
   468  	}
   469  	newListPager := p.newListPager.get(req)
   470  	if newListPager == nil {
   471  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways`
   472  		regex := regexp.MustCompile(regexStr)
   473  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   474  		if matches == nil || len(matches) < 1 {
   475  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   476  		}
   477  		resp := p.srv.NewListPager(nil)
   478  		newListPager = &resp
   479  		p.newListPager.add(req, newListPager)
   480  		server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetwork.P2SVPNGatewaysClientListResponse, createLink func() string) {
   481  			page.NextLink = to.Ptr(createLink())
   482  		})
   483  	}
   484  	resp, err := server.PagerResponderNext(newListPager, req)
   485  	if err != nil {
   486  		return nil, err
   487  	}
   488  	if !contains([]int{http.StatusOK}, resp.StatusCode) {
   489  		p.newListPager.remove(req)
   490  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
   491  	}
   492  	if !server.PagerResponderMore(newListPager) {
   493  		p.newListPager.remove(req)
   494  	}
   495  	return resp, nil
   496  }
   497  
   498  func (p *P2SVPNGatewaysServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
   499  	if p.srv.NewListByResourceGroupPager == nil {
   500  		return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
   501  	}
   502  	newListByResourceGroupPager := p.newListByResourceGroupPager.get(req)
   503  	if newListByResourceGroupPager == nil {
   504  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways`
   505  		regex := regexp.MustCompile(regexStr)
   506  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   507  		if matches == nil || len(matches) < 2 {
   508  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   509  		}
   510  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   511  		if err != nil {
   512  			return nil, err
   513  		}
   514  		resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil)
   515  		newListByResourceGroupPager = &resp
   516  		p.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
   517  		server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armnetwork.P2SVPNGatewaysClientListByResourceGroupResponse, createLink func() string) {
   518  			page.NextLink = to.Ptr(createLink())
   519  		})
   520  	}
   521  	resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
   522  	if err != nil {
   523  		return nil, err
   524  	}
   525  	if !contains([]int{http.StatusOK}, resp.StatusCode) {
   526  		p.newListByResourceGroupPager.remove(req)
   527  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
   528  	}
   529  	if !server.PagerResponderMore(newListByResourceGroupPager) {
   530  		p.newListByResourceGroupPager.remove(req)
   531  	}
   532  	return resp, nil
   533  }
   534  
   535  func (p *P2SVPNGatewaysServerTransport) dispatchBeginReset(req *http.Request) (*http.Response, error) {
   536  	if p.srv.BeginReset == nil {
   537  		return nil, &nonRetriableError{errors.New("fake for method BeginReset not implemented")}
   538  	}
   539  	beginReset := p.beginReset.get(req)
   540  	if beginReset == nil {
   541  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reset`
   542  		regex := regexp.MustCompile(regexStr)
   543  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   544  		if matches == nil || len(matches) < 3 {
   545  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   546  		}
   547  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   548  		if err != nil {
   549  			return nil, err
   550  		}
   551  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   552  		if err != nil {
   553  			return nil, err
   554  		}
   555  		respr, errRespr := p.srv.BeginReset(req.Context(), resourceGroupNameParam, gatewayNameParam, nil)
   556  		if respErr := server.GetError(errRespr, req); respErr != nil {
   557  			return nil, respErr
   558  		}
   559  		beginReset = &respr
   560  		p.beginReset.add(req, beginReset)
   561  	}
   562  
   563  	resp, err := server.PollerResponderNext(beginReset, req)
   564  	if err != nil {
   565  		return nil, err
   566  	}
   567  
   568  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   569  		p.beginReset.remove(req)
   570  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   571  	}
   572  	if !server.PollerResponderMore(beginReset) {
   573  		p.beginReset.remove(req)
   574  	}
   575  
   576  	return resp, nil
   577  }
   578  
   579  func (p *P2SVPNGatewaysServerTransport) dispatchBeginUpdateTags(req *http.Request) (*http.Response, error) {
   580  	if p.srv.BeginUpdateTags == nil {
   581  		return nil, &nonRetriableError{errors.New("fake for method BeginUpdateTags not implemented")}
   582  	}
   583  	beginUpdateTags := p.beginUpdateTags.get(req)
   584  	if beginUpdateTags == nil {
   585  		const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/p2svpnGateways/(?P<gatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
   586  		regex := regexp.MustCompile(regexStr)
   587  		matches := regex.FindStringSubmatch(req.URL.EscapedPath())
   588  		if matches == nil || len(matches) < 3 {
   589  			return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
   590  		}
   591  		body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req)
   592  		if err != nil {
   593  			return nil, err
   594  		}
   595  		resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
   596  		if err != nil {
   597  			return nil, err
   598  		}
   599  		gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")])
   600  		if err != nil {
   601  			return nil, err
   602  		}
   603  		respr, errRespr := p.srv.BeginUpdateTags(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil)
   604  		if respErr := server.GetError(errRespr, req); respErr != nil {
   605  			return nil, respErr
   606  		}
   607  		beginUpdateTags = &respr
   608  		p.beginUpdateTags.add(req, beginUpdateTags)
   609  	}
   610  
   611  	resp, err := server.PollerResponderNext(beginUpdateTags, req)
   612  	if err != nil {
   613  		return nil, err
   614  	}
   615  
   616  	if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
   617  		p.beginUpdateTags.remove(req)
   618  		return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
   619  	}
   620  	if !server.PollerResponderMore(beginUpdateTags) {
   621  		p.beginUpdateTags.remove(req)
   622  	}
   623  
   624  	return resp, nil
   625  }