github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/publicipaddresses_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 // PublicIPAddressesServer is a fake server for instances of the armnetwork.PublicIPAddressesClient type. 26 type PublicIPAddressesServer struct { 27 // BeginCreateOrUpdate is the fake for method PublicIPAddressesClient.BeginCreateOrUpdate 28 // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated 29 BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters armnetwork.PublicIPAddress, options *armnetwork.PublicIPAddressesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetwork.PublicIPAddressesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) 30 31 // BeginDdosProtectionStatus is the fake for method PublicIPAddressesClient.BeginDdosProtectionStatus 32 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 33 BeginDdosProtectionStatus func(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *armnetwork.PublicIPAddressesClientBeginDdosProtectionStatusOptions) (resp azfake.PollerResponder[armnetwork.PublicIPAddressesClientDdosProtectionStatusResponse], errResp azfake.ErrorResponder) 34 35 // BeginDelete is the fake for method PublicIPAddressesClient.BeginDelete 36 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent 37 BeginDelete func(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *armnetwork.PublicIPAddressesClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.PublicIPAddressesClientDeleteResponse], errResp azfake.ErrorResponder) 38 39 // Get is the fake for method PublicIPAddressesClient.Get 40 // HTTP status codes to indicate success: http.StatusOK 41 Get func(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *armnetwork.PublicIPAddressesClientGetOptions) (resp azfake.Responder[armnetwork.PublicIPAddressesClientGetResponse], errResp azfake.ErrorResponder) 42 43 // GetCloudServicePublicIPAddress is the fake for method PublicIPAddressesClient.GetCloudServicePublicIPAddress 44 // HTTP status codes to indicate success: http.StatusOK 45 GetCloudServicePublicIPAddress func(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *armnetwork.PublicIPAddressesClientGetCloudServicePublicIPAddressOptions) (resp azfake.Responder[armnetwork.PublicIPAddressesClientGetCloudServicePublicIPAddressResponse], errResp azfake.ErrorResponder) 46 47 // GetVirtualMachineScaleSetPublicIPAddress is the fake for method PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress 48 // HTTP status codes to indicate success: http.StatusOK 49 GetVirtualMachineScaleSetPublicIPAddress func(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *armnetwork.PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions) (resp azfake.Responder[armnetwork.PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse], errResp azfake.ErrorResponder) 50 51 // NewListPager is the fake for method PublicIPAddressesClient.NewListPager 52 // HTTP status codes to indicate success: http.StatusOK 53 NewListPager func(resourceGroupName string, options *armnetwork.PublicIPAddressesClientListOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListResponse]) 54 55 // NewListAllPager is the fake for method PublicIPAddressesClient.NewListAllPager 56 // HTTP status codes to indicate success: http.StatusOK 57 NewListAllPager func(options *armnetwork.PublicIPAddressesClientListAllOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListAllResponse]) 58 59 // NewListCloudServicePublicIPAddressesPager is the fake for method PublicIPAddressesClient.NewListCloudServicePublicIPAddressesPager 60 // HTTP status codes to indicate success: http.StatusOK 61 NewListCloudServicePublicIPAddressesPager func(resourceGroupName string, cloudServiceName string, options *armnetwork.PublicIPAddressesClientListCloudServicePublicIPAddressesOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServicePublicIPAddressesResponse]) 62 63 // NewListCloudServiceRoleInstancePublicIPAddressesPager is the fake for method PublicIPAddressesClient.NewListCloudServiceRoleInstancePublicIPAddressesPager 64 // HTTP status codes to indicate success: http.StatusOK 65 NewListCloudServiceRoleInstancePublicIPAddressesPager func(resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, options *armnetwork.PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse]) 66 67 // NewListVirtualMachineScaleSetPublicIPAddressesPager is the fake for method PublicIPAddressesClient.NewListVirtualMachineScaleSetPublicIPAddressesPager 68 // HTTP status codes to indicate success: http.StatusOK 69 NewListVirtualMachineScaleSetPublicIPAddressesPager func(resourceGroupName string, virtualMachineScaleSetName string, options *armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse]) 70 71 // NewListVirtualMachineScaleSetVMPublicIPAddressesPager is the fake for method PublicIPAddressesClient.NewListVirtualMachineScaleSetVMPublicIPAddressesPager 72 // HTTP status codes to indicate success: http.StatusOK 73 NewListVirtualMachineScaleSetVMPublicIPAddressesPager func(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions) (resp azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse]) 74 75 // UpdateTags is the fake for method PublicIPAddressesClient.UpdateTags 76 // HTTP status codes to indicate success: http.StatusOK 77 UpdateTags func(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters armnetwork.TagsObject, options *armnetwork.PublicIPAddressesClientUpdateTagsOptions) (resp azfake.Responder[armnetwork.PublicIPAddressesClientUpdateTagsResponse], errResp azfake.ErrorResponder) 78 } 79 80 // NewPublicIPAddressesServerTransport creates a new instance of PublicIPAddressesServerTransport with the provided implementation. 81 // The returned PublicIPAddressesServerTransport instance is connected to an instance of armnetwork.PublicIPAddressesClient via the 82 // azcore.ClientOptions.Transporter field in the client's constructor parameters. 83 func NewPublicIPAddressesServerTransport(srv *PublicIPAddressesServer) *PublicIPAddressesServerTransport { 84 return &PublicIPAddressesServerTransport{ 85 srv: srv, 86 beginCreateOrUpdate: newTracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientCreateOrUpdateResponse]](), 87 beginDdosProtectionStatus: newTracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientDdosProtectionStatusResponse]](), 88 beginDelete: newTracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientDeleteResponse]](), 89 newListPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListResponse]](), 90 newListAllPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListAllResponse]](), 91 newListCloudServicePublicIPAddressesPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServicePublicIPAddressesResponse]](), 92 newListCloudServiceRoleInstancePublicIPAddressesPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse]](), 93 newListVirtualMachineScaleSetPublicIPAddressesPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse]](), 94 newListVirtualMachineScaleSetVMPublicIPAddressesPager: newTracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse]](), 95 } 96 } 97 98 // PublicIPAddressesServerTransport connects instances of armnetwork.PublicIPAddressesClient to instances of PublicIPAddressesServer. 99 // Don't use this type directly, use NewPublicIPAddressesServerTransport instead. 100 type PublicIPAddressesServerTransport struct { 101 srv *PublicIPAddressesServer 102 beginCreateOrUpdate *tracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientCreateOrUpdateResponse]] 103 beginDdosProtectionStatus *tracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientDdosProtectionStatusResponse]] 104 beginDelete *tracker[azfake.PollerResponder[armnetwork.PublicIPAddressesClientDeleteResponse]] 105 newListPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListResponse]] 106 newListAllPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListAllResponse]] 107 newListCloudServicePublicIPAddressesPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServicePublicIPAddressesResponse]] 108 newListCloudServiceRoleInstancePublicIPAddressesPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse]] 109 newListVirtualMachineScaleSetPublicIPAddressesPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse]] 110 newListVirtualMachineScaleSetVMPublicIPAddressesPager *tracker[azfake.PagerResponder[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse]] 111 } 112 113 // Do implements the policy.Transporter interface for PublicIPAddressesServerTransport. 114 func (p *PublicIPAddressesServerTransport) Do(req *http.Request) (*http.Response, error) { 115 rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) 116 method, ok := rawMethod.(string) 117 if !ok { 118 return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} 119 } 120 121 var resp *http.Response 122 var err error 123 124 switch method { 125 case "PublicIPAddressesClient.BeginCreateOrUpdate": 126 resp, err = p.dispatchBeginCreateOrUpdate(req) 127 case "PublicIPAddressesClient.BeginDdosProtectionStatus": 128 resp, err = p.dispatchBeginDdosProtectionStatus(req) 129 case "PublicIPAddressesClient.BeginDelete": 130 resp, err = p.dispatchBeginDelete(req) 131 case "PublicIPAddressesClient.Get": 132 resp, err = p.dispatchGet(req) 133 case "PublicIPAddressesClient.GetCloudServicePublicIPAddress": 134 resp, err = p.dispatchGetCloudServicePublicIPAddress(req) 135 case "PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress": 136 resp, err = p.dispatchGetVirtualMachineScaleSetPublicIPAddress(req) 137 case "PublicIPAddressesClient.NewListPager": 138 resp, err = p.dispatchNewListPager(req) 139 case "PublicIPAddressesClient.NewListAllPager": 140 resp, err = p.dispatchNewListAllPager(req) 141 case "PublicIPAddressesClient.NewListCloudServicePublicIPAddressesPager": 142 resp, err = p.dispatchNewListCloudServicePublicIPAddressesPager(req) 143 case "PublicIPAddressesClient.NewListCloudServiceRoleInstancePublicIPAddressesPager": 144 resp, err = p.dispatchNewListCloudServiceRoleInstancePublicIPAddressesPager(req) 145 case "PublicIPAddressesClient.NewListVirtualMachineScaleSetPublicIPAddressesPager": 146 resp, err = p.dispatchNewListVirtualMachineScaleSetPublicIPAddressesPager(req) 147 case "PublicIPAddressesClient.NewListVirtualMachineScaleSetVMPublicIPAddressesPager": 148 resp, err = p.dispatchNewListVirtualMachineScaleSetVMPublicIPAddressesPager(req) 149 case "PublicIPAddressesClient.UpdateTags": 150 resp, err = p.dispatchUpdateTags(req) 151 default: 152 err = fmt.Errorf("unhandled API %s", method) 153 } 154 155 if err != nil { 156 return nil, err 157 } 158 159 return resp, nil 160 } 161 162 func (p *PublicIPAddressesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { 163 if p.srv.BeginCreateOrUpdate == nil { 164 return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} 165 } 166 beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) 167 if beginCreateOrUpdate == nil { 168 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 169 regex := regexp.MustCompile(regexStr) 170 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 171 if matches == nil || len(matches) < 3 { 172 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 173 } 174 body, err := server.UnmarshalRequestAsJSON[armnetwork.PublicIPAddress](req) 175 if err != nil { 176 return nil, err 177 } 178 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 179 if err != nil { 180 return nil, err 181 } 182 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 183 if err != nil { 184 return nil, err 185 } 186 respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, publicIPAddressNameParam, body, nil) 187 if respErr := server.GetError(errRespr, req); respErr != nil { 188 return nil, respErr 189 } 190 beginCreateOrUpdate = &respr 191 p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) 192 } 193 194 resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) 195 if err != nil { 196 return nil, err 197 } 198 199 if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { 200 p.beginCreateOrUpdate.remove(req) 201 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} 202 } 203 if !server.PollerResponderMore(beginCreateOrUpdate) { 204 p.beginCreateOrUpdate.remove(req) 205 } 206 207 return resp, nil 208 } 209 210 func (p *PublicIPAddressesServerTransport) dispatchBeginDdosProtectionStatus(req *http.Request) (*http.Response, error) { 211 if p.srv.BeginDdosProtectionStatus == nil { 212 return nil, &nonRetriableError{errors.New("fake for method BeginDdosProtectionStatus not implemented")} 213 } 214 beginDdosProtectionStatus := p.beginDdosProtectionStatus.get(req) 215 if beginDdosProtectionStatus == nil { 216 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ddosProtectionStatus` 217 regex := regexp.MustCompile(regexStr) 218 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 219 if matches == nil || len(matches) < 3 { 220 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 221 } 222 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 223 if err != nil { 224 return nil, err 225 } 226 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 227 if err != nil { 228 return nil, err 229 } 230 respr, errRespr := p.srv.BeginDdosProtectionStatus(req.Context(), resourceGroupNameParam, publicIPAddressNameParam, nil) 231 if respErr := server.GetError(errRespr, req); respErr != nil { 232 return nil, respErr 233 } 234 beginDdosProtectionStatus = &respr 235 p.beginDdosProtectionStatus.add(req, beginDdosProtectionStatus) 236 } 237 238 resp, err := server.PollerResponderNext(beginDdosProtectionStatus, req) 239 if err != nil { 240 return nil, err 241 } 242 243 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 244 p.beginDdosProtectionStatus.remove(req) 245 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 246 } 247 if !server.PollerResponderMore(beginDdosProtectionStatus) { 248 p.beginDdosProtectionStatus.remove(req) 249 } 250 251 return resp, nil 252 } 253 254 func (p *PublicIPAddressesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { 255 if p.srv.BeginDelete == nil { 256 return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} 257 } 258 beginDelete := p.beginDelete.get(req) 259 if beginDelete == nil { 260 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 261 regex := regexp.MustCompile(regexStr) 262 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 263 if matches == nil || len(matches) < 3 { 264 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 265 } 266 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 267 if err != nil { 268 return nil, err 269 } 270 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 271 if err != nil { 272 return nil, err 273 } 274 respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, publicIPAddressNameParam, nil) 275 if respErr := server.GetError(errRespr, req); respErr != nil { 276 return nil, respErr 277 } 278 beginDelete = &respr 279 p.beginDelete.add(req, beginDelete) 280 } 281 282 resp, err := server.PollerResponderNext(beginDelete, req) 283 if err != nil { 284 return nil, err 285 } 286 287 if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { 288 p.beginDelete.remove(req) 289 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} 290 } 291 if !server.PollerResponderMore(beginDelete) { 292 p.beginDelete.remove(req) 293 } 294 295 return resp, nil 296 } 297 298 func (p *PublicIPAddressesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { 299 if p.srv.Get == nil { 300 return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} 301 } 302 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 303 regex := regexp.MustCompile(regexStr) 304 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 305 if matches == nil || len(matches) < 3 { 306 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 307 } 308 qp := req.URL.Query() 309 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 310 if err != nil { 311 return nil, err 312 } 313 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 314 if err != nil { 315 return nil, err 316 } 317 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 318 if err != nil { 319 return nil, err 320 } 321 expandParam := getOptional(expandUnescaped) 322 var options *armnetwork.PublicIPAddressesClientGetOptions 323 if expandParam != nil { 324 options = &armnetwork.PublicIPAddressesClientGetOptions{ 325 Expand: expandParam, 326 } 327 } 328 respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, publicIPAddressNameParam, options) 329 if respErr := server.GetError(errRespr, req); respErr != nil { 330 return nil, respErr 331 } 332 respContent := server.GetResponseContent(respr) 333 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 334 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 335 } 336 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PublicIPAddress, req) 337 if err != nil { 338 return nil, err 339 } 340 return resp, nil 341 } 342 343 func (p *PublicIPAddressesServerTransport) dispatchGetCloudServicePublicIPAddress(req *http.Request) (*http.Response, error) { 344 if p.srv.GetCloudServicePublicIPAddress == nil { 345 return nil, &nonRetriableError{errors.New("fake for method GetCloudServicePublicIPAddress not implemented")} 346 } 347 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/cloudServices/(?P<cloudServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/roleInstances/(?P<roleInstanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ipconfigurations/(?P<ipConfigurationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 348 regex := regexp.MustCompile(regexStr) 349 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 350 if matches == nil || len(matches) < 7 { 351 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 352 } 353 qp := req.URL.Query() 354 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 355 if err != nil { 356 return nil, err 357 } 358 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 359 if err != nil { 360 return nil, err 361 } 362 roleInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("roleInstanceName")]) 363 if err != nil { 364 return nil, err 365 } 366 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 367 if err != nil { 368 return nil, err 369 } 370 ipConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ipConfigurationName")]) 371 if err != nil { 372 return nil, err 373 } 374 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 375 if err != nil { 376 return nil, err 377 } 378 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 379 if err != nil { 380 return nil, err 381 } 382 expandParam := getOptional(expandUnescaped) 383 var options *armnetwork.PublicIPAddressesClientGetCloudServicePublicIPAddressOptions 384 if expandParam != nil { 385 options = &armnetwork.PublicIPAddressesClientGetCloudServicePublicIPAddressOptions{ 386 Expand: expandParam, 387 } 388 } 389 respr, errRespr := p.srv.GetCloudServicePublicIPAddress(req.Context(), resourceGroupNameParam, cloudServiceNameParam, roleInstanceNameParam, networkInterfaceNameParam, ipConfigurationNameParam, publicIPAddressNameParam, options) 390 if respErr := server.GetError(errRespr, req); respErr != nil { 391 return nil, respErr 392 } 393 respContent := server.GetResponseContent(respr) 394 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 395 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 396 } 397 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PublicIPAddress, req) 398 if err != nil { 399 return nil, err 400 } 401 return resp, nil 402 } 403 404 func (p *PublicIPAddressesServerTransport) dispatchGetVirtualMachineScaleSetPublicIPAddress(req *http.Request) (*http.Response, error) { 405 if p.srv.GetVirtualMachineScaleSetPublicIPAddress == nil { 406 return nil, &nonRetriableError{errors.New("fake for method GetVirtualMachineScaleSetPublicIPAddress not implemented")} 407 } 408 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/virtualMachineScaleSets/(?P<virtualMachineScaleSetName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachines/(?P<virtualmachineIndex>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ipconfigurations/(?P<ipConfigurationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 409 regex := regexp.MustCompile(regexStr) 410 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 411 if matches == nil || len(matches) < 7 { 412 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 413 } 414 qp := req.URL.Query() 415 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 416 if err != nil { 417 return nil, err 418 } 419 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 420 if err != nil { 421 return nil, err 422 } 423 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 424 if err != nil { 425 return nil, err 426 } 427 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 428 if err != nil { 429 return nil, err 430 } 431 ipConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ipConfigurationName")]) 432 if err != nil { 433 return nil, err 434 } 435 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 436 if err != nil { 437 return nil, err 438 } 439 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 440 if err != nil { 441 return nil, err 442 } 443 expandParam := getOptional(expandUnescaped) 444 var options *armnetwork.PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions 445 if expandParam != nil { 446 options = &armnetwork.PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions{ 447 Expand: expandParam, 448 } 449 } 450 respr, errRespr := p.srv.GetVirtualMachineScaleSetPublicIPAddress(req.Context(), resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, networkInterfaceNameParam, ipConfigurationNameParam, publicIPAddressNameParam, options) 451 if respErr := server.GetError(errRespr, req); respErr != nil { 452 return nil, respErr 453 } 454 respContent := server.GetResponseContent(respr) 455 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 456 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 457 } 458 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PublicIPAddress, req) 459 if err != nil { 460 return nil, err 461 } 462 return resp, nil 463 } 464 465 func (p *PublicIPAddressesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { 466 if p.srv.NewListPager == nil { 467 return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} 468 } 469 newListPager := p.newListPager.get(req) 470 if newListPager == nil { 471 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses` 472 regex := regexp.MustCompile(regexStr) 473 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 474 if matches == nil || len(matches) < 2 { 475 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 476 } 477 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 478 if err != nil { 479 return nil, err 480 } 481 resp := p.srv.NewListPager(resourceGroupNameParam, nil) 482 newListPager = &resp 483 p.newListPager.add(req, newListPager) 484 server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetwork.PublicIPAddressesClientListResponse, createLink func() string) { 485 page.NextLink = to.Ptr(createLink()) 486 }) 487 } 488 resp, err := server.PagerResponderNext(newListPager, req) 489 if err != nil { 490 return nil, err 491 } 492 if !contains([]int{http.StatusOK}, resp.StatusCode) { 493 p.newListPager.remove(req) 494 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 495 } 496 if !server.PagerResponderMore(newListPager) { 497 p.newListPager.remove(req) 498 } 499 return resp, nil 500 } 501 502 func (p *PublicIPAddressesServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { 503 if p.srv.NewListAllPager == nil { 504 return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} 505 } 506 newListAllPager := p.newListAllPager.get(req) 507 if newListAllPager == nil { 508 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses` 509 regex := regexp.MustCompile(regexStr) 510 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 511 if matches == nil || len(matches) < 1 { 512 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 513 } 514 resp := p.srv.NewListAllPager(nil) 515 newListAllPager = &resp 516 p.newListAllPager.add(req, newListAllPager) 517 server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armnetwork.PublicIPAddressesClientListAllResponse, createLink func() string) { 518 page.NextLink = to.Ptr(createLink()) 519 }) 520 } 521 resp, err := server.PagerResponderNext(newListAllPager, req) 522 if err != nil { 523 return nil, err 524 } 525 if !contains([]int{http.StatusOK}, resp.StatusCode) { 526 p.newListAllPager.remove(req) 527 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 528 } 529 if !server.PagerResponderMore(newListAllPager) { 530 p.newListAllPager.remove(req) 531 } 532 return resp, nil 533 } 534 535 func (p *PublicIPAddressesServerTransport) dispatchNewListCloudServicePublicIPAddressesPager(req *http.Request) (*http.Response, error) { 536 if p.srv.NewListCloudServicePublicIPAddressesPager == nil { 537 return nil, &nonRetriableError{errors.New("fake for method NewListCloudServicePublicIPAddressesPager not implemented")} 538 } 539 newListCloudServicePublicIPAddressesPager := p.newListCloudServicePublicIPAddressesPager.get(req) 540 if newListCloudServicePublicIPAddressesPager == nil { 541 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/cloudServices/(?P<cloudServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses` 542 regex := regexp.MustCompile(regexStr) 543 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 544 if matches == nil || len(matches) < 3 { 545 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 546 } 547 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 548 if err != nil { 549 return nil, err 550 } 551 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 552 if err != nil { 553 return nil, err 554 } 555 resp := p.srv.NewListCloudServicePublicIPAddressesPager(resourceGroupNameParam, cloudServiceNameParam, nil) 556 newListCloudServicePublicIPAddressesPager = &resp 557 p.newListCloudServicePublicIPAddressesPager.add(req, newListCloudServicePublicIPAddressesPager) 558 server.PagerResponderInjectNextLinks(newListCloudServicePublicIPAddressesPager, req, func(page *armnetwork.PublicIPAddressesClientListCloudServicePublicIPAddressesResponse, createLink func() string) { 559 page.NextLink = to.Ptr(createLink()) 560 }) 561 } 562 resp, err := server.PagerResponderNext(newListCloudServicePublicIPAddressesPager, req) 563 if err != nil { 564 return nil, err 565 } 566 if !contains([]int{http.StatusOK}, resp.StatusCode) { 567 p.newListCloudServicePublicIPAddressesPager.remove(req) 568 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 569 } 570 if !server.PagerResponderMore(newListCloudServicePublicIPAddressesPager) { 571 p.newListCloudServicePublicIPAddressesPager.remove(req) 572 } 573 return resp, nil 574 } 575 576 func (p *PublicIPAddressesServerTransport) dispatchNewListCloudServiceRoleInstancePublicIPAddressesPager(req *http.Request) (*http.Response, error) { 577 if p.srv.NewListCloudServiceRoleInstancePublicIPAddressesPager == nil { 578 return nil, &nonRetriableError{errors.New("fake for method NewListCloudServiceRoleInstancePublicIPAddressesPager not implemented")} 579 } 580 newListCloudServiceRoleInstancePublicIPAddressesPager := p.newListCloudServiceRoleInstancePublicIPAddressesPager.get(req) 581 if newListCloudServiceRoleInstancePublicIPAddressesPager == nil { 582 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/cloudServices/(?P<cloudServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/roleInstances/(?P<roleInstanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ipconfigurations/(?P<ipConfigurationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses` 583 regex := regexp.MustCompile(regexStr) 584 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 585 if matches == nil || len(matches) < 6 { 586 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 587 } 588 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 589 if err != nil { 590 return nil, err 591 } 592 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 593 if err != nil { 594 return nil, err 595 } 596 roleInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("roleInstanceName")]) 597 if err != nil { 598 return nil, err 599 } 600 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 601 if err != nil { 602 return nil, err 603 } 604 ipConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ipConfigurationName")]) 605 if err != nil { 606 return nil, err 607 } 608 resp := p.srv.NewListCloudServiceRoleInstancePublicIPAddressesPager(resourceGroupNameParam, cloudServiceNameParam, roleInstanceNameParam, networkInterfaceNameParam, ipConfigurationNameParam, nil) 609 newListCloudServiceRoleInstancePublicIPAddressesPager = &resp 610 p.newListCloudServiceRoleInstancePublicIPAddressesPager.add(req, newListCloudServiceRoleInstancePublicIPAddressesPager) 611 server.PagerResponderInjectNextLinks(newListCloudServiceRoleInstancePublicIPAddressesPager, req, func(page *armnetwork.PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse, createLink func() string) { 612 page.NextLink = to.Ptr(createLink()) 613 }) 614 } 615 resp, err := server.PagerResponderNext(newListCloudServiceRoleInstancePublicIPAddressesPager, req) 616 if err != nil { 617 return nil, err 618 } 619 if !contains([]int{http.StatusOK}, resp.StatusCode) { 620 p.newListCloudServiceRoleInstancePublicIPAddressesPager.remove(req) 621 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 622 } 623 if !server.PagerResponderMore(newListCloudServiceRoleInstancePublicIPAddressesPager) { 624 p.newListCloudServiceRoleInstancePublicIPAddressesPager.remove(req) 625 } 626 return resp, nil 627 } 628 629 func (p *PublicIPAddressesServerTransport) dispatchNewListVirtualMachineScaleSetPublicIPAddressesPager(req *http.Request) (*http.Response, error) { 630 if p.srv.NewListVirtualMachineScaleSetPublicIPAddressesPager == nil { 631 return nil, &nonRetriableError{errors.New("fake for method NewListVirtualMachineScaleSetPublicIPAddressesPager not implemented")} 632 } 633 newListVirtualMachineScaleSetPublicIPAddressesPager := p.newListVirtualMachineScaleSetPublicIPAddressesPager.get(req) 634 if newListVirtualMachineScaleSetPublicIPAddressesPager == nil { 635 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/virtualMachineScaleSets/(?P<virtualMachineScaleSetName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses` 636 regex := regexp.MustCompile(regexStr) 637 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 638 if matches == nil || len(matches) < 3 { 639 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 640 } 641 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 642 if err != nil { 643 return nil, err 644 } 645 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 646 if err != nil { 647 return nil, err 648 } 649 resp := p.srv.NewListVirtualMachineScaleSetPublicIPAddressesPager(resourceGroupNameParam, virtualMachineScaleSetNameParam, nil) 650 newListVirtualMachineScaleSetPublicIPAddressesPager = &resp 651 p.newListVirtualMachineScaleSetPublicIPAddressesPager.add(req, newListVirtualMachineScaleSetPublicIPAddressesPager) 652 server.PagerResponderInjectNextLinks(newListVirtualMachineScaleSetPublicIPAddressesPager, req, func(page *armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse, createLink func() string) { 653 page.NextLink = to.Ptr(createLink()) 654 }) 655 } 656 resp, err := server.PagerResponderNext(newListVirtualMachineScaleSetPublicIPAddressesPager, req) 657 if err != nil { 658 return nil, err 659 } 660 if !contains([]int{http.StatusOK}, resp.StatusCode) { 661 p.newListVirtualMachineScaleSetPublicIPAddressesPager.remove(req) 662 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 663 } 664 if !server.PagerResponderMore(newListVirtualMachineScaleSetPublicIPAddressesPager) { 665 p.newListVirtualMachineScaleSetPublicIPAddressesPager.remove(req) 666 } 667 return resp, nil 668 } 669 670 func (p *PublicIPAddressesServerTransport) dispatchNewListVirtualMachineScaleSetVMPublicIPAddressesPager(req *http.Request) (*http.Response, error) { 671 if p.srv.NewListVirtualMachineScaleSetVMPublicIPAddressesPager == nil { 672 return nil, &nonRetriableError{errors.New("fake for method NewListVirtualMachineScaleSetVMPublicIPAddressesPager not implemented")} 673 } 674 newListVirtualMachineScaleSetVMPublicIPAddressesPager := p.newListVirtualMachineScaleSetVMPublicIPAddressesPager.get(req) 675 if newListVirtualMachineScaleSetVMPublicIPAddressesPager == nil { 676 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Compute/virtualMachineScaleSets/(?P<virtualMachineScaleSetName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachines/(?P<virtualmachineIndex>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ipconfigurations/(?P<ipConfigurationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publicipaddresses` 677 regex := regexp.MustCompile(regexStr) 678 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 679 if matches == nil || len(matches) < 6 { 680 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 681 } 682 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 683 if err != nil { 684 return nil, err 685 } 686 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 687 if err != nil { 688 return nil, err 689 } 690 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 691 if err != nil { 692 return nil, err 693 } 694 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 695 if err != nil { 696 return nil, err 697 } 698 ipConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ipConfigurationName")]) 699 if err != nil { 700 return nil, err 701 } 702 resp := p.srv.NewListVirtualMachineScaleSetVMPublicIPAddressesPager(resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, networkInterfaceNameParam, ipConfigurationNameParam, nil) 703 newListVirtualMachineScaleSetVMPublicIPAddressesPager = &resp 704 p.newListVirtualMachineScaleSetVMPublicIPAddressesPager.add(req, newListVirtualMachineScaleSetVMPublicIPAddressesPager) 705 server.PagerResponderInjectNextLinks(newListVirtualMachineScaleSetVMPublicIPAddressesPager, req, func(page *armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse, createLink func() string) { 706 page.NextLink = to.Ptr(createLink()) 707 }) 708 } 709 resp, err := server.PagerResponderNext(newListVirtualMachineScaleSetVMPublicIPAddressesPager, req) 710 if err != nil { 711 return nil, err 712 } 713 if !contains([]int{http.StatusOK}, resp.StatusCode) { 714 p.newListVirtualMachineScaleSetVMPublicIPAddressesPager.remove(req) 715 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 716 } 717 if !server.PagerResponderMore(newListVirtualMachineScaleSetVMPublicIPAddressesPager) { 718 p.newListVirtualMachineScaleSetVMPublicIPAddressesPager.remove(req) 719 } 720 return resp, nil 721 } 722 723 func (p *PublicIPAddressesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { 724 if p.srv.UpdateTags == nil { 725 return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} 726 } 727 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/publicIPAddresses/(?P<publicIpAddressName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 728 regex := regexp.MustCompile(regexStr) 729 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 730 if matches == nil || len(matches) < 3 { 731 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 732 } 733 body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req) 734 if err != nil { 735 return nil, err 736 } 737 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 738 if err != nil { 739 return nil, err 740 } 741 publicIPAddressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicIpAddressName")]) 742 if err != nil { 743 return nil, err 744 } 745 respr, errRespr := p.srv.UpdateTags(req.Context(), resourceGroupNameParam, publicIPAddressNameParam, body, nil) 746 if respErr := server.GetError(errRespr, req); respErr != nil { 747 return nil, respErr 748 } 749 respContent := server.GetResponseContent(respr) 750 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 751 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 752 } 753 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PublicIPAddress, req) 754 if err != nil { 755 return nil, err 756 } 757 return resp, nil 758 }