github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/management_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 "strconv" 24 ) 25 26 // ManagementServer is a fake server for instances of the armnetwork.ManagementClient type. 27 type ManagementServer struct { 28 // CheckDNSNameAvailability is the fake for method ManagementClient.CheckDNSNameAvailability 29 // HTTP status codes to indicate success: http.StatusOK 30 CheckDNSNameAvailability func(ctx context.Context, location string, domainNameLabel string, options *armnetwork.ManagementClientCheckDNSNameAvailabilityOptions) (resp azfake.Responder[armnetwork.ManagementClientCheckDNSNameAvailabilityResponse], errResp azfake.ErrorResponder) 31 32 // BeginDeleteBastionShareableLink is the fake for method ManagementClient.BeginDeleteBastionShareableLink 33 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 34 BeginDeleteBastionShareableLink func(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest armnetwork.BastionShareableLinkListRequest, options *armnetwork.ManagementClientBeginDeleteBastionShareableLinkOptions) (resp azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkResponse], errResp azfake.ErrorResponder) 35 36 // BeginDeleteBastionShareableLinkByToken is the fake for method ManagementClient.BeginDeleteBastionShareableLinkByToken 37 // HTTP status codes to indicate success: http.StatusAccepted 38 BeginDeleteBastionShareableLinkByToken func(ctx context.Context, resourceGroupName string, bastionHostName string, bslTokenRequest armnetwork.BastionShareableLinkTokenListRequest, options *armnetwork.ManagementClientBeginDeleteBastionShareableLinkByTokenOptions) (resp azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkByTokenResponse], errResp azfake.ErrorResponder) 39 40 // NewDisconnectActiveSessionsPager is the fake for method ManagementClient.NewDisconnectActiveSessionsPager 41 // HTTP status codes to indicate success: http.StatusOK 42 NewDisconnectActiveSessionsPager func(resourceGroupName string, bastionHostName string, sessionIDs armnetwork.SessionIDs, options *armnetwork.ManagementClientDisconnectActiveSessionsOptions) (resp azfake.PagerResponder[armnetwork.ManagementClientDisconnectActiveSessionsResponse]) 43 44 // ExpressRouteProviderPort is the fake for method ManagementClient.ExpressRouteProviderPort 45 // HTTP status codes to indicate success: http.StatusOK 46 ExpressRouteProviderPort func(ctx context.Context, providerport string, options *armnetwork.ManagementClientExpressRouteProviderPortOptions) (resp azfake.Responder[armnetwork.ManagementClientExpressRouteProviderPortResponse], errResp azfake.ErrorResponder) 47 48 // BeginGeneratevirtualwanvpnserverconfigurationvpnprofile is the fake for method ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile 49 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 50 BeginGeneratevirtualwanvpnserverconfigurationvpnprofile func(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams armnetwork.VirtualWanVPNProfileParameters, options *armnetwork.ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (resp azfake.PollerResponder[armnetwork.ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse], errResp azfake.ErrorResponder) 51 52 // BeginGetActiveSessions is the fake for method ManagementClient.BeginGetActiveSessions 53 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 54 BeginGetActiveSessions func(ctx context.Context, resourceGroupName string, bastionHostName string, options *armnetwork.ManagementClientBeginGetActiveSessionsOptions) (resp azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientGetActiveSessionsResponse]], errResp azfake.ErrorResponder) 55 56 // NewGetBastionShareableLinkPager is the fake for method ManagementClient.NewGetBastionShareableLinkPager 57 // HTTP status codes to indicate success: http.StatusOK 58 NewGetBastionShareableLinkPager func(resourceGroupName string, bastionHostName string, bslRequest armnetwork.BastionShareableLinkListRequest, options *armnetwork.ManagementClientGetBastionShareableLinkOptions) (resp azfake.PagerResponder[armnetwork.ManagementClientGetBastionShareableLinkResponse]) 59 60 // ListActiveConnectivityConfigurations is the fake for method ManagementClient.ListActiveConnectivityConfigurations 61 // HTTP status codes to indicate success: http.StatusOK 62 ListActiveConnectivityConfigurations func(ctx context.Context, resourceGroupName string, networkManagerName string, parameters armnetwork.ActiveConfigurationParameter, options *armnetwork.ManagementClientListActiveConnectivityConfigurationsOptions) (resp azfake.Responder[armnetwork.ManagementClientListActiveConnectivityConfigurationsResponse], errResp azfake.ErrorResponder) 63 64 // ListActiveSecurityAdminRules is the fake for method ManagementClient.ListActiveSecurityAdminRules 65 // HTTP status codes to indicate success: http.StatusOK 66 ListActiveSecurityAdminRules func(ctx context.Context, resourceGroupName string, networkManagerName string, parameters armnetwork.ActiveConfigurationParameter, options *armnetwork.ManagementClientListActiveSecurityAdminRulesOptions) (resp azfake.Responder[armnetwork.ManagementClientListActiveSecurityAdminRulesResponse], errResp azfake.ErrorResponder) 67 68 // ListNetworkManagerEffectiveConnectivityConfigurations is the fake for method ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations 69 // HTTP status codes to indicate success: http.StatusOK 70 ListNetworkManagerEffectiveConnectivityConfigurations func(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters armnetwork.QueryRequestOptions, options *armnetwork.ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (resp azfake.Responder[armnetwork.ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse], errResp azfake.ErrorResponder) 71 72 // ListNetworkManagerEffectiveSecurityAdminRules is the fake for method ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules 73 // HTTP status codes to indicate success: http.StatusOK 74 ListNetworkManagerEffectiveSecurityAdminRules func(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters armnetwork.QueryRequestOptions, options *armnetwork.ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (resp azfake.Responder[armnetwork.ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse], errResp azfake.ErrorResponder) 75 76 // BeginPutBastionShareableLink is the fake for method ManagementClient.BeginPutBastionShareableLink 77 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 78 BeginPutBastionShareableLink func(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest armnetwork.BastionShareableLinkListRequest, options *armnetwork.ManagementClientBeginPutBastionShareableLinkOptions) (resp azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientPutBastionShareableLinkResponse]], errResp azfake.ErrorResponder) 79 80 // SupportedSecurityProviders is the fake for method ManagementClient.SupportedSecurityProviders 81 // HTTP status codes to indicate success: http.StatusOK 82 SupportedSecurityProviders func(ctx context.Context, resourceGroupName string, virtualWANName string, options *armnetwork.ManagementClientSupportedSecurityProvidersOptions) (resp azfake.Responder[armnetwork.ManagementClientSupportedSecurityProvidersResponse], errResp azfake.ErrorResponder) 83 } 84 85 // NewManagementServerTransport creates a new instance of ManagementServerTransport with the provided implementation. 86 // The returned ManagementServerTransport instance is connected to an instance of armnetwork.ManagementClient via the 87 // azcore.ClientOptions.Transporter field in the client's constructor parameters. 88 func NewManagementServerTransport(srv *ManagementServer) *ManagementServerTransport { 89 return &ManagementServerTransport{ 90 srv: srv, 91 beginDeleteBastionShareableLink: newTracker[azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkResponse]](), 92 beginDeleteBastionShareableLinkByToken: newTracker[azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkByTokenResponse]](), 93 newDisconnectActiveSessionsPager: newTracker[azfake.PagerResponder[armnetwork.ManagementClientDisconnectActiveSessionsResponse]](), 94 beginGeneratevirtualwanvpnserverconfigurationvpnprofile: newTracker[azfake.PollerResponder[armnetwork.ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]](), 95 beginGetActiveSessions: newTracker[azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientGetActiveSessionsResponse]]](), 96 newGetBastionShareableLinkPager: newTracker[azfake.PagerResponder[armnetwork.ManagementClientGetBastionShareableLinkResponse]](), 97 beginPutBastionShareableLink: newTracker[azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientPutBastionShareableLinkResponse]]](), 98 } 99 } 100 101 // ManagementServerTransport connects instances of armnetwork.ManagementClient to instances of ManagementServer. 102 // Don't use this type directly, use NewManagementServerTransport instead. 103 type ManagementServerTransport struct { 104 srv *ManagementServer 105 beginDeleteBastionShareableLink *tracker[azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkResponse]] 106 beginDeleteBastionShareableLinkByToken *tracker[azfake.PollerResponder[armnetwork.ManagementClientDeleteBastionShareableLinkByTokenResponse]] 107 newDisconnectActiveSessionsPager *tracker[azfake.PagerResponder[armnetwork.ManagementClientDisconnectActiveSessionsResponse]] 108 beginGeneratevirtualwanvpnserverconfigurationvpnprofile *tracker[azfake.PollerResponder[armnetwork.ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]] 109 beginGetActiveSessions *tracker[azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientGetActiveSessionsResponse]]] 110 newGetBastionShareableLinkPager *tracker[azfake.PagerResponder[armnetwork.ManagementClientGetBastionShareableLinkResponse]] 111 beginPutBastionShareableLink *tracker[azfake.PollerResponder[azfake.PagerResponder[armnetwork.ManagementClientPutBastionShareableLinkResponse]]] 112 } 113 114 // Do implements the policy.Transporter interface for ManagementServerTransport. 115 func (m *ManagementServerTransport) Do(req *http.Request) (*http.Response, error) { 116 rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) 117 method, ok := rawMethod.(string) 118 if !ok { 119 return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} 120 } 121 122 var resp *http.Response 123 var err error 124 125 switch method { 126 case "ManagementClient.CheckDNSNameAvailability": 127 resp, err = m.dispatchCheckDNSNameAvailability(req) 128 case "ManagementClient.BeginDeleteBastionShareableLink": 129 resp, err = m.dispatchBeginDeleteBastionShareableLink(req) 130 case "ManagementClient.BeginDeleteBastionShareableLinkByToken": 131 resp, err = m.dispatchBeginDeleteBastionShareableLinkByToken(req) 132 case "ManagementClient.NewDisconnectActiveSessionsPager": 133 resp, err = m.dispatchNewDisconnectActiveSessionsPager(req) 134 case "ManagementClient.ExpressRouteProviderPort": 135 resp, err = m.dispatchExpressRouteProviderPort(req) 136 case "ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile": 137 resp, err = m.dispatchBeginGeneratevirtualwanvpnserverconfigurationvpnprofile(req) 138 case "ManagementClient.BeginGetActiveSessions": 139 resp, err = m.dispatchBeginGetActiveSessions(req) 140 case "ManagementClient.NewGetBastionShareableLinkPager": 141 resp, err = m.dispatchNewGetBastionShareableLinkPager(req) 142 case "ManagementClient.ListActiveConnectivityConfigurations": 143 resp, err = m.dispatchListActiveConnectivityConfigurations(req) 144 case "ManagementClient.ListActiveSecurityAdminRules": 145 resp, err = m.dispatchListActiveSecurityAdminRules(req) 146 case "ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations": 147 resp, err = m.dispatchListNetworkManagerEffectiveConnectivityConfigurations(req) 148 case "ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules": 149 resp, err = m.dispatchListNetworkManagerEffectiveSecurityAdminRules(req) 150 case "ManagementClient.BeginPutBastionShareableLink": 151 resp, err = m.dispatchBeginPutBastionShareableLink(req) 152 case "ManagementClient.SupportedSecurityProviders": 153 resp, err = m.dispatchSupportedSecurityProviders(req) 154 default: 155 err = fmt.Errorf("unhandled API %s", method) 156 } 157 158 if err != nil { 159 return nil, err 160 } 161 162 return resp, nil 163 } 164 165 func (m *ManagementServerTransport) dispatchCheckDNSNameAvailability(req *http.Request) (*http.Response, error) { 166 if m.srv.CheckDNSNameAvailability == nil { 167 return nil, &nonRetriableError{errors.New("fake for method CheckDNSNameAvailability not implemented")} 168 } 169 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/locations/(?P<location>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/CheckDnsNameAvailability` 170 regex := regexp.MustCompile(regexStr) 171 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 172 if matches == nil || len(matches) < 2 { 173 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 174 } 175 qp := req.URL.Query() 176 locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) 177 if err != nil { 178 return nil, err 179 } 180 domainNameLabelParam, err := url.QueryUnescape(qp.Get("domainNameLabel")) 181 if err != nil { 182 return nil, err 183 } 184 respr, errRespr := m.srv.CheckDNSNameAvailability(req.Context(), locationParam, domainNameLabelParam, nil) 185 if respErr := server.GetError(errRespr, req); respErr != nil { 186 return nil, respErr 187 } 188 respContent := server.GetResponseContent(respr) 189 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 190 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 191 } 192 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DNSNameAvailabilityResult, req) 193 if err != nil { 194 return nil, err 195 } 196 return resp, nil 197 } 198 199 func (m *ManagementServerTransport) dispatchBeginDeleteBastionShareableLink(req *http.Request) (*http.Response, error) { 200 if m.srv.BeginDeleteBastionShareableLink == nil { 201 return nil, &nonRetriableError{errors.New("fake for method BeginDeleteBastionShareableLink not implemented")} 202 } 203 beginDeleteBastionShareableLink := m.beginDeleteBastionShareableLink.get(req) 204 if beginDeleteBastionShareableLink == nil { 205 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteShareableLinks` 206 regex := regexp.MustCompile(regexStr) 207 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 208 if matches == nil || len(matches) < 3 { 209 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 210 } 211 body, err := server.UnmarshalRequestAsJSON[armnetwork.BastionShareableLinkListRequest](req) 212 if err != nil { 213 return nil, err 214 } 215 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 216 if err != nil { 217 return nil, err 218 } 219 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 220 if err != nil { 221 return nil, err 222 } 223 respr, errRespr := m.srv.BeginDeleteBastionShareableLink(req.Context(), resourceGroupNameParam, bastionHostNameParam, body, nil) 224 if respErr := server.GetError(errRespr, req); respErr != nil { 225 return nil, respErr 226 } 227 beginDeleteBastionShareableLink = &respr 228 m.beginDeleteBastionShareableLink.add(req, beginDeleteBastionShareableLink) 229 } 230 231 resp, err := server.PollerResponderNext(beginDeleteBastionShareableLink, req) 232 if err != nil { 233 return nil, err 234 } 235 236 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 237 m.beginDeleteBastionShareableLink.remove(req) 238 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 239 } 240 if !server.PollerResponderMore(beginDeleteBastionShareableLink) { 241 m.beginDeleteBastionShareableLink.remove(req) 242 } 243 244 return resp, nil 245 } 246 247 func (m *ManagementServerTransport) dispatchBeginDeleteBastionShareableLinkByToken(req *http.Request) (*http.Response, error) { 248 if m.srv.BeginDeleteBastionShareableLinkByToken == nil { 249 return nil, &nonRetriableError{errors.New("fake for method BeginDeleteBastionShareableLinkByToken not implemented")} 250 } 251 beginDeleteBastionShareableLinkByToken := m.beginDeleteBastionShareableLinkByToken.get(req) 252 if beginDeleteBastionShareableLinkByToken == nil { 253 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteShareableLinksByToken` 254 regex := regexp.MustCompile(regexStr) 255 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 256 if matches == nil || len(matches) < 3 { 257 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 258 } 259 body, err := server.UnmarshalRequestAsJSON[armnetwork.BastionShareableLinkTokenListRequest](req) 260 if err != nil { 261 return nil, err 262 } 263 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 264 if err != nil { 265 return nil, err 266 } 267 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 268 if err != nil { 269 return nil, err 270 } 271 respr, errRespr := m.srv.BeginDeleteBastionShareableLinkByToken(req.Context(), resourceGroupNameParam, bastionHostNameParam, body, nil) 272 if respErr := server.GetError(errRespr, req); respErr != nil { 273 return nil, respErr 274 } 275 beginDeleteBastionShareableLinkByToken = &respr 276 m.beginDeleteBastionShareableLinkByToken.add(req, beginDeleteBastionShareableLinkByToken) 277 } 278 279 resp, err := server.PollerResponderNext(beginDeleteBastionShareableLinkByToken, req) 280 if err != nil { 281 return nil, err 282 } 283 284 if !contains([]int{http.StatusAccepted}, resp.StatusCode) { 285 m.beginDeleteBastionShareableLinkByToken.remove(req) 286 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} 287 } 288 if !server.PollerResponderMore(beginDeleteBastionShareableLinkByToken) { 289 m.beginDeleteBastionShareableLinkByToken.remove(req) 290 } 291 292 return resp, nil 293 } 294 295 func (m *ManagementServerTransport) dispatchNewDisconnectActiveSessionsPager(req *http.Request) (*http.Response, error) { 296 if m.srv.NewDisconnectActiveSessionsPager == nil { 297 return nil, &nonRetriableError{errors.New("fake for method NewDisconnectActiveSessionsPager not implemented")} 298 } 299 newDisconnectActiveSessionsPager := m.newDisconnectActiveSessionsPager.get(req) 300 if newDisconnectActiveSessionsPager == nil { 301 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/disconnectActiveSessions` 302 regex := regexp.MustCompile(regexStr) 303 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 304 if matches == nil || len(matches) < 3 { 305 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 306 } 307 body, err := server.UnmarshalRequestAsJSON[armnetwork.SessionIDs](req) 308 if err != nil { 309 return nil, err 310 } 311 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 312 if err != nil { 313 return nil, err 314 } 315 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 316 if err != nil { 317 return nil, err 318 } 319 resp := m.srv.NewDisconnectActiveSessionsPager(resourceGroupNameParam, bastionHostNameParam, body, nil) 320 newDisconnectActiveSessionsPager = &resp 321 m.newDisconnectActiveSessionsPager.add(req, newDisconnectActiveSessionsPager) 322 server.PagerResponderInjectNextLinks(newDisconnectActiveSessionsPager, req, func(page *armnetwork.ManagementClientDisconnectActiveSessionsResponse, createLink func() string) { 323 page.NextLink = to.Ptr(createLink()) 324 }) 325 } 326 resp, err := server.PagerResponderNext(newDisconnectActiveSessionsPager, req) 327 if err != nil { 328 return nil, err 329 } 330 if !contains([]int{http.StatusOK}, resp.StatusCode) { 331 m.newDisconnectActiveSessionsPager.remove(req) 332 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 333 } 334 if !server.PagerResponderMore(newDisconnectActiveSessionsPager) { 335 m.newDisconnectActiveSessionsPager.remove(req) 336 } 337 return resp, nil 338 } 339 340 func (m *ManagementServerTransport) dispatchExpressRouteProviderPort(req *http.Request) (*http.Response, error) { 341 if m.srv.ExpressRouteProviderPort == nil { 342 return nil, &nonRetriableError{errors.New("fake for method ExpressRouteProviderPort not implemented")} 343 } 344 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/expressRouteProviderPorts/(?P<providerport>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 345 regex := regexp.MustCompile(regexStr) 346 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 347 if matches == nil || len(matches) < 2 { 348 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 349 } 350 providerportParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerport")]) 351 if err != nil { 352 return nil, err 353 } 354 respr, errRespr := m.srv.ExpressRouteProviderPort(req.Context(), providerportParam, nil) 355 if respErr := server.GetError(errRespr, req); respErr != nil { 356 return nil, respErr 357 } 358 respContent := server.GetResponseContent(respr) 359 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 360 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 361 } 362 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExpressRouteProviderPort, req) 363 if err != nil { 364 return nil, err 365 } 366 return resp, nil 367 } 368 369 func (m *ManagementServerTransport) dispatchBeginGeneratevirtualwanvpnserverconfigurationvpnprofile(req *http.Request) (*http.Response, error) { 370 if m.srv.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile == nil { 371 return nil, &nonRetriableError{errors.New("fake for method BeginGeneratevirtualwanvpnserverconfigurationvpnprofile not implemented")} 372 } 373 beginGeneratevirtualwanvpnserverconfigurationvpnprofile := m.beginGeneratevirtualwanvpnserverconfigurationvpnprofile.get(req) 374 if beginGeneratevirtualwanvpnserverconfigurationvpnprofile == nil { 375 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/virtualWans/(?P<virtualWANName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/GenerateVpnProfile` 376 regex := regexp.MustCompile(regexStr) 377 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 378 if matches == nil || len(matches) < 3 { 379 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 380 } 381 body, err := server.UnmarshalRequestAsJSON[armnetwork.VirtualWanVPNProfileParameters](req) 382 if err != nil { 383 return nil, err 384 } 385 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 386 if err != nil { 387 return nil, err 388 } 389 virtualWANNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualWANName")]) 390 if err != nil { 391 return nil, err 392 } 393 respr, errRespr := m.srv.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile(req.Context(), resourceGroupNameParam, virtualWANNameParam, body, nil) 394 if respErr := server.GetError(errRespr, req); respErr != nil { 395 return nil, respErr 396 } 397 beginGeneratevirtualwanvpnserverconfigurationvpnprofile = &respr 398 m.beginGeneratevirtualwanvpnserverconfigurationvpnprofile.add(req, beginGeneratevirtualwanvpnserverconfigurationvpnprofile) 399 } 400 401 resp, err := server.PollerResponderNext(beginGeneratevirtualwanvpnserverconfigurationvpnprofile, req) 402 if err != nil { 403 return nil, err 404 } 405 406 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 407 m.beginGeneratevirtualwanvpnserverconfigurationvpnprofile.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(beginGeneratevirtualwanvpnserverconfigurationvpnprofile) { 411 m.beginGeneratevirtualwanvpnserverconfigurationvpnprofile.remove(req) 412 } 413 414 return resp, nil 415 } 416 417 func (m *ManagementServerTransport) dispatchBeginGetActiveSessions(req *http.Request) (*http.Response, error) { 418 if m.srv.BeginGetActiveSessions == nil { 419 return nil, &nonRetriableError{errors.New("fake for method BeginGetActiveSessions not implemented")} 420 } 421 beginGetActiveSessions := m.beginGetActiveSessions.get(req) 422 if beginGetActiveSessions == nil { 423 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getActiveSessions` 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 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 430 if err != nil { 431 return nil, err 432 } 433 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 434 if err != nil { 435 return nil, err 436 } 437 respr, errRespr := m.srv.BeginGetActiveSessions(req.Context(), resourceGroupNameParam, bastionHostNameParam, nil) 438 if respErr := server.GetError(errRespr, req); respErr != nil { 439 return nil, respErr 440 } 441 beginGetActiveSessions = &respr 442 m.beginGetActiveSessions.add(req, beginGetActiveSessions) 443 } 444 445 resp, err := server.PollerResponderNext(beginGetActiveSessions, req) 446 if err != nil { 447 return nil, err 448 } 449 450 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 451 m.beginGetActiveSessions.remove(req) 452 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 453 } 454 if !server.PollerResponderMore(beginGetActiveSessions) { 455 m.beginGetActiveSessions.remove(req) 456 } 457 458 return resp, nil 459 } 460 461 func (m *ManagementServerTransport) dispatchNewGetBastionShareableLinkPager(req *http.Request) (*http.Response, error) { 462 if m.srv.NewGetBastionShareableLinkPager == nil { 463 return nil, &nonRetriableError{errors.New("fake for method NewGetBastionShareableLinkPager not implemented")} 464 } 465 newGetBastionShareableLinkPager := m.newGetBastionShareableLinkPager.get(req) 466 if newGetBastionShareableLinkPager == nil { 467 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getShareableLinks` 468 regex := regexp.MustCompile(regexStr) 469 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 470 if matches == nil || len(matches) < 3 { 471 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 472 } 473 body, err := server.UnmarshalRequestAsJSON[armnetwork.BastionShareableLinkListRequest](req) 474 if err != nil { 475 return nil, err 476 } 477 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 478 if err != nil { 479 return nil, err 480 } 481 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 482 if err != nil { 483 return nil, err 484 } 485 resp := m.srv.NewGetBastionShareableLinkPager(resourceGroupNameParam, bastionHostNameParam, body, nil) 486 newGetBastionShareableLinkPager = &resp 487 m.newGetBastionShareableLinkPager.add(req, newGetBastionShareableLinkPager) 488 server.PagerResponderInjectNextLinks(newGetBastionShareableLinkPager, req, func(page *armnetwork.ManagementClientGetBastionShareableLinkResponse, createLink func() string) { 489 page.NextLink = to.Ptr(createLink()) 490 }) 491 } 492 resp, err := server.PagerResponderNext(newGetBastionShareableLinkPager, req) 493 if err != nil { 494 return nil, err 495 } 496 if !contains([]int{http.StatusOK}, resp.StatusCode) { 497 m.newGetBastionShareableLinkPager.remove(req) 498 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 499 } 500 if !server.PagerResponderMore(newGetBastionShareableLinkPager) { 501 m.newGetBastionShareableLinkPager.remove(req) 502 } 503 return resp, nil 504 } 505 506 func (m *ManagementServerTransport) dispatchListActiveConnectivityConfigurations(req *http.Request) (*http.Response, error) { 507 if m.srv.ListActiveConnectivityConfigurations == nil { 508 return nil, &nonRetriableError{errors.New("fake for method ListActiveConnectivityConfigurations not implemented")} 509 } 510 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkManagers/(?P<networkManagerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listActiveConnectivityConfigurations` 511 regex := regexp.MustCompile(regexStr) 512 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 513 if matches == nil || len(matches) < 3 { 514 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 515 } 516 qp := req.URL.Query() 517 body, err := server.UnmarshalRequestAsJSON[armnetwork.ActiveConfigurationParameter](req) 518 if err != nil { 519 return nil, err 520 } 521 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 522 if err != nil { 523 return nil, err 524 } 525 networkManagerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkManagerName")]) 526 if err != nil { 527 return nil, err 528 } 529 topUnescaped, err := url.QueryUnescape(qp.Get("$top")) 530 if err != nil { 531 return nil, err 532 } 533 topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { 534 p, parseErr := strconv.ParseInt(v, 10, 32) 535 if parseErr != nil { 536 return 0, parseErr 537 } 538 return int32(p), nil 539 }) 540 if err != nil { 541 return nil, err 542 } 543 var options *armnetwork.ManagementClientListActiveConnectivityConfigurationsOptions 544 if topParam != nil { 545 options = &armnetwork.ManagementClientListActiveConnectivityConfigurationsOptions{ 546 Top: topParam, 547 } 548 } 549 respr, errRespr := m.srv.ListActiveConnectivityConfigurations(req.Context(), resourceGroupNameParam, networkManagerNameParam, body, options) 550 if respErr := server.GetError(errRespr, req); respErr != nil { 551 return nil, respErr 552 } 553 respContent := server.GetResponseContent(respr) 554 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 555 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 556 } 557 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActiveConnectivityConfigurationsListResult, req) 558 if err != nil { 559 return nil, err 560 } 561 return resp, nil 562 } 563 564 func (m *ManagementServerTransport) dispatchListActiveSecurityAdminRules(req *http.Request) (*http.Response, error) { 565 if m.srv.ListActiveSecurityAdminRules == nil { 566 return nil, &nonRetriableError{errors.New("fake for method ListActiveSecurityAdminRules not implemented")} 567 } 568 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkManagers/(?P<networkManagerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listActiveSecurityAdminRules` 569 regex := regexp.MustCompile(regexStr) 570 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 571 if matches == nil || len(matches) < 3 { 572 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 573 } 574 qp := req.URL.Query() 575 body, err := server.UnmarshalRequestAsJSON[armnetwork.ActiveConfigurationParameter](req) 576 if err != nil { 577 return nil, err 578 } 579 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 580 if err != nil { 581 return nil, err 582 } 583 networkManagerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkManagerName")]) 584 if err != nil { 585 return nil, err 586 } 587 topUnescaped, err := url.QueryUnescape(qp.Get("$top")) 588 if err != nil { 589 return nil, err 590 } 591 topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { 592 p, parseErr := strconv.ParseInt(v, 10, 32) 593 if parseErr != nil { 594 return 0, parseErr 595 } 596 return int32(p), nil 597 }) 598 if err != nil { 599 return nil, err 600 } 601 var options *armnetwork.ManagementClientListActiveSecurityAdminRulesOptions 602 if topParam != nil { 603 options = &armnetwork.ManagementClientListActiveSecurityAdminRulesOptions{ 604 Top: topParam, 605 } 606 } 607 respr, errRespr := m.srv.ListActiveSecurityAdminRules(req.Context(), resourceGroupNameParam, networkManagerNameParam, body, options) 608 if respErr := server.GetError(errRespr, req); respErr != nil { 609 return nil, respErr 610 } 611 respContent := server.GetResponseContent(respr) 612 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 613 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 614 } 615 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActiveSecurityAdminRulesListResult, req) 616 if err != nil { 617 return nil, err 618 } 619 return resp, nil 620 } 621 622 func (m *ManagementServerTransport) dispatchListNetworkManagerEffectiveConnectivityConfigurations(req *http.Request) (*http.Response, error) { 623 if m.srv.ListNetworkManagerEffectiveConnectivityConfigurations == nil { 624 return nil, &nonRetriableError{errors.New("fake for method ListNetworkManagerEffectiveConnectivityConfigurations not implemented")} 625 } 626 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/virtualNetworks/(?P<virtualNetworkName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listNetworkManagerEffectiveConnectivityConfigurations` 627 regex := regexp.MustCompile(regexStr) 628 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 629 if matches == nil || len(matches) < 3 { 630 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 631 } 632 qp := req.URL.Query() 633 body, err := server.UnmarshalRequestAsJSON[armnetwork.QueryRequestOptions](req) 634 if err != nil { 635 return nil, err 636 } 637 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 638 if err != nil { 639 return nil, err 640 } 641 virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) 642 if err != nil { 643 return nil, err 644 } 645 topUnescaped, err := url.QueryUnescape(qp.Get("$top")) 646 if err != nil { 647 return nil, err 648 } 649 topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { 650 p, parseErr := strconv.ParseInt(v, 10, 32) 651 if parseErr != nil { 652 return 0, parseErr 653 } 654 return int32(p), nil 655 }) 656 if err != nil { 657 return nil, err 658 } 659 var options *armnetwork.ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions 660 if topParam != nil { 661 options = &armnetwork.ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions{ 662 Top: topParam, 663 } 664 } 665 respr, errRespr := m.srv.ListNetworkManagerEffectiveConnectivityConfigurations(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, body, options) 666 if respErr := server.GetError(errRespr, req); respErr != nil { 667 return nil, respErr 668 } 669 respContent := server.GetResponseContent(respr) 670 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 671 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 672 } 673 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagerEffectiveConnectivityConfigurationListResult, req) 674 if err != nil { 675 return nil, err 676 } 677 return resp, nil 678 } 679 680 func (m *ManagementServerTransport) dispatchListNetworkManagerEffectiveSecurityAdminRules(req *http.Request) (*http.Response, error) { 681 if m.srv.ListNetworkManagerEffectiveSecurityAdminRules == nil { 682 return nil, &nonRetriableError{errors.New("fake for method ListNetworkManagerEffectiveSecurityAdminRules not implemented")} 683 } 684 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/virtualNetworks/(?P<virtualNetworkName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listNetworkManagerEffectiveSecurityAdminRules` 685 regex := regexp.MustCompile(regexStr) 686 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 687 if matches == nil || len(matches) < 3 { 688 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 689 } 690 qp := req.URL.Query() 691 body, err := server.UnmarshalRequestAsJSON[armnetwork.QueryRequestOptions](req) 692 if err != nil { 693 return nil, err 694 } 695 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 696 if err != nil { 697 return nil, err 698 } 699 virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) 700 if err != nil { 701 return nil, err 702 } 703 topUnescaped, err := url.QueryUnescape(qp.Get("$top")) 704 if err != nil { 705 return nil, err 706 } 707 topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { 708 p, parseErr := strconv.ParseInt(v, 10, 32) 709 if parseErr != nil { 710 return 0, parseErr 711 } 712 return int32(p), nil 713 }) 714 if err != nil { 715 return nil, err 716 } 717 var options *armnetwork.ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions 718 if topParam != nil { 719 options = &armnetwork.ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions{ 720 Top: topParam, 721 } 722 } 723 respr, errRespr := m.srv.ListNetworkManagerEffectiveSecurityAdminRules(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, body, options) 724 if respErr := server.GetError(errRespr, req); respErr != nil { 725 return nil, respErr 726 } 727 respContent := server.GetResponseContent(respr) 728 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 729 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 730 } 731 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagerEffectiveSecurityAdminRulesListResult, req) 732 if err != nil { 733 return nil, err 734 } 735 return resp, nil 736 } 737 738 func (m *ManagementServerTransport) dispatchBeginPutBastionShareableLink(req *http.Request) (*http.Response, error) { 739 if m.srv.BeginPutBastionShareableLink == nil { 740 return nil, &nonRetriableError{errors.New("fake for method BeginPutBastionShareableLink not implemented")} 741 } 742 beginPutBastionShareableLink := m.beginPutBastionShareableLink.get(req) 743 if beginPutBastionShareableLink == nil { 744 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/bastionHosts/(?P<bastionHostName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createShareableLinks` 745 regex := regexp.MustCompile(regexStr) 746 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 747 if matches == nil || len(matches) < 3 { 748 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 749 } 750 body, err := server.UnmarshalRequestAsJSON[armnetwork.BastionShareableLinkListRequest](req) 751 if err != nil { 752 return nil, err 753 } 754 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 755 if err != nil { 756 return nil, err 757 } 758 bastionHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("bastionHostName")]) 759 if err != nil { 760 return nil, err 761 } 762 respr, errRespr := m.srv.BeginPutBastionShareableLink(req.Context(), resourceGroupNameParam, bastionHostNameParam, body, nil) 763 if respErr := server.GetError(errRespr, req); respErr != nil { 764 return nil, respErr 765 } 766 beginPutBastionShareableLink = &respr 767 m.beginPutBastionShareableLink.add(req, beginPutBastionShareableLink) 768 } 769 770 resp, err := server.PollerResponderNext(beginPutBastionShareableLink, req) 771 if err != nil { 772 return nil, err 773 } 774 775 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 776 m.beginPutBastionShareableLink.remove(req) 777 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 778 } 779 if !server.PollerResponderMore(beginPutBastionShareableLink) { 780 m.beginPutBastionShareableLink.remove(req) 781 } 782 783 return resp, nil 784 } 785 786 func (m *ManagementServerTransport) dispatchSupportedSecurityProviders(req *http.Request) (*http.Response, error) { 787 if m.srv.SupportedSecurityProviders == nil { 788 return nil, &nonRetriableError{errors.New("fake for method SupportedSecurityProviders not implemented")} 789 } 790 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/virtualWans/(?P<virtualWANName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/supportedSecurityProviders` 791 regex := regexp.MustCompile(regexStr) 792 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 793 if matches == nil || len(matches) < 3 { 794 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 795 } 796 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 797 if err != nil { 798 return nil, err 799 } 800 virtualWANNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualWANName")]) 801 if err != nil { 802 return nil, err 803 } 804 respr, errRespr := m.srv.SupportedSecurityProviders(req.Context(), resourceGroupNameParam, virtualWANNameParam, nil) 805 if respErr := server.GetError(errRespr, req); respErr != nil { 806 return nil, respErr 807 } 808 respContent := server.GetResponseContent(respr) 809 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 810 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 811 } 812 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VirtualWanSecurityProviders, req) 813 if err != nil { 814 return nil, err 815 } 816 return resp, nil 817 }