github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/applicationgateways_server.go (about) 1 //go:build go1.18 2 // +build go1.18 3 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // Licensed under the MIT License. See License.txt in the project root for license information. 6 // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. 7 // Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9 package fake 10 11 import ( 12 "context" 13 "errors" 14 "fmt" 15 azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" 16 "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" 17 "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" 18 "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" 19 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" 20 "net/http" 21 "net/url" 22 "regexp" 23 ) 24 25 // ApplicationGatewaysServer is a fake server for instances of the armnetwork.ApplicationGatewaysClient type. 26 type ApplicationGatewaysServer struct { 27 // BeginBackendHealth is the fake for method ApplicationGatewaysClient.BeginBackendHealth 28 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 29 BeginBackendHealth func(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *armnetwork.ApplicationGatewaysClientBeginBackendHealthOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthResponse], errResp azfake.ErrorResponder) 30 31 // BeginBackendHealthOnDemand is the fake for method ApplicationGatewaysClient.BeginBackendHealthOnDemand 32 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 33 BeginBackendHealthOnDemand func(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest armnetwork.ApplicationGatewayOnDemandProbe, options *armnetwork.ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthOnDemandResponse], errResp azfake.ErrorResponder) 34 35 // BeginCreateOrUpdate is the fake for method ApplicationGatewaysClient.BeginCreateOrUpdate 36 // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated 37 BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters armnetwork.ApplicationGateway, options *armnetwork.ApplicationGatewaysClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) 38 39 // BeginDelete is the fake for method ApplicationGatewaysClient.BeginDelete 40 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent 41 BeginDelete func(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *armnetwork.ApplicationGatewaysClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientDeleteResponse], errResp azfake.ErrorResponder) 42 43 // Get is the fake for method ApplicationGatewaysClient.Get 44 // HTTP status codes to indicate success: http.StatusOK 45 Get func(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *armnetwork.ApplicationGatewaysClientGetOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientGetResponse], errResp azfake.ErrorResponder) 46 47 // GetSSLPredefinedPolicy is the fake for method ApplicationGatewaysClient.GetSSLPredefinedPolicy 48 // HTTP status codes to indicate success: http.StatusOK 49 GetSSLPredefinedPolicy func(ctx context.Context, predefinedPolicyName string, options *armnetwork.ApplicationGatewaysClientGetSSLPredefinedPolicyOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientGetSSLPredefinedPolicyResponse], errResp azfake.ErrorResponder) 50 51 // NewListPager is the fake for method ApplicationGatewaysClient.NewListPager 52 // HTTP status codes to indicate success: http.StatusOK 53 NewListPager func(resourceGroupName string, options *armnetwork.ApplicationGatewaysClientListOptions) (resp azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListResponse]) 54 55 // NewListAllPager is the fake for method ApplicationGatewaysClient.NewListAllPager 56 // HTTP status codes to indicate success: http.StatusOK 57 NewListAllPager func(options *armnetwork.ApplicationGatewaysClientListAllOptions) (resp azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAllResponse]) 58 59 // ListAvailableRequestHeaders is the fake for method ApplicationGatewaysClient.ListAvailableRequestHeaders 60 // HTTP status codes to indicate success: http.StatusOK 61 ListAvailableRequestHeaders func(ctx context.Context, options *armnetwork.ApplicationGatewaysClientListAvailableRequestHeadersOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientListAvailableRequestHeadersResponse], errResp azfake.ErrorResponder) 62 63 // ListAvailableResponseHeaders is the fake for method ApplicationGatewaysClient.ListAvailableResponseHeaders 64 // HTTP status codes to indicate success: http.StatusOK 65 ListAvailableResponseHeaders func(ctx context.Context, options *armnetwork.ApplicationGatewaysClientListAvailableResponseHeadersOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientListAvailableResponseHeadersResponse], errResp azfake.ErrorResponder) 66 67 // ListAvailableSSLOptions is the fake for method ApplicationGatewaysClient.ListAvailableSSLOptions 68 // HTTP status codes to indicate success: http.StatusOK 69 ListAvailableSSLOptions func(ctx context.Context, options *armnetwork.ApplicationGatewaysClientListAvailableSSLOptionsOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientListAvailableSSLOptionsResponse], errResp azfake.ErrorResponder) 70 71 // NewListAvailableSSLPredefinedPoliciesPager is the fake for method ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager 72 // HTTP status codes to indicate success: http.StatusOK 73 NewListAvailableSSLPredefinedPoliciesPager func(options *armnetwork.ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions) (resp azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse]) 74 75 // ListAvailableServerVariables is the fake for method ApplicationGatewaysClient.ListAvailableServerVariables 76 // HTTP status codes to indicate success: http.StatusOK 77 ListAvailableServerVariables func(ctx context.Context, options *armnetwork.ApplicationGatewaysClientListAvailableServerVariablesOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientListAvailableServerVariablesResponse], errResp azfake.ErrorResponder) 78 79 // ListAvailableWafRuleSets is the fake for method ApplicationGatewaysClient.ListAvailableWafRuleSets 80 // HTTP status codes to indicate success: http.StatusOK 81 ListAvailableWafRuleSets func(ctx context.Context, options *armnetwork.ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientListAvailableWafRuleSetsResponse], errResp azfake.ErrorResponder) 82 83 // BeginStart is the fake for method ApplicationGatewaysClient.BeginStart 84 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 85 BeginStart func(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *armnetwork.ApplicationGatewaysClientBeginStartOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStartResponse], errResp azfake.ErrorResponder) 86 87 // BeginStop is the fake for method ApplicationGatewaysClient.BeginStop 88 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 89 BeginStop func(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *armnetwork.ApplicationGatewaysClientBeginStopOptions) (resp azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStopResponse], errResp azfake.ErrorResponder) 90 91 // UpdateTags is the fake for method ApplicationGatewaysClient.UpdateTags 92 // HTTP status codes to indicate success: http.StatusOK 93 UpdateTags func(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters armnetwork.TagsObject, options *armnetwork.ApplicationGatewaysClientUpdateTagsOptions) (resp azfake.Responder[armnetwork.ApplicationGatewaysClientUpdateTagsResponse], errResp azfake.ErrorResponder) 94 } 95 96 // NewApplicationGatewaysServerTransport creates a new instance of ApplicationGatewaysServerTransport with the provided implementation. 97 // The returned ApplicationGatewaysServerTransport instance is connected to an instance of armnetwork.ApplicationGatewaysClient via the 98 // azcore.ClientOptions.Transporter field in the client's constructor parameters. 99 func NewApplicationGatewaysServerTransport(srv *ApplicationGatewaysServer) *ApplicationGatewaysServerTransport { 100 return &ApplicationGatewaysServerTransport{ 101 srv: srv, 102 beginBackendHealth: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthResponse]](), 103 beginBackendHealthOnDemand: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthOnDemandResponse]](), 104 beginCreateOrUpdate: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientCreateOrUpdateResponse]](), 105 beginDelete: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientDeleteResponse]](), 106 newListPager: newTracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListResponse]](), 107 newListAllPager: newTracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAllResponse]](), 108 newListAvailableSSLPredefinedPoliciesPager: newTracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse]](), 109 beginStart: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStartResponse]](), 110 beginStop: newTracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStopResponse]](), 111 } 112 } 113 114 // ApplicationGatewaysServerTransport connects instances of armnetwork.ApplicationGatewaysClient to instances of ApplicationGatewaysServer. 115 // Don't use this type directly, use NewApplicationGatewaysServerTransport instead. 116 type ApplicationGatewaysServerTransport struct { 117 srv *ApplicationGatewaysServer 118 beginBackendHealth *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthResponse]] 119 beginBackendHealthOnDemand *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientBackendHealthOnDemandResponse]] 120 beginCreateOrUpdate *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientCreateOrUpdateResponse]] 121 beginDelete *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientDeleteResponse]] 122 newListPager *tracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListResponse]] 123 newListAllPager *tracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAllResponse]] 124 newListAvailableSSLPredefinedPoliciesPager *tracker[azfake.PagerResponder[armnetwork.ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse]] 125 beginStart *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStartResponse]] 126 beginStop *tracker[azfake.PollerResponder[armnetwork.ApplicationGatewaysClientStopResponse]] 127 } 128 129 // Do implements the policy.Transporter interface for ApplicationGatewaysServerTransport. 130 func (a *ApplicationGatewaysServerTransport) Do(req *http.Request) (*http.Response, error) { 131 rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) 132 method, ok := rawMethod.(string) 133 if !ok { 134 return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} 135 } 136 137 var resp *http.Response 138 var err error 139 140 switch method { 141 case "ApplicationGatewaysClient.BeginBackendHealth": 142 resp, err = a.dispatchBeginBackendHealth(req) 143 case "ApplicationGatewaysClient.BeginBackendHealthOnDemand": 144 resp, err = a.dispatchBeginBackendHealthOnDemand(req) 145 case "ApplicationGatewaysClient.BeginCreateOrUpdate": 146 resp, err = a.dispatchBeginCreateOrUpdate(req) 147 case "ApplicationGatewaysClient.BeginDelete": 148 resp, err = a.dispatchBeginDelete(req) 149 case "ApplicationGatewaysClient.Get": 150 resp, err = a.dispatchGet(req) 151 case "ApplicationGatewaysClient.GetSSLPredefinedPolicy": 152 resp, err = a.dispatchGetSSLPredefinedPolicy(req) 153 case "ApplicationGatewaysClient.NewListPager": 154 resp, err = a.dispatchNewListPager(req) 155 case "ApplicationGatewaysClient.NewListAllPager": 156 resp, err = a.dispatchNewListAllPager(req) 157 case "ApplicationGatewaysClient.ListAvailableRequestHeaders": 158 resp, err = a.dispatchListAvailableRequestHeaders(req) 159 case "ApplicationGatewaysClient.ListAvailableResponseHeaders": 160 resp, err = a.dispatchListAvailableResponseHeaders(req) 161 case "ApplicationGatewaysClient.ListAvailableSSLOptions": 162 resp, err = a.dispatchListAvailableSSLOptions(req) 163 case "ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager": 164 resp, err = a.dispatchNewListAvailableSSLPredefinedPoliciesPager(req) 165 case "ApplicationGatewaysClient.ListAvailableServerVariables": 166 resp, err = a.dispatchListAvailableServerVariables(req) 167 case "ApplicationGatewaysClient.ListAvailableWafRuleSets": 168 resp, err = a.dispatchListAvailableWafRuleSets(req) 169 case "ApplicationGatewaysClient.BeginStart": 170 resp, err = a.dispatchBeginStart(req) 171 case "ApplicationGatewaysClient.BeginStop": 172 resp, err = a.dispatchBeginStop(req) 173 case "ApplicationGatewaysClient.UpdateTags": 174 resp, err = a.dispatchUpdateTags(req) 175 default: 176 err = fmt.Errorf("unhandled API %s", method) 177 } 178 179 if err != nil { 180 return nil, err 181 } 182 183 return resp, nil 184 } 185 186 func (a *ApplicationGatewaysServerTransport) dispatchBeginBackendHealth(req *http.Request) (*http.Response, error) { 187 if a.srv.BeginBackendHealth == nil { 188 return nil, &nonRetriableError{errors.New("fake for method BeginBackendHealth not implemented")} 189 } 190 beginBackendHealth := a.beginBackendHealth.get(req) 191 if beginBackendHealth == nil { 192 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backendhealth` 193 regex := regexp.MustCompile(regexStr) 194 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 195 if matches == nil || len(matches) < 3 { 196 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 197 } 198 qp := req.URL.Query() 199 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 200 if err != nil { 201 return nil, err 202 } 203 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 204 if err != nil { 205 return nil, err 206 } 207 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 208 if err != nil { 209 return nil, err 210 } 211 expandParam := getOptional(expandUnescaped) 212 var options *armnetwork.ApplicationGatewaysClientBeginBackendHealthOptions 213 if expandParam != nil { 214 options = &armnetwork.ApplicationGatewaysClientBeginBackendHealthOptions{ 215 Expand: expandParam, 216 } 217 } 218 respr, errRespr := a.srv.BeginBackendHealth(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, options) 219 if respErr := server.GetError(errRespr, req); respErr != nil { 220 return nil, respErr 221 } 222 beginBackendHealth = &respr 223 a.beginBackendHealth.add(req, beginBackendHealth) 224 } 225 226 resp, err := server.PollerResponderNext(beginBackendHealth, req) 227 if err != nil { 228 return nil, err 229 } 230 231 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 232 a.beginBackendHealth.remove(req) 233 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 234 } 235 if !server.PollerResponderMore(beginBackendHealth) { 236 a.beginBackendHealth.remove(req) 237 } 238 239 return resp, nil 240 } 241 242 func (a *ApplicationGatewaysServerTransport) dispatchBeginBackendHealthOnDemand(req *http.Request) (*http.Response, error) { 243 if a.srv.BeginBackendHealthOnDemand == nil { 244 return nil, &nonRetriableError{errors.New("fake for method BeginBackendHealthOnDemand not implemented")} 245 } 246 beginBackendHealthOnDemand := a.beginBackendHealthOnDemand.get(req) 247 if beginBackendHealthOnDemand == nil { 248 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getBackendHealthOnDemand` 249 regex := regexp.MustCompile(regexStr) 250 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 251 if matches == nil || len(matches) < 3 { 252 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 253 } 254 qp := req.URL.Query() 255 body, err := server.UnmarshalRequestAsJSON[armnetwork.ApplicationGatewayOnDemandProbe](req) 256 if err != nil { 257 return nil, err 258 } 259 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 260 if err != nil { 261 return nil, err 262 } 263 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 264 if err != nil { 265 return nil, err 266 } 267 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 268 if err != nil { 269 return nil, err 270 } 271 expandParam := getOptional(expandUnescaped) 272 var options *armnetwork.ApplicationGatewaysClientBeginBackendHealthOnDemandOptions 273 if expandParam != nil { 274 options = &armnetwork.ApplicationGatewaysClientBeginBackendHealthOnDemandOptions{ 275 Expand: expandParam, 276 } 277 } 278 respr, errRespr := a.srv.BeginBackendHealthOnDemand(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, body, options) 279 if respErr := server.GetError(errRespr, req); respErr != nil { 280 return nil, respErr 281 } 282 beginBackendHealthOnDemand = &respr 283 a.beginBackendHealthOnDemand.add(req, beginBackendHealthOnDemand) 284 } 285 286 resp, err := server.PollerResponderNext(beginBackendHealthOnDemand, req) 287 if err != nil { 288 return nil, err 289 } 290 291 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 292 a.beginBackendHealthOnDemand.remove(req) 293 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 294 } 295 if !server.PollerResponderMore(beginBackendHealthOnDemand) { 296 a.beginBackendHealthOnDemand.remove(req) 297 } 298 299 return resp, nil 300 } 301 302 func (a *ApplicationGatewaysServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { 303 if a.srv.BeginCreateOrUpdate == nil { 304 return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} 305 } 306 beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) 307 if beginCreateOrUpdate == nil { 308 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 309 regex := regexp.MustCompile(regexStr) 310 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 311 if matches == nil || len(matches) < 3 { 312 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 313 } 314 body, err := server.UnmarshalRequestAsJSON[armnetwork.ApplicationGateway](req) 315 if err != nil { 316 return nil, err 317 } 318 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 319 if err != nil { 320 return nil, err 321 } 322 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 323 if err != nil { 324 return nil, err 325 } 326 respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, body, nil) 327 if respErr := server.GetError(errRespr, req); respErr != nil { 328 return nil, respErr 329 } 330 beginCreateOrUpdate = &respr 331 a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) 332 } 333 334 resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) 335 if err != nil { 336 return nil, err 337 } 338 339 if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { 340 a.beginCreateOrUpdate.remove(req) 341 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} 342 } 343 if !server.PollerResponderMore(beginCreateOrUpdate) { 344 a.beginCreateOrUpdate.remove(req) 345 } 346 347 return resp, nil 348 } 349 350 func (a *ApplicationGatewaysServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { 351 if a.srv.BeginDelete == nil { 352 return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} 353 } 354 beginDelete := a.beginDelete.get(req) 355 if beginDelete == nil { 356 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 357 regex := regexp.MustCompile(regexStr) 358 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 359 if matches == nil || len(matches) < 3 { 360 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 361 } 362 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 363 if err != nil { 364 return nil, err 365 } 366 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 367 if err != nil { 368 return nil, err 369 } 370 respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, nil) 371 if respErr := server.GetError(errRespr, req); respErr != nil { 372 return nil, respErr 373 } 374 beginDelete = &respr 375 a.beginDelete.add(req, beginDelete) 376 } 377 378 resp, err := server.PollerResponderNext(beginDelete, req) 379 if err != nil { 380 return nil, err 381 } 382 383 if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { 384 a.beginDelete.remove(req) 385 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} 386 } 387 if !server.PollerResponderMore(beginDelete) { 388 a.beginDelete.remove(req) 389 } 390 391 return resp, nil 392 } 393 394 func (a *ApplicationGatewaysServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { 395 if a.srv.Get == nil { 396 return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} 397 } 398 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 399 regex := regexp.MustCompile(regexStr) 400 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 401 if matches == nil || len(matches) < 3 { 402 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 403 } 404 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 405 if err != nil { 406 return nil, err 407 } 408 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 409 if err != nil { 410 return nil, err 411 } 412 respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, nil) 413 if respErr := server.GetError(errRespr, req); respErr != nil { 414 return nil, respErr 415 } 416 respContent := server.GetResponseContent(respr) 417 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 418 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 419 } 420 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGateway, req) 421 if err != nil { 422 return nil, err 423 } 424 return resp, nil 425 } 426 427 func (a *ApplicationGatewaysServerTransport) dispatchGetSSLPredefinedPolicy(req *http.Request) (*http.Response, error) { 428 if a.srv.GetSSLPredefinedPolicy == nil { 429 return nil, &nonRetriableError{errors.New("fake for method GetSSLPredefinedPolicy not implemented")} 430 } 431 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/(?P<predefinedPolicyName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 432 regex := regexp.MustCompile(regexStr) 433 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 434 if matches == nil || len(matches) < 2 { 435 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 436 } 437 predefinedPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("predefinedPolicyName")]) 438 if err != nil { 439 return nil, err 440 } 441 respr, errRespr := a.srv.GetSSLPredefinedPolicy(req.Context(), predefinedPolicyNameParam, nil) 442 if respErr := server.GetError(errRespr, req); respErr != nil { 443 return nil, respErr 444 } 445 respContent := server.GetResponseContent(respr) 446 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 447 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 448 } 449 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGatewaySSLPredefinedPolicy, req) 450 if err != nil { 451 return nil, err 452 } 453 return resp, nil 454 } 455 456 func (a *ApplicationGatewaysServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { 457 if a.srv.NewListPager == nil { 458 return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} 459 } 460 newListPager := a.newListPager.get(req) 461 if newListPager == nil { 462 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways` 463 regex := regexp.MustCompile(regexStr) 464 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 465 if matches == nil || len(matches) < 2 { 466 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 467 } 468 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 469 if err != nil { 470 return nil, err 471 } 472 resp := a.srv.NewListPager(resourceGroupNameParam, nil) 473 newListPager = &resp 474 a.newListPager.add(req, newListPager) 475 server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetwork.ApplicationGatewaysClientListResponse, createLink func() string) { 476 page.NextLink = to.Ptr(createLink()) 477 }) 478 } 479 resp, err := server.PagerResponderNext(newListPager, req) 480 if err != nil { 481 return nil, err 482 } 483 if !contains([]int{http.StatusOK}, resp.StatusCode) { 484 a.newListPager.remove(req) 485 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 486 } 487 if !server.PagerResponderMore(newListPager) { 488 a.newListPager.remove(req) 489 } 490 return resp, nil 491 } 492 493 func (a *ApplicationGatewaysServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { 494 if a.srv.NewListAllPager == nil { 495 return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} 496 } 497 newListAllPager := a.newListAllPager.get(req) 498 if newListAllPager == nil { 499 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways` 500 regex := regexp.MustCompile(regexStr) 501 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 502 if matches == nil || len(matches) < 1 { 503 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 504 } 505 resp := a.srv.NewListAllPager(nil) 506 newListAllPager = &resp 507 a.newListAllPager.add(req, newListAllPager) 508 server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armnetwork.ApplicationGatewaysClientListAllResponse, createLink func() string) { 509 page.NextLink = to.Ptr(createLink()) 510 }) 511 } 512 resp, err := server.PagerResponderNext(newListAllPager, req) 513 if err != nil { 514 return nil, err 515 } 516 if !contains([]int{http.StatusOK}, resp.StatusCode) { 517 a.newListAllPager.remove(req) 518 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 519 } 520 if !server.PagerResponderMore(newListAllPager) { 521 a.newListAllPager.remove(req) 522 } 523 return resp, nil 524 } 525 526 func (a *ApplicationGatewaysServerTransport) dispatchListAvailableRequestHeaders(req *http.Request) (*http.Response, error) { 527 if a.srv.ListAvailableRequestHeaders == nil { 528 return nil, &nonRetriableError{errors.New("fake for method ListAvailableRequestHeaders not implemented")} 529 } 530 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableRequestHeaders` 531 regex := regexp.MustCompile(regexStr) 532 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 533 if matches == nil || len(matches) < 1 { 534 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 535 } 536 respr, errRespr := a.srv.ListAvailableRequestHeaders(req.Context(), nil) 537 if respErr := server.GetError(errRespr, req); respErr != nil { 538 return nil, respErr 539 } 540 respContent := server.GetResponseContent(respr) 541 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 542 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 543 } 544 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StringArray, req) 545 if err != nil { 546 return nil, err 547 } 548 return resp, nil 549 } 550 551 func (a *ApplicationGatewaysServerTransport) dispatchListAvailableResponseHeaders(req *http.Request) (*http.Response, error) { 552 if a.srv.ListAvailableResponseHeaders == nil { 553 return nil, &nonRetriableError{errors.New("fake for method ListAvailableResponseHeaders not implemented")} 554 } 555 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableResponseHeaders` 556 regex := regexp.MustCompile(regexStr) 557 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 558 if matches == nil || len(matches) < 1 { 559 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 560 } 561 respr, errRespr := a.srv.ListAvailableResponseHeaders(req.Context(), nil) 562 if respErr := server.GetError(errRespr, req); respErr != nil { 563 return nil, respErr 564 } 565 respContent := server.GetResponseContent(respr) 566 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 567 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 568 } 569 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StringArray, req) 570 if err != nil { 571 return nil, err 572 } 573 return resp, nil 574 } 575 576 func (a *ApplicationGatewaysServerTransport) dispatchListAvailableSSLOptions(req *http.Request) (*http.Response, error) { 577 if a.srv.ListAvailableSSLOptions == nil { 578 return nil, &nonRetriableError{errors.New("fake for method ListAvailableSSLOptions not implemented")} 579 } 580 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableSslOptions/default` 581 regex := regexp.MustCompile(regexStr) 582 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 583 if matches == nil || len(matches) < 1 { 584 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 585 } 586 respr, errRespr := a.srv.ListAvailableSSLOptions(req.Context(), nil) 587 if respErr := server.GetError(errRespr, req); respErr != nil { 588 return nil, respErr 589 } 590 respContent := server.GetResponseContent(respr) 591 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 592 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 593 } 594 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGatewayAvailableSSLOptions, req) 595 if err != nil { 596 return nil, err 597 } 598 return resp, nil 599 } 600 601 func (a *ApplicationGatewaysServerTransport) dispatchNewListAvailableSSLPredefinedPoliciesPager(req *http.Request) (*http.Response, error) { 602 if a.srv.NewListAvailableSSLPredefinedPoliciesPager == nil { 603 return nil, &nonRetriableError{errors.New("fake for method NewListAvailableSSLPredefinedPoliciesPager not implemented")} 604 } 605 newListAvailableSSLPredefinedPoliciesPager := a.newListAvailableSSLPredefinedPoliciesPager.get(req) 606 if newListAvailableSSLPredefinedPoliciesPager == nil { 607 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies` 608 regex := regexp.MustCompile(regexStr) 609 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 610 if matches == nil || len(matches) < 1 { 611 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 612 } 613 resp := a.srv.NewListAvailableSSLPredefinedPoliciesPager(nil) 614 newListAvailableSSLPredefinedPoliciesPager = &resp 615 a.newListAvailableSSLPredefinedPoliciesPager.add(req, newListAvailableSSLPredefinedPoliciesPager) 616 server.PagerResponderInjectNextLinks(newListAvailableSSLPredefinedPoliciesPager, req, func(page *armnetwork.ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse, createLink func() string) { 617 page.NextLink = to.Ptr(createLink()) 618 }) 619 } 620 resp, err := server.PagerResponderNext(newListAvailableSSLPredefinedPoliciesPager, req) 621 if err != nil { 622 return nil, err 623 } 624 if !contains([]int{http.StatusOK}, resp.StatusCode) { 625 a.newListAvailableSSLPredefinedPoliciesPager.remove(req) 626 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 627 } 628 if !server.PagerResponderMore(newListAvailableSSLPredefinedPoliciesPager) { 629 a.newListAvailableSSLPredefinedPoliciesPager.remove(req) 630 } 631 return resp, nil 632 } 633 634 func (a *ApplicationGatewaysServerTransport) dispatchListAvailableServerVariables(req *http.Request) (*http.Response, error) { 635 if a.srv.ListAvailableServerVariables == nil { 636 return nil, &nonRetriableError{errors.New("fake for method ListAvailableServerVariables not implemented")} 637 } 638 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableServerVariables` 639 regex := regexp.MustCompile(regexStr) 640 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 641 if matches == nil || len(matches) < 1 { 642 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 643 } 644 respr, errRespr := a.srv.ListAvailableServerVariables(req.Context(), nil) 645 if respErr := server.GetError(errRespr, req); respErr != nil { 646 return nil, respErr 647 } 648 respContent := server.GetResponseContent(respr) 649 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 650 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 651 } 652 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StringArray, req) 653 if err != nil { 654 return nil, err 655 } 656 return resp, nil 657 } 658 659 func (a *ApplicationGatewaysServerTransport) dispatchListAvailableWafRuleSets(req *http.Request) (*http.Response, error) { 660 if a.srv.ListAvailableWafRuleSets == nil { 661 return nil, &nonRetriableError{errors.New("fake for method ListAvailableWafRuleSets not implemented")} 662 } 663 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGatewayAvailableWafRuleSets` 664 regex := regexp.MustCompile(regexStr) 665 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 666 if matches == nil || len(matches) < 1 { 667 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 668 } 669 respr, errRespr := a.srv.ListAvailableWafRuleSets(req.Context(), nil) 670 if respErr := server.GetError(errRespr, req); respErr != nil { 671 return nil, respErr 672 } 673 respContent := server.GetResponseContent(respr) 674 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 675 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 676 } 677 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGatewayAvailableWafRuleSetsResult, req) 678 if err != nil { 679 return nil, err 680 } 681 return resp, nil 682 } 683 684 func (a *ApplicationGatewaysServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { 685 if a.srv.BeginStart == nil { 686 return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} 687 } 688 beginStart := a.beginStart.get(req) 689 if beginStart == nil { 690 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` 691 regex := regexp.MustCompile(regexStr) 692 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 693 if matches == nil || len(matches) < 3 { 694 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 695 } 696 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 697 if err != nil { 698 return nil, err 699 } 700 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 701 if err != nil { 702 return nil, err 703 } 704 respr, errRespr := a.srv.BeginStart(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, nil) 705 if respErr := server.GetError(errRespr, req); respErr != nil { 706 return nil, respErr 707 } 708 beginStart = &respr 709 a.beginStart.add(req, beginStart) 710 } 711 712 resp, err := server.PollerResponderNext(beginStart, req) 713 if err != nil { 714 return nil, err 715 } 716 717 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 718 a.beginStart.remove(req) 719 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 720 } 721 if !server.PollerResponderMore(beginStart) { 722 a.beginStart.remove(req) 723 } 724 725 return resp, nil 726 } 727 728 func (a *ApplicationGatewaysServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { 729 if a.srv.BeginStop == nil { 730 return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} 731 } 732 beginStop := a.beginStop.get(req) 733 if beginStop == nil { 734 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` 735 regex := regexp.MustCompile(regexStr) 736 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 737 if matches == nil || len(matches) < 3 { 738 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 739 } 740 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 741 if err != nil { 742 return nil, err 743 } 744 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 745 if err != nil { 746 return nil, err 747 } 748 respr, errRespr := a.srv.BeginStop(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, nil) 749 if respErr := server.GetError(errRespr, req); respErr != nil { 750 return nil, respErr 751 } 752 beginStop = &respr 753 a.beginStop.add(req, beginStop) 754 } 755 756 resp, err := server.PollerResponderNext(beginStop, req) 757 if err != nil { 758 return nil, err 759 } 760 761 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 762 a.beginStop.remove(req) 763 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 764 } 765 if !server.PollerResponderMore(beginStop) { 766 a.beginStop.remove(req) 767 } 768 769 return resp, nil 770 } 771 772 func (a *ApplicationGatewaysServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { 773 if a.srv.UpdateTags == nil { 774 return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} 775 } 776 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/applicationGateways/(?P<applicationGatewayName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 777 regex := regexp.MustCompile(regexStr) 778 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 779 if matches == nil || len(matches) < 3 { 780 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 781 } 782 body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req) 783 if err != nil { 784 return nil, err 785 } 786 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 787 if err != nil { 788 return nil, err 789 } 790 applicationGatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationGatewayName")]) 791 if err != nil { 792 return nil, err 793 } 794 respr, errRespr := a.srv.UpdateTags(req.Context(), resourceGroupNameParam, applicationGatewayNameParam, body, nil) 795 if respErr := server.GetError(errRespr, req); respErr != nil { 796 return nil, respErr 797 } 798 respContent := server.GetResponseContent(respr) 799 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 800 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 801 } 802 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGateway, req) 803 if err != nil { 804 return nil, err 805 } 806 return resp, nil 807 }