github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/watchers_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/resourcemanager/network/armnetwork/v6" 19 "net/http" 20 "net/url" 21 "regexp" 22 ) 23 24 // WatchersServer is a fake server for instances of the armnetwork.WatchersClient type. 25 type WatchersServer struct { 26 // BeginCheckConnectivity is the fake for method WatchersClient.BeginCheckConnectivity 27 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 28 BeginCheckConnectivity func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.ConnectivityParameters, options *armnetwork.WatchersClientBeginCheckConnectivityOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientCheckConnectivityResponse], errResp azfake.ErrorResponder) 29 30 // CreateOrUpdate is the fake for method WatchersClient.CreateOrUpdate 31 // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated 32 CreateOrUpdate func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.Watcher, options *armnetwork.WatchersClientCreateOrUpdateOptions) (resp azfake.Responder[armnetwork.WatchersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) 33 34 // BeginDelete is the fake for method WatchersClient.BeginDelete 35 // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent 36 BeginDelete func(ctx context.Context, resourceGroupName string, networkWatcherName string, options *armnetwork.WatchersClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientDeleteResponse], errResp azfake.ErrorResponder) 37 38 // Get is the fake for method WatchersClient.Get 39 // HTTP status codes to indicate success: http.StatusOK 40 Get func(ctx context.Context, resourceGroupName string, networkWatcherName string, options *armnetwork.WatchersClientGetOptions) (resp azfake.Responder[armnetwork.WatchersClientGetResponse], errResp azfake.ErrorResponder) 41 42 // BeginGetAzureReachabilityReport is the fake for method WatchersClient.BeginGetAzureReachabilityReport 43 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 44 BeginGetAzureReachabilityReport func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.AzureReachabilityReportParameters, options *armnetwork.WatchersClientBeginGetAzureReachabilityReportOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetAzureReachabilityReportResponse], errResp azfake.ErrorResponder) 45 46 // BeginGetFlowLogStatus is the fake for method WatchersClient.BeginGetFlowLogStatus 47 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 48 BeginGetFlowLogStatus func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.FlowLogStatusParameters, options *armnetwork.WatchersClientBeginGetFlowLogStatusOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetFlowLogStatusResponse], errResp azfake.ErrorResponder) 49 50 // BeginGetNetworkConfigurationDiagnostic is the fake for method WatchersClient.BeginGetNetworkConfigurationDiagnostic 51 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 52 BeginGetNetworkConfigurationDiagnostic func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.ConfigurationDiagnosticParameters, options *armnetwork.WatchersClientBeginGetNetworkConfigurationDiagnosticOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetNetworkConfigurationDiagnosticResponse], errResp azfake.ErrorResponder) 53 54 // BeginGetNextHop is the fake for method WatchersClient.BeginGetNextHop 55 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 56 BeginGetNextHop func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.NextHopParameters, options *armnetwork.WatchersClientBeginGetNextHopOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetNextHopResponse], errResp azfake.ErrorResponder) 57 58 // GetTopology is the fake for method WatchersClient.GetTopology 59 // HTTP status codes to indicate success: http.StatusOK 60 GetTopology func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.TopologyParameters, options *armnetwork.WatchersClientGetTopologyOptions) (resp azfake.Responder[armnetwork.WatchersClientGetTopologyResponse], errResp azfake.ErrorResponder) 61 62 // BeginGetTroubleshooting is the fake for method WatchersClient.BeginGetTroubleshooting 63 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 64 BeginGetTroubleshooting func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.TroubleshootingParameters, options *armnetwork.WatchersClientBeginGetTroubleshootingOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResponse], errResp azfake.ErrorResponder) 65 66 // BeginGetTroubleshootingResult is the fake for method WatchersClient.BeginGetTroubleshootingResult 67 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 68 BeginGetTroubleshootingResult func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.QueryTroubleshootingParameters, options *armnetwork.WatchersClientBeginGetTroubleshootingResultOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResultResponse], errResp azfake.ErrorResponder) 69 70 // BeginGetVMSecurityRules is the fake for method WatchersClient.BeginGetVMSecurityRules 71 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 72 BeginGetVMSecurityRules func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.SecurityGroupViewParameters, options *armnetwork.WatchersClientBeginGetVMSecurityRulesOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientGetVMSecurityRulesResponse], errResp azfake.ErrorResponder) 73 74 // NewListPager is the fake for method WatchersClient.NewListPager 75 // HTTP status codes to indicate success: http.StatusOK 76 NewListPager func(resourceGroupName string, options *armnetwork.WatchersClientListOptions) (resp azfake.PagerResponder[armnetwork.WatchersClientListResponse]) 77 78 // NewListAllPager is the fake for method WatchersClient.NewListAllPager 79 // HTTP status codes to indicate success: http.StatusOK 80 NewListAllPager func(options *armnetwork.WatchersClientListAllOptions) (resp azfake.PagerResponder[armnetwork.WatchersClientListAllResponse]) 81 82 // BeginListAvailableProviders is the fake for method WatchersClient.BeginListAvailableProviders 83 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 84 BeginListAvailableProviders func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.AvailableProvidersListParameters, options *armnetwork.WatchersClientBeginListAvailableProvidersOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientListAvailableProvidersResponse], errResp azfake.ErrorResponder) 85 86 // BeginSetFlowLogConfiguration is the fake for method WatchersClient.BeginSetFlowLogConfiguration 87 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 88 BeginSetFlowLogConfiguration func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.FlowLogInformation, options *armnetwork.WatchersClientBeginSetFlowLogConfigurationOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientSetFlowLogConfigurationResponse], errResp azfake.ErrorResponder) 89 90 // UpdateTags is the fake for method WatchersClient.UpdateTags 91 // HTTP status codes to indicate success: http.StatusOK 92 UpdateTags func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.TagsObject, options *armnetwork.WatchersClientUpdateTagsOptions) (resp azfake.Responder[armnetwork.WatchersClientUpdateTagsResponse], errResp azfake.ErrorResponder) 93 94 // BeginVerifyIPFlow is the fake for method WatchersClient.BeginVerifyIPFlow 95 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 96 BeginVerifyIPFlow func(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters armnetwork.VerificationIPFlowParameters, options *armnetwork.WatchersClientBeginVerifyIPFlowOptions) (resp azfake.PollerResponder[armnetwork.WatchersClientVerifyIPFlowResponse], errResp azfake.ErrorResponder) 97 } 98 99 // NewWatchersServerTransport creates a new instance of WatchersServerTransport with the provided implementation. 100 // The returned WatchersServerTransport instance is connected to an instance of armnetwork.WatchersClient via the 101 // azcore.ClientOptions.Transporter field in the client's constructor parameters. 102 func NewWatchersServerTransport(srv *WatchersServer) *WatchersServerTransport { 103 return &WatchersServerTransport{ 104 srv: srv, 105 beginCheckConnectivity: newTracker[azfake.PollerResponder[armnetwork.WatchersClientCheckConnectivityResponse]](), 106 beginDelete: newTracker[azfake.PollerResponder[armnetwork.WatchersClientDeleteResponse]](), 107 beginGetAzureReachabilityReport: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetAzureReachabilityReportResponse]](), 108 beginGetFlowLogStatus: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetFlowLogStatusResponse]](), 109 beginGetNetworkConfigurationDiagnostic: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetNetworkConfigurationDiagnosticResponse]](), 110 beginGetNextHop: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetNextHopResponse]](), 111 beginGetTroubleshooting: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResponse]](), 112 beginGetTroubleshootingResult: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResultResponse]](), 113 beginGetVMSecurityRules: newTracker[azfake.PollerResponder[armnetwork.WatchersClientGetVMSecurityRulesResponse]](), 114 newListPager: newTracker[azfake.PagerResponder[armnetwork.WatchersClientListResponse]](), 115 newListAllPager: newTracker[azfake.PagerResponder[armnetwork.WatchersClientListAllResponse]](), 116 beginListAvailableProviders: newTracker[azfake.PollerResponder[armnetwork.WatchersClientListAvailableProvidersResponse]](), 117 beginSetFlowLogConfiguration: newTracker[azfake.PollerResponder[armnetwork.WatchersClientSetFlowLogConfigurationResponse]](), 118 beginVerifyIPFlow: newTracker[azfake.PollerResponder[armnetwork.WatchersClientVerifyIPFlowResponse]](), 119 } 120 } 121 122 // WatchersServerTransport connects instances of armnetwork.WatchersClient to instances of WatchersServer. 123 // Don't use this type directly, use NewWatchersServerTransport instead. 124 type WatchersServerTransport struct { 125 srv *WatchersServer 126 beginCheckConnectivity *tracker[azfake.PollerResponder[armnetwork.WatchersClientCheckConnectivityResponse]] 127 beginDelete *tracker[azfake.PollerResponder[armnetwork.WatchersClientDeleteResponse]] 128 beginGetAzureReachabilityReport *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetAzureReachabilityReportResponse]] 129 beginGetFlowLogStatus *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetFlowLogStatusResponse]] 130 beginGetNetworkConfigurationDiagnostic *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetNetworkConfigurationDiagnosticResponse]] 131 beginGetNextHop *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetNextHopResponse]] 132 beginGetTroubleshooting *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResponse]] 133 beginGetTroubleshootingResult *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetTroubleshootingResultResponse]] 134 beginGetVMSecurityRules *tracker[azfake.PollerResponder[armnetwork.WatchersClientGetVMSecurityRulesResponse]] 135 newListPager *tracker[azfake.PagerResponder[armnetwork.WatchersClientListResponse]] 136 newListAllPager *tracker[azfake.PagerResponder[armnetwork.WatchersClientListAllResponse]] 137 beginListAvailableProviders *tracker[azfake.PollerResponder[armnetwork.WatchersClientListAvailableProvidersResponse]] 138 beginSetFlowLogConfiguration *tracker[azfake.PollerResponder[armnetwork.WatchersClientSetFlowLogConfigurationResponse]] 139 beginVerifyIPFlow *tracker[azfake.PollerResponder[armnetwork.WatchersClientVerifyIPFlowResponse]] 140 } 141 142 // Do implements the policy.Transporter interface for WatchersServerTransport. 143 func (w *WatchersServerTransport) Do(req *http.Request) (*http.Response, error) { 144 rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) 145 method, ok := rawMethod.(string) 146 if !ok { 147 return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} 148 } 149 150 var resp *http.Response 151 var err error 152 153 switch method { 154 case "WatchersClient.BeginCheckConnectivity": 155 resp, err = w.dispatchBeginCheckConnectivity(req) 156 case "WatchersClient.CreateOrUpdate": 157 resp, err = w.dispatchCreateOrUpdate(req) 158 case "WatchersClient.BeginDelete": 159 resp, err = w.dispatchBeginDelete(req) 160 case "WatchersClient.Get": 161 resp, err = w.dispatchGet(req) 162 case "WatchersClient.BeginGetAzureReachabilityReport": 163 resp, err = w.dispatchBeginGetAzureReachabilityReport(req) 164 case "WatchersClient.BeginGetFlowLogStatus": 165 resp, err = w.dispatchBeginGetFlowLogStatus(req) 166 case "WatchersClient.BeginGetNetworkConfigurationDiagnostic": 167 resp, err = w.dispatchBeginGetNetworkConfigurationDiagnostic(req) 168 case "WatchersClient.BeginGetNextHop": 169 resp, err = w.dispatchBeginGetNextHop(req) 170 case "WatchersClient.GetTopology": 171 resp, err = w.dispatchGetTopology(req) 172 case "WatchersClient.BeginGetTroubleshooting": 173 resp, err = w.dispatchBeginGetTroubleshooting(req) 174 case "WatchersClient.BeginGetTroubleshootingResult": 175 resp, err = w.dispatchBeginGetTroubleshootingResult(req) 176 case "WatchersClient.BeginGetVMSecurityRules": 177 resp, err = w.dispatchBeginGetVMSecurityRules(req) 178 case "WatchersClient.NewListPager": 179 resp, err = w.dispatchNewListPager(req) 180 case "WatchersClient.NewListAllPager": 181 resp, err = w.dispatchNewListAllPager(req) 182 case "WatchersClient.BeginListAvailableProviders": 183 resp, err = w.dispatchBeginListAvailableProviders(req) 184 case "WatchersClient.BeginSetFlowLogConfiguration": 185 resp, err = w.dispatchBeginSetFlowLogConfiguration(req) 186 case "WatchersClient.UpdateTags": 187 resp, err = w.dispatchUpdateTags(req) 188 case "WatchersClient.BeginVerifyIPFlow": 189 resp, err = w.dispatchBeginVerifyIPFlow(req) 190 default: 191 err = fmt.Errorf("unhandled API %s", method) 192 } 193 194 if err != nil { 195 return nil, err 196 } 197 198 return resp, nil 199 } 200 201 func (w *WatchersServerTransport) dispatchBeginCheckConnectivity(req *http.Request) (*http.Response, error) { 202 if w.srv.BeginCheckConnectivity == nil { 203 return nil, &nonRetriableError{errors.New("fake for method BeginCheckConnectivity not implemented")} 204 } 205 beginCheckConnectivity := w.beginCheckConnectivity.get(req) 206 if beginCheckConnectivity == nil { 207 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectivityCheck` 208 regex := regexp.MustCompile(regexStr) 209 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 210 if matches == nil || len(matches) < 3 { 211 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 212 } 213 body, err := server.UnmarshalRequestAsJSON[armnetwork.ConnectivityParameters](req) 214 if err != nil { 215 return nil, err 216 } 217 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 218 if err != nil { 219 return nil, err 220 } 221 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 222 if err != nil { 223 return nil, err 224 } 225 respr, errRespr := w.srv.BeginCheckConnectivity(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 226 if respErr := server.GetError(errRespr, req); respErr != nil { 227 return nil, respErr 228 } 229 beginCheckConnectivity = &respr 230 w.beginCheckConnectivity.add(req, beginCheckConnectivity) 231 } 232 233 resp, err := server.PollerResponderNext(beginCheckConnectivity, req) 234 if err != nil { 235 return nil, err 236 } 237 238 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 239 w.beginCheckConnectivity.remove(req) 240 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 241 } 242 if !server.PollerResponderMore(beginCheckConnectivity) { 243 w.beginCheckConnectivity.remove(req) 244 } 245 246 return resp, nil 247 } 248 249 func (w *WatchersServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { 250 if w.srv.CreateOrUpdate == nil { 251 return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} 252 } 253 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 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.Watcher](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 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 268 if err != nil { 269 return nil, err 270 } 271 respr, errRespr := w.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 272 if respErr := server.GetError(errRespr, req); respErr != nil { 273 return nil, respErr 274 } 275 respContent := server.GetResponseContent(respr) 276 if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { 277 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} 278 } 279 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Watcher, req) 280 if err != nil { 281 return nil, err 282 } 283 return resp, nil 284 } 285 286 func (w *WatchersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { 287 if w.srv.BeginDelete == nil { 288 return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} 289 } 290 beginDelete := w.beginDelete.get(req) 291 if beginDelete == nil { 292 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 293 regex := regexp.MustCompile(regexStr) 294 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 295 if matches == nil || len(matches) < 3 { 296 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 297 } 298 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 299 if err != nil { 300 return nil, err 301 } 302 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 303 if err != nil { 304 return nil, err 305 } 306 respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameParam, networkWatcherNameParam, nil) 307 if respErr := server.GetError(errRespr, req); respErr != nil { 308 return nil, respErr 309 } 310 beginDelete = &respr 311 w.beginDelete.add(req, beginDelete) 312 } 313 314 resp, err := server.PollerResponderNext(beginDelete, req) 315 if err != nil { 316 return nil, err 317 } 318 319 if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { 320 w.beginDelete.remove(req) 321 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} 322 } 323 if !server.PollerResponderMore(beginDelete) { 324 w.beginDelete.remove(req) 325 } 326 327 return resp, nil 328 } 329 330 func (w *WatchersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { 331 if w.srv.Get == nil { 332 return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} 333 } 334 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 335 regex := regexp.MustCompile(regexStr) 336 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 337 if matches == nil || len(matches) < 3 { 338 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 339 } 340 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 341 if err != nil { 342 return nil, err 343 } 344 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 345 if err != nil { 346 return nil, err 347 } 348 respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, networkWatcherNameParam, nil) 349 if respErr := server.GetError(errRespr, req); respErr != nil { 350 return nil, respErr 351 } 352 respContent := server.GetResponseContent(respr) 353 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 354 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 355 } 356 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Watcher, req) 357 if err != nil { 358 return nil, err 359 } 360 return resp, nil 361 } 362 363 func (w *WatchersServerTransport) dispatchBeginGetAzureReachabilityReport(req *http.Request) (*http.Response, error) { 364 if w.srv.BeginGetAzureReachabilityReport == nil { 365 return nil, &nonRetriableError{errors.New("fake for method BeginGetAzureReachabilityReport not implemented")} 366 } 367 beginGetAzureReachabilityReport := w.beginGetAzureReachabilityReport.get(req) 368 if beginGetAzureReachabilityReport == nil { 369 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/azureReachabilityReport` 370 regex := regexp.MustCompile(regexStr) 371 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 372 if matches == nil || len(matches) < 3 { 373 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 374 } 375 body, err := server.UnmarshalRequestAsJSON[armnetwork.AzureReachabilityReportParameters](req) 376 if err != nil { 377 return nil, err 378 } 379 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 380 if err != nil { 381 return nil, err 382 } 383 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 384 if err != nil { 385 return nil, err 386 } 387 respr, errRespr := w.srv.BeginGetAzureReachabilityReport(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 388 if respErr := server.GetError(errRespr, req); respErr != nil { 389 return nil, respErr 390 } 391 beginGetAzureReachabilityReport = &respr 392 w.beginGetAzureReachabilityReport.add(req, beginGetAzureReachabilityReport) 393 } 394 395 resp, err := server.PollerResponderNext(beginGetAzureReachabilityReport, req) 396 if err != nil { 397 return nil, err 398 } 399 400 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 401 w.beginGetAzureReachabilityReport.remove(req) 402 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 403 } 404 if !server.PollerResponderMore(beginGetAzureReachabilityReport) { 405 w.beginGetAzureReachabilityReport.remove(req) 406 } 407 408 return resp, nil 409 } 410 411 func (w *WatchersServerTransport) dispatchBeginGetFlowLogStatus(req *http.Request) (*http.Response, error) { 412 if w.srv.BeginGetFlowLogStatus == nil { 413 return nil, &nonRetriableError{errors.New("fake for method BeginGetFlowLogStatus not implemented")} 414 } 415 beginGetFlowLogStatus := w.beginGetFlowLogStatus.get(req) 416 if beginGetFlowLogStatus == nil { 417 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queryFlowLogStatus` 418 regex := regexp.MustCompile(regexStr) 419 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 420 if matches == nil || len(matches) < 3 { 421 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 422 } 423 body, err := server.UnmarshalRequestAsJSON[armnetwork.FlowLogStatusParameters](req) 424 if err != nil { 425 return nil, err 426 } 427 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 428 if err != nil { 429 return nil, err 430 } 431 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 432 if err != nil { 433 return nil, err 434 } 435 respr, errRespr := w.srv.BeginGetFlowLogStatus(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 436 if respErr := server.GetError(errRespr, req); respErr != nil { 437 return nil, respErr 438 } 439 beginGetFlowLogStatus = &respr 440 w.beginGetFlowLogStatus.add(req, beginGetFlowLogStatus) 441 } 442 443 resp, err := server.PollerResponderNext(beginGetFlowLogStatus, req) 444 if err != nil { 445 return nil, err 446 } 447 448 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 449 w.beginGetFlowLogStatus.remove(req) 450 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 451 } 452 if !server.PollerResponderMore(beginGetFlowLogStatus) { 453 w.beginGetFlowLogStatus.remove(req) 454 } 455 456 return resp, nil 457 } 458 459 func (w *WatchersServerTransport) dispatchBeginGetNetworkConfigurationDiagnostic(req *http.Request) (*http.Response, error) { 460 if w.srv.BeginGetNetworkConfigurationDiagnostic == nil { 461 return nil, &nonRetriableError{errors.New("fake for method BeginGetNetworkConfigurationDiagnostic not implemented")} 462 } 463 beginGetNetworkConfigurationDiagnostic := w.beginGetNetworkConfigurationDiagnostic.get(req) 464 if beginGetNetworkConfigurationDiagnostic == nil { 465 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkConfigurationDiagnostic` 466 regex := regexp.MustCompile(regexStr) 467 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 468 if matches == nil || len(matches) < 3 { 469 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 470 } 471 body, err := server.UnmarshalRequestAsJSON[armnetwork.ConfigurationDiagnosticParameters](req) 472 if err != nil { 473 return nil, err 474 } 475 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 476 if err != nil { 477 return nil, err 478 } 479 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 480 if err != nil { 481 return nil, err 482 } 483 respr, errRespr := w.srv.BeginGetNetworkConfigurationDiagnostic(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 484 if respErr := server.GetError(errRespr, req); respErr != nil { 485 return nil, respErr 486 } 487 beginGetNetworkConfigurationDiagnostic = &respr 488 w.beginGetNetworkConfigurationDiagnostic.add(req, beginGetNetworkConfigurationDiagnostic) 489 } 490 491 resp, err := server.PollerResponderNext(beginGetNetworkConfigurationDiagnostic, req) 492 if err != nil { 493 return nil, err 494 } 495 496 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 497 w.beginGetNetworkConfigurationDiagnostic.remove(req) 498 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 499 } 500 if !server.PollerResponderMore(beginGetNetworkConfigurationDiagnostic) { 501 w.beginGetNetworkConfigurationDiagnostic.remove(req) 502 } 503 504 return resp, nil 505 } 506 507 func (w *WatchersServerTransport) dispatchBeginGetNextHop(req *http.Request) (*http.Response, error) { 508 if w.srv.BeginGetNextHop == nil { 509 return nil, &nonRetriableError{errors.New("fake for method BeginGetNextHop not implemented")} 510 } 511 beginGetNextHop := w.beginGetNextHop.get(req) 512 if beginGetNextHop == nil { 513 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nextHop` 514 regex := regexp.MustCompile(regexStr) 515 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 516 if matches == nil || len(matches) < 3 { 517 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 518 } 519 body, err := server.UnmarshalRequestAsJSON[armnetwork.NextHopParameters](req) 520 if err != nil { 521 return nil, err 522 } 523 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 524 if err != nil { 525 return nil, err 526 } 527 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 528 if err != nil { 529 return nil, err 530 } 531 respr, errRespr := w.srv.BeginGetNextHop(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 532 if respErr := server.GetError(errRespr, req); respErr != nil { 533 return nil, respErr 534 } 535 beginGetNextHop = &respr 536 w.beginGetNextHop.add(req, beginGetNextHop) 537 } 538 539 resp, err := server.PollerResponderNext(beginGetNextHop, req) 540 if err != nil { 541 return nil, err 542 } 543 544 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 545 w.beginGetNextHop.remove(req) 546 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 547 } 548 if !server.PollerResponderMore(beginGetNextHop) { 549 w.beginGetNextHop.remove(req) 550 } 551 552 return resp, nil 553 } 554 555 func (w *WatchersServerTransport) dispatchGetTopology(req *http.Request) (*http.Response, error) { 556 if w.srv.GetTopology == nil { 557 return nil, &nonRetriableError{errors.New("fake for method GetTopology not implemented")} 558 } 559 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topology` 560 regex := regexp.MustCompile(regexStr) 561 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 562 if matches == nil || len(matches) < 3 { 563 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 564 } 565 body, err := server.UnmarshalRequestAsJSON[armnetwork.TopologyParameters](req) 566 if err != nil { 567 return nil, err 568 } 569 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 570 if err != nil { 571 return nil, err 572 } 573 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 574 if err != nil { 575 return nil, err 576 } 577 respr, errRespr := w.srv.GetTopology(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 578 if respErr := server.GetError(errRespr, req); respErr != nil { 579 return nil, respErr 580 } 581 respContent := server.GetResponseContent(respr) 582 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 583 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 584 } 585 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Topology, req) 586 if err != nil { 587 return nil, err 588 } 589 return resp, nil 590 } 591 592 func (w *WatchersServerTransport) dispatchBeginGetTroubleshooting(req *http.Request) (*http.Response, error) { 593 if w.srv.BeginGetTroubleshooting == nil { 594 return nil, &nonRetriableError{errors.New("fake for method BeginGetTroubleshooting not implemented")} 595 } 596 beginGetTroubleshooting := w.beginGetTroubleshooting.get(req) 597 if beginGetTroubleshooting == nil { 598 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/troubleshoot` 599 regex := regexp.MustCompile(regexStr) 600 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 601 if matches == nil || len(matches) < 3 { 602 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 603 } 604 body, err := server.UnmarshalRequestAsJSON[armnetwork.TroubleshootingParameters](req) 605 if err != nil { 606 return nil, err 607 } 608 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 609 if err != nil { 610 return nil, err 611 } 612 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 613 if err != nil { 614 return nil, err 615 } 616 respr, errRespr := w.srv.BeginGetTroubleshooting(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 617 if respErr := server.GetError(errRespr, req); respErr != nil { 618 return nil, respErr 619 } 620 beginGetTroubleshooting = &respr 621 w.beginGetTroubleshooting.add(req, beginGetTroubleshooting) 622 } 623 624 resp, err := server.PollerResponderNext(beginGetTroubleshooting, req) 625 if err != nil { 626 return nil, err 627 } 628 629 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 630 w.beginGetTroubleshooting.remove(req) 631 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 632 } 633 if !server.PollerResponderMore(beginGetTroubleshooting) { 634 w.beginGetTroubleshooting.remove(req) 635 } 636 637 return resp, nil 638 } 639 640 func (w *WatchersServerTransport) dispatchBeginGetTroubleshootingResult(req *http.Request) (*http.Response, error) { 641 if w.srv.BeginGetTroubleshootingResult == nil { 642 return nil, &nonRetriableError{errors.New("fake for method BeginGetTroubleshootingResult not implemented")} 643 } 644 beginGetTroubleshootingResult := w.beginGetTroubleshootingResult.get(req) 645 if beginGetTroubleshootingResult == nil { 646 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queryTroubleshootResult` 647 regex := regexp.MustCompile(regexStr) 648 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 649 if matches == nil || len(matches) < 3 { 650 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 651 } 652 body, err := server.UnmarshalRequestAsJSON[armnetwork.QueryTroubleshootingParameters](req) 653 if err != nil { 654 return nil, err 655 } 656 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 657 if err != nil { 658 return nil, err 659 } 660 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 661 if err != nil { 662 return nil, err 663 } 664 respr, errRespr := w.srv.BeginGetTroubleshootingResult(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 665 if respErr := server.GetError(errRespr, req); respErr != nil { 666 return nil, respErr 667 } 668 beginGetTroubleshootingResult = &respr 669 w.beginGetTroubleshootingResult.add(req, beginGetTroubleshootingResult) 670 } 671 672 resp, err := server.PollerResponderNext(beginGetTroubleshootingResult, req) 673 if err != nil { 674 return nil, err 675 } 676 677 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 678 w.beginGetTroubleshootingResult.remove(req) 679 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 680 } 681 if !server.PollerResponderMore(beginGetTroubleshootingResult) { 682 w.beginGetTroubleshootingResult.remove(req) 683 } 684 685 return resp, nil 686 } 687 688 func (w *WatchersServerTransport) dispatchBeginGetVMSecurityRules(req *http.Request) (*http.Response, error) { 689 if w.srv.BeginGetVMSecurityRules == nil { 690 return nil, &nonRetriableError{errors.New("fake for method BeginGetVMSecurityRules not implemented")} 691 } 692 beginGetVMSecurityRules := w.beginGetVMSecurityRules.get(req) 693 if beginGetVMSecurityRules == nil { 694 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityGroupView` 695 regex := regexp.MustCompile(regexStr) 696 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 697 if matches == nil || len(matches) < 3 { 698 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 699 } 700 body, err := server.UnmarshalRequestAsJSON[armnetwork.SecurityGroupViewParameters](req) 701 if err != nil { 702 return nil, err 703 } 704 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 705 if err != nil { 706 return nil, err 707 } 708 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 709 if err != nil { 710 return nil, err 711 } 712 respr, errRespr := w.srv.BeginGetVMSecurityRules(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 713 if respErr := server.GetError(errRespr, req); respErr != nil { 714 return nil, respErr 715 } 716 beginGetVMSecurityRules = &respr 717 w.beginGetVMSecurityRules.add(req, beginGetVMSecurityRules) 718 } 719 720 resp, err := server.PollerResponderNext(beginGetVMSecurityRules, req) 721 if err != nil { 722 return nil, err 723 } 724 725 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 726 w.beginGetVMSecurityRules.remove(req) 727 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 728 } 729 if !server.PollerResponderMore(beginGetVMSecurityRules) { 730 w.beginGetVMSecurityRules.remove(req) 731 } 732 733 return resp, nil 734 } 735 736 func (w *WatchersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { 737 if w.srv.NewListPager == nil { 738 return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} 739 } 740 newListPager := w.newListPager.get(req) 741 if newListPager == nil { 742 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers` 743 regex := regexp.MustCompile(regexStr) 744 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 745 if matches == nil || len(matches) < 2 { 746 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 747 } 748 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 749 if err != nil { 750 return nil, err 751 } 752 resp := w.srv.NewListPager(resourceGroupNameParam, nil) 753 newListPager = &resp 754 w.newListPager.add(req, newListPager) 755 } 756 resp, err := server.PagerResponderNext(newListPager, req) 757 if err != nil { 758 return nil, err 759 } 760 if !contains([]int{http.StatusOK}, resp.StatusCode) { 761 w.newListPager.remove(req) 762 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 763 } 764 if !server.PagerResponderMore(newListPager) { 765 w.newListPager.remove(req) 766 } 767 return resp, nil 768 } 769 770 func (w *WatchersServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { 771 if w.srv.NewListAllPager == nil { 772 return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} 773 } 774 newListAllPager := w.newListAllPager.get(req) 775 if newListAllPager == nil { 776 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers` 777 regex := regexp.MustCompile(regexStr) 778 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 779 if matches == nil || len(matches) < 1 { 780 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 781 } 782 resp := w.srv.NewListAllPager(nil) 783 newListAllPager = &resp 784 w.newListAllPager.add(req, newListAllPager) 785 } 786 resp, err := server.PagerResponderNext(newListAllPager, req) 787 if err != nil { 788 return nil, err 789 } 790 if !contains([]int{http.StatusOK}, resp.StatusCode) { 791 w.newListAllPager.remove(req) 792 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 793 } 794 if !server.PagerResponderMore(newListAllPager) { 795 w.newListAllPager.remove(req) 796 } 797 return resp, nil 798 } 799 800 func (w *WatchersServerTransport) dispatchBeginListAvailableProviders(req *http.Request) (*http.Response, error) { 801 if w.srv.BeginListAvailableProviders == nil { 802 return nil, &nonRetriableError{errors.New("fake for method BeginListAvailableProviders not implemented")} 803 } 804 beginListAvailableProviders := w.beginListAvailableProviders.get(req) 805 if beginListAvailableProviders == nil { 806 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/availableProvidersList` 807 regex := regexp.MustCompile(regexStr) 808 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 809 if matches == nil || len(matches) < 3 { 810 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 811 } 812 body, err := server.UnmarshalRequestAsJSON[armnetwork.AvailableProvidersListParameters](req) 813 if err != nil { 814 return nil, err 815 } 816 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 817 if err != nil { 818 return nil, err 819 } 820 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 821 if err != nil { 822 return nil, err 823 } 824 respr, errRespr := w.srv.BeginListAvailableProviders(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 825 if respErr := server.GetError(errRespr, req); respErr != nil { 826 return nil, respErr 827 } 828 beginListAvailableProviders = &respr 829 w.beginListAvailableProviders.add(req, beginListAvailableProviders) 830 } 831 832 resp, err := server.PollerResponderNext(beginListAvailableProviders, req) 833 if err != nil { 834 return nil, err 835 } 836 837 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 838 w.beginListAvailableProviders.remove(req) 839 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 840 } 841 if !server.PollerResponderMore(beginListAvailableProviders) { 842 w.beginListAvailableProviders.remove(req) 843 } 844 845 return resp, nil 846 } 847 848 func (w *WatchersServerTransport) dispatchBeginSetFlowLogConfiguration(req *http.Request) (*http.Response, error) { 849 if w.srv.BeginSetFlowLogConfiguration == nil { 850 return nil, &nonRetriableError{errors.New("fake for method BeginSetFlowLogConfiguration not implemented")} 851 } 852 beginSetFlowLogConfiguration := w.beginSetFlowLogConfiguration.get(req) 853 if beginSetFlowLogConfiguration == nil { 854 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/configureFlowLog` 855 regex := regexp.MustCompile(regexStr) 856 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 857 if matches == nil || len(matches) < 3 { 858 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 859 } 860 body, err := server.UnmarshalRequestAsJSON[armnetwork.FlowLogInformation](req) 861 if err != nil { 862 return nil, err 863 } 864 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 865 if err != nil { 866 return nil, err 867 } 868 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 869 if err != nil { 870 return nil, err 871 } 872 respr, errRespr := w.srv.BeginSetFlowLogConfiguration(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 873 if respErr := server.GetError(errRespr, req); respErr != nil { 874 return nil, respErr 875 } 876 beginSetFlowLogConfiguration = &respr 877 w.beginSetFlowLogConfiguration.add(req, beginSetFlowLogConfiguration) 878 } 879 880 resp, err := server.PollerResponderNext(beginSetFlowLogConfiguration, req) 881 if err != nil { 882 return nil, err 883 } 884 885 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 886 w.beginSetFlowLogConfiguration.remove(req) 887 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 888 } 889 if !server.PollerResponderMore(beginSetFlowLogConfiguration) { 890 w.beginSetFlowLogConfiguration.remove(req) 891 } 892 893 return resp, nil 894 } 895 896 func (w *WatchersServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { 897 if w.srv.UpdateTags == nil { 898 return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} 899 } 900 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 901 regex := regexp.MustCompile(regexStr) 902 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 903 if matches == nil || len(matches) < 3 { 904 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 905 } 906 body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req) 907 if err != nil { 908 return nil, err 909 } 910 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 911 if err != nil { 912 return nil, err 913 } 914 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 915 if err != nil { 916 return nil, err 917 } 918 respr, errRespr := w.srv.UpdateTags(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 919 if respErr := server.GetError(errRespr, req); respErr != nil { 920 return nil, respErr 921 } 922 respContent := server.GetResponseContent(respr) 923 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 924 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 925 } 926 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Watcher, req) 927 if err != nil { 928 return nil, err 929 } 930 return resp, nil 931 } 932 933 func (w *WatchersServerTransport) dispatchBeginVerifyIPFlow(req *http.Request) (*http.Response, error) { 934 if w.srv.BeginVerifyIPFlow == nil { 935 return nil, &nonRetriableError{errors.New("fake for method BeginVerifyIPFlow not implemented")} 936 } 937 beginVerifyIPFlow := w.beginVerifyIPFlow.get(req) 938 if beginVerifyIPFlow == nil { 939 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkWatchers/(?P<networkWatcherName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ipFlowVerify` 940 regex := regexp.MustCompile(regexStr) 941 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 942 if matches == nil || len(matches) < 3 { 943 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 944 } 945 body, err := server.UnmarshalRequestAsJSON[armnetwork.VerificationIPFlowParameters](req) 946 if err != nil { 947 return nil, err 948 } 949 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 950 if err != nil { 951 return nil, err 952 } 953 networkWatcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkWatcherName")]) 954 if err != nil { 955 return nil, err 956 } 957 respr, errRespr := w.srv.BeginVerifyIPFlow(req.Context(), resourceGroupNameParam, networkWatcherNameParam, body, nil) 958 if respErr := server.GetError(errRespr, req); respErr != nil { 959 return nil, respErr 960 } 961 beginVerifyIPFlow = &respr 962 w.beginVerifyIPFlow.add(req, beginVerifyIPFlow) 963 } 964 965 resp, err := server.PollerResponderNext(beginVerifyIPFlow, req) 966 if err != nil { 967 return nil, err 968 } 969 970 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 971 w.beginVerifyIPFlow.remove(req) 972 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 973 } 974 if !server.PollerResponderMore(beginVerifyIPFlow) { 975 w.beginVerifyIPFlow.remove(req) 976 } 977 978 return resp, nil 979 }