github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/fake/interfaces_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 // InterfacesServer is a fake server for instances of the armnetwork.InterfacesClient type. 26 type InterfacesServer struct { 27 // BeginCreateOrUpdate is the fake for method InterfacesClient.BeginCreateOrUpdate 28 // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated 29 BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters armnetwork.Interface, options *armnetwork.InterfacesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetwork.InterfacesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) 30 31 // BeginDelete is the fake for method InterfacesClient.BeginDelete 32 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent 33 BeginDelete func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetwork.InterfacesClientDeleteResponse], errResp azfake.ErrorResponder) 34 35 // Get is the fake for method InterfacesClient.Get 36 // HTTP status codes to indicate success: http.StatusOK 37 Get func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientGetOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetResponse], errResp azfake.ErrorResponder) 38 39 // GetCloudServiceNetworkInterface is the fake for method InterfacesClient.GetCloudServiceNetworkInterface 40 // HTTP status codes to indicate success: http.StatusOK 41 GetCloudServiceNetworkInterface func(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, options *armnetwork.InterfacesClientGetCloudServiceNetworkInterfaceOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetCloudServiceNetworkInterfaceResponse], errResp azfake.ErrorResponder) 42 43 // BeginGetEffectiveRouteTable is the fake for method InterfacesClient.BeginGetEffectiveRouteTable 44 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 45 BeginGetEffectiveRouteTable func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientBeginGetEffectiveRouteTableOptions) (resp azfake.PollerResponder[armnetwork.InterfacesClientGetEffectiveRouteTableResponse], errResp azfake.ErrorResponder) 46 47 // GetVirtualMachineScaleSetIPConfiguration is the fake for method InterfacesClient.GetVirtualMachineScaleSetIPConfiguration 48 // HTTP status codes to indicate success: http.StatusOK 49 GetVirtualMachineScaleSetIPConfiguration func(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *armnetwork.InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse], errResp azfake.ErrorResponder) 50 51 // GetVirtualMachineScaleSetNetworkInterface is the fake for method InterfacesClient.GetVirtualMachineScaleSetNetworkInterface 52 // HTTP status codes to indicate success: http.StatusOK 53 GetVirtualMachineScaleSetNetworkInterface func(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse], errResp azfake.ErrorResponder) 54 55 // NewListPager is the fake for method InterfacesClient.NewListPager 56 // HTTP status codes to indicate success: http.StatusOK 57 NewListPager func(resourceGroupName string, options *armnetwork.InterfacesClientListOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListResponse]) 58 59 // NewListAllPager is the fake for method InterfacesClient.NewListAllPager 60 // HTTP status codes to indicate success: http.StatusOK 61 NewListAllPager func(options *armnetwork.InterfacesClientListAllOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListAllResponse]) 62 63 // NewListCloudServiceNetworkInterfacesPager is the fake for method InterfacesClient.NewListCloudServiceNetworkInterfacesPager 64 // HTTP status codes to indicate success: http.StatusOK 65 NewListCloudServiceNetworkInterfacesPager func(resourceGroupName string, cloudServiceName string, options *armnetwork.InterfacesClientListCloudServiceNetworkInterfacesOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceNetworkInterfacesResponse]) 66 67 // NewListCloudServiceRoleInstanceNetworkInterfacesPager is the fake for method InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager 68 // HTTP status codes to indicate success: http.StatusOK 69 NewListCloudServiceRoleInstanceNetworkInterfacesPager func(resourceGroupName string, cloudServiceName string, roleInstanceName string, options *armnetwork.InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse]) 70 71 // BeginListEffectiveNetworkSecurityGroups is the fake for method InterfacesClient.BeginListEffectiveNetworkSecurityGroups 72 // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted 73 BeginListEffectiveNetworkSecurityGroups func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (resp azfake.PollerResponder[armnetwork.InterfacesClientListEffectiveNetworkSecurityGroupsResponse], errResp azfake.ErrorResponder) 74 75 // NewListVirtualMachineScaleSetIPConfigurationsPager is the fake for method InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager 76 // HTTP status codes to indicate success: http.StatusOK 77 NewListVirtualMachineScaleSetIPConfigurationsPager func(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse]) 78 79 // NewListVirtualMachineScaleSetNetworkInterfacesPager is the fake for method InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager 80 // HTTP status codes to indicate success: http.StatusOK 81 NewListVirtualMachineScaleSetNetworkInterfacesPager func(resourceGroupName string, virtualMachineScaleSetName string, options *armnetwork.InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse]) 82 83 // NewListVirtualMachineScaleSetVMNetworkInterfacesPager is the fake for method InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager 84 // HTTP status codes to indicate success: http.StatusOK 85 NewListVirtualMachineScaleSetVMNetworkInterfacesPager func(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, options *armnetwork.InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions) (resp azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse]) 86 87 // UpdateTags is the fake for method InterfacesClient.UpdateTags 88 // HTTP status codes to indicate success: http.StatusOK 89 UpdateTags func(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters armnetwork.TagsObject, options *armnetwork.InterfacesClientUpdateTagsOptions) (resp azfake.Responder[armnetwork.InterfacesClientUpdateTagsResponse], errResp azfake.ErrorResponder) 90 } 91 92 // NewInterfacesServerTransport creates a new instance of InterfacesServerTransport with the provided implementation. 93 // The returned InterfacesServerTransport instance is connected to an instance of armnetwork.InterfacesClient via the 94 // azcore.ClientOptions.Transporter field in the client's constructor parameters. 95 func NewInterfacesServerTransport(srv *InterfacesServer) *InterfacesServerTransport { 96 return &InterfacesServerTransport{ 97 srv: srv, 98 beginCreateOrUpdate: newTracker[azfake.PollerResponder[armnetwork.InterfacesClientCreateOrUpdateResponse]](), 99 beginDelete: newTracker[azfake.PollerResponder[armnetwork.InterfacesClientDeleteResponse]](), 100 beginGetEffectiveRouteTable: newTracker[azfake.PollerResponder[armnetwork.InterfacesClientGetEffectiveRouteTableResponse]](), 101 newListPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListResponse]](), 102 newListAllPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListAllResponse]](), 103 newListCloudServiceNetworkInterfacesPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceNetworkInterfacesResponse]](), 104 newListCloudServiceRoleInstanceNetworkInterfacesPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse]](), 105 beginListEffectiveNetworkSecurityGroups: newTracker[azfake.PollerResponder[armnetwork.InterfacesClientListEffectiveNetworkSecurityGroupsResponse]](), 106 newListVirtualMachineScaleSetIPConfigurationsPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse]](), 107 newListVirtualMachineScaleSetNetworkInterfacesPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse]](), 108 newListVirtualMachineScaleSetVMNetworkInterfacesPager: newTracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse]](), 109 } 110 } 111 112 // InterfacesServerTransport connects instances of armnetwork.InterfacesClient to instances of InterfacesServer. 113 // Don't use this type directly, use NewInterfacesServerTransport instead. 114 type InterfacesServerTransport struct { 115 srv *InterfacesServer 116 beginCreateOrUpdate *tracker[azfake.PollerResponder[armnetwork.InterfacesClientCreateOrUpdateResponse]] 117 beginDelete *tracker[azfake.PollerResponder[armnetwork.InterfacesClientDeleteResponse]] 118 beginGetEffectiveRouteTable *tracker[azfake.PollerResponder[armnetwork.InterfacesClientGetEffectiveRouteTableResponse]] 119 newListPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListResponse]] 120 newListAllPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListAllResponse]] 121 newListCloudServiceNetworkInterfacesPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceNetworkInterfacesResponse]] 122 newListCloudServiceRoleInstanceNetworkInterfacesPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse]] 123 beginListEffectiveNetworkSecurityGroups *tracker[azfake.PollerResponder[armnetwork.InterfacesClientListEffectiveNetworkSecurityGroupsResponse]] 124 newListVirtualMachineScaleSetIPConfigurationsPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse]] 125 newListVirtualMachineScaleSetNetworkInterfacesPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse]] 126 newListVirtualMachineScaleSetVMNetworkInterfacesPager *tracker[azfake.PagerResponder[armnetwork.InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse]] 127 } 128 129 // Do implements the policy.Transporter interface for InterfacesServerTransport. 130 func (i *InterfacesServerTransport) 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 "InterfacesClient.BeginCreateOrUpdate": 142 resp, err = i.dispatchBeginCreateOrUpdate(req) 143 case "InterfacesClient.BeginDelete": 144 resp, err = i.dispatchBeginDelete(req) 145 case "InterfacesClient.Get": 146 resp, err = i.dispatchGet(req) 147 case "InterfacesClient.GetCloudServiceNetworkInterface": 148 resp, err = i.dispatchGetCloudServiceNetworkInterface(req) 149 case "InterfacesClient.BeginGetEffectiveRouteTable": 150 resp, err = i.dispatchBeginGetEffectiveRouteTable(req) 151 case "InterfacesClient.GetVirtualMachineScaleSetIPConfiguration": 152 resp, err = i.dispatchGetVirtualMachineScaleSetIPConfiguration(req) 153 case "InterfacesClient.GetVirtualMachineScaleSetNetworkInterface": 154 resp, err = i.dispatchGetVirtualMachineScaleSetNetworkInterface(req) 155 case "InterfacesClient.NewListPager": 156 resp, err = i.dispatchNewListPager(req) 157 case "InterfacesClient.NewListAllPager": 158 resp, err = i.dispatchNewListAllPager(req) 159 case "InterfacesClient.NewListCloudServiceNetworkInterfacesPager": 160 resp, err = i.dispatchNewListCloudServiceNetworkInterfacesPager(req) 161 case "InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager": 162 resp, err = i.dispatchNewListCloudServiceRoleInstanceNetworkInterfacesPager(req) 163 case "InterfacesClient.BeginListEffectiveNetworkSecurityGroups": 164 resp, err = i.dispatchBeginListEffectiveNetworkSecurityGroups(req) 165 case "InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager": 166 resp, err = i.dispatchNewListVirtualMachineScaleSetIPConfigurationsPager(req) 167 case "InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager": 168 resp, err = i.dispatchNewListVirtualMachineScaleSetNetworkInterfacesPager(req) 169 case "InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager": 170 resp, err = i.dispatchNewListVirtualMachineScaleSetVMNetworkInterfacesPager(req) 171 case "InterfacesClient.UpdateTags": 172 resp, err = i.dispatchUpdateTags(req) 173 default: 174 err = fmt.Errorf("unhandled API %s", method) 175 } 176 177 if err != nil { 178 return nil, err 179 } 180 181 return resp, nil 182 } 183 184 func (i *InterfacesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { 185 if i.srv.BeginCreateOrUpdate == nil { 186 return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} 187 } 188 beginCreateOrUpdate := i.beginCreateOrUpdate.get(req) 189 if beginCreateOrUpdate == nil { 190 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 191 regex := regexp.MustCompile(regexStr) 192 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 193 if matches == nil || len(matches) < 3 { 194 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 195 } 196 body, err := server.UnmarshalRequestAsJSON[armnetwork.Interface](req) 197 if err != nil { 198 return nil, err 199 } 200 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 201 if err != nil { 202 return nil, err 203 } 204 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 205 if err != nil { 206 return nil, err 207 } 208 respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, body, nil) 209 if respErr := server.GetError(errRespr, req); respErr != nil { 210 return nil, respErr 211 } 212 beginCreateOrUpdate = &respr 213 i.beginCreateOrUpdate.add(req, beginCreateOrUpdate) 214 } 215 216 resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) 217 if err != nil { 218 return nil, err 219 } 220 221 if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { 222 i.beginCreateOrUpdate.remove(req) 223 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} 224 } 225 if !server.PollerResponderMore(beginCreateOrUpdate) { 226 i.beginCreateOrUpdate.remove(req) 227 } 228 229 return resp, nil 230 } 231 232 func (i *InterfacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { 233 if i.srv.BeginDelete == nil { 234 return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} 235 } 236 beginDelete := i.beginDelete.get(req) 237 if beginDelete == nil { 238 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 239 regex := regexp.MustCompile(regexStr) 240 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 241 if matches == nil || len(matches) < 3 { 242 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 243 } 244 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 245 if err != nil { 246 return nil, err 247 } 248 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 249 if err != nil { 250 return nil, err 251 } 252 respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, nil) 253 if respErr := server.GetError(errRespr, req); respErr != nil { 254 return nil, respErr 255 } 256 beginDelete = &respr 257 i.beginDelete.add(req, beginDelete) 258 } 259 260 resp, err := server.PollerResponderNext(beginDelete, req) 261 if err != nil { 262 return nil, err 263 } 264 265 if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { 266 i.beginDelete.remove(req) 267 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} 268 } 269 if !server.PollerResponderMore(beginDelete) { 270 i.beginDelete.remove(req) 271 } 272 273 return resp, nil 274 } 275 276 func (i *InterfacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { 277 if i.srv.Get == nil { 278 return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} 279 } 280 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 281 regex := regexp.MustCompile(regexStr) 282 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 283 if matches == nil || len(matches) < 3 { 284 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 285 } 286 qp := req.URL.Query() 287 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 288 if err != nil { 289 return nil, err 290 } 291 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 292 if err != nil { 293 return nil, err 294 } 295 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 296 if err != nil { 297 return nil, err 298 } 299 expandParam := getOptional(expandUnescaped) 300 var options *armnetwork.InterfacesClientGetOptions 301 if expandParam != nil { 302 options = &armnetwork.InterfacesClientGetOptions{ 303 Expand: expandParam, 304 } 305 } 306 respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, options) 307 if respErr := server.GetError(errRespr, req); respErr != nil { 308 return nil, respErr 309 } 310 respContent := server.GetResponseContent(respr) 311 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 312 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 313 } 314 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Interface, req) 315 if err != nil { 316 return nil, err 317 } 318 return resp, nil 319 } 320 321 func (i *InterfacesServerTransport) dispatchGetCloudServiceNetworkInterface(req *http.Request) (*http.Response, error) { 322 if i.srv.GetCloudServiceNetworkInterface == nil { 323 return nil, &nonRetriableError{errors.New("fake for method GetCloudServiceNetworkInterface not implemented")} 324 } 325 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~%@]+)` 326 regex := regexp.MustCompile(regexStr) 327 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 328 if matches == nil || len(matches) < 5 { 329 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 330 } 331 qp := req.URL.Query() 332 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 333 if err != nil { 334 return nil, err 335 } 336 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 337 if err != nil { 338 return nil, err 339 } 340 roleInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("roleInstanceName")]) 341 if err != nil { 342 return nil, err 343 } 344 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 345 if err != nil { 346 return nil, err 347 } 348 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 349 if err != nil { 350 return nil, err 351 } 352 expandParam := getOptional(expandUnescaped) 353 var options *armnetwork.InterfacesClientGetCloudServiceNetworkInterfaceOptions 354 if expandParam != nil { 355 options = &armnetwork.InterfacesClientGetCloudServiceNetworkInterfaceOptions{ 356 Expand: expandParam, 357 } 358 } 359 respr, errRespr := i.srv.GetCloudServiceNetworkInterface(req.Context(), resourceGroupNameParam, cloudServiceNameParam, roleInstanceNameParam, networkInterfaceNameParam, options) 360 if respErr := server.GetError(errRespr, req); respErr != nil { 361 return nil, respErr 362 } 363 respContent := server.GetResponseContent(respr) 364 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 365 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 366 } 367 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Interface, req) 368 if err != nil { 369 return nil, err 370 } 371 return resp, nil 372 } 373 374 func (i *InterfacesServerTransport) dispatchBeginGetEffectiveRouteTable(req *http.Request) (*http.Response, error) { 375 if i.srv.BeginGetEffectiveRouteTable == nil { 376 return nil, &nonRetriableError{errors.New("fake for method BeginGetEffectiveRouteTable not implemented")} 377 } 378 beginGetEffectiveRouteTable := i.beginGetEffectiveRouteTable.get(req) 379 if beginGetEffectiveRouteTable == nil { 380 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/effectiveRouteTable` 381 regex := regexp.MustCompile(regexStr) 382 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 383 if matches == nil || len(matches) < 3 { 384 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 385 } 386 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 387 if err != nil { 388 return nil, err 389 } 390 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 391 if err != nil { 392 return nil, err 393 } 394 respr, errRespr := i.srv.BeginGetEffectiveRouteTable(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, nil) 395 if respErr := server.GetError(errRespr, req); respErr != nil { 396 return nil, respErr 397 } 398 beginGetEffectiveRouteTable = &respr 399 i.beginGetEffectiveRouteTable.add(req, beginGetEffectiveRouteTable) 400 } 401 402 resp, err := server.PollerResponderNext(beginGetEffectiveRouteTable, req) 403 if err != nil { 404 return nil, err 405 } 406 407 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 408 i.beginGetEffectiveRouteTable.remove(req) 409 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} 410 } 411 if !server.PollerResponderMore(beginGetEffectiveRouteTable) { 412 i.beginGetEffectiveRouteTable.remove(req) 413 } 414 415 return resp, nil 416 } 417 418 func (i *InterfacesServerTransport) dispatchGetVirtualMachineScaleSetIPConfiguration(req *http.Request) (*http.Response, error) { 419 if i.srv.GetVirtualMachineScaleSetIPConfiguration == nil { 420 return nil, &nonRetriableError{errors.New("fake for method GetVirtualMachineScaleSetIPConfiguration not implemented")} 421 } 422 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~%@]+)` 423 regex := regexp.MustCompile(regexStr) 424 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 425 if matches == nil || len(matches) < 6 { 426 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 427 } 428 qp := req.URL.Query() 429 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 430 if err != nil { 431 return nil, err 432 } 433 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 434 if err != nil { 435 return nil, err 436 } 437 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 438 if err != nil { 439 return nil, err 440 } 441 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 442 if err != nil { 443 return nil, err 444 } 445 ipConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ipConfigurationName")]) 446 if err != nil { 447 return nil, err 448 } 449 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 450 if err != nil { 451 return nil, err 452 } 453 expandParam := getOptional(expandUnescaped) 454 var options *armnetwork.InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions 455 if expandParam != nil { 456 options = &armnetwork.InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions{ 457 Expand: expandParam, 458 } 459 } 460 respr, errRespr := i.srv.GetVirtualMachineScaleSetIPConfiguration(req.Context(), resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, networkInterfaceNameParam, ipConfigurationNameParam, options) 461 if respErr := server.GetError(errRespr, req); respErr != nil { 462 return nil, respErr 463 } 464 respContent := server.GetResponseContent(respr) 465 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 466 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 467 } 468 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InterfaceIPConfiguration, req) 469 if err != nil { 470 return nil, err 471 } 472 return resp, nil 473 } 474 475 func (i *InterfacesServerTransport) dispatchGetVirtualMachineScaleSetNetworkInterface(req *http.Request) (*http.Response, error) { 476 if i.srv.GetVirtualMachineScaleSetNetworkInterface == nil { 477 return nil, &nonRetriableError{errors.New("fake for method GetVirtualMachineScaleSetNetworkInterface not implemented")} 478 } 479 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~%@]+)` 480 regex := regexp.MustCompile(regexStr) 481 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 482 if matches == nil || len(matches) < 5 { 483 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 484 } 485 qp := req.URL.Query() 486 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 487 if err != nil { 488 return nil, err 489 } 490 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 491 if err != nil { 492 return nil, err 493 } 494 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 495 if err != nil { 496 return nil, err 497 } 498 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 499 if err != nil { 500 return nil, err 501 } 502 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 503 if err != nil { 504 return nil, err 505 } 506 expandParam := getOptional(expandUnescaped) 507 var options *armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions 508 if expandParam != nil { 509 options = &armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions{ 510 Expand: expandParam, 511 } 512 } 513 respr, errRespr := i.srv.GetVirtualMachineScaleSetNetworkInterface(req.Context(), resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, networkInterfaceNameParam, options) 514 if respErr := server.GetError(errRespr, req); respErr != nil { 515 return nil, respErr 516 } 517 respContent := server.GetResponseContent(respr) 518 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 519 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 520 } 521 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Interface, req) 522 if err != nil { 523 return nil, err 524 } 525 return resp, nil 526 } 527 528 func (i *InterfacesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { 529 if i.srv.NewListPager == nil { 530 return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} 531 } 532 newListPager := i.newListPager.get(req) 533 if newListPager == nil { 534 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces` 535 regex := regexp.MustCompile(regexStr) 536 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 537 if matches == nil || len(matches) < 2 { 538 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 539 } 540 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 541 if err != nil { 542 return nil, err 543 } 544 resp := i.srv.NewListPager(resourceGroupNameParam, nil) 545 newListPager = &resp 546 i.newListPager.add(req, newListPager) 547 server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetwork.InterfacesClientListResponse, createLink func() string) { 548 page.NextLink = to.Ptr(createLink()) 549 }) 550 } 551 resp, err := server.PagerResponderNext(newListPager, req) 552 if err != nil { 553 return nil, err 554 } 555 if !contains([]int{http.StatusOK}, resp.StatusCode) { 556 i.newListPager.remove(req) 557 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 558 } 559 if !server.PagerResponderMore(newListPager) { 560 i.newListPager.remove(req) 561 } 562 return resp, nil 563 } 564 565 func (i *InterfacesServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { 566 if i.srv.NewListAllPager == nil { 567 return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} 568 } 569 newListAllPager := i.newListAllPager.get(req) 570 if newListAllPager == nil { 571 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces` 572 regex := regexp.MustCompile(regexStr) 573 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 574 if matches == nil || len(matches) < 1 { 575 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 576 } 577 resp := i.srv.NewListAllPager(nil) 578 newListAllPager = &resp 579 i.newListAllPager.add(req, newListAllPager) 580 server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armnetwork.InterfacesClientListAllResponse, createLink func() string) { 581 page.NextLink = to.Ptr(createLink()) 582 }) 583 } 584 resp, err := server.PagerResponderNext(newListAllPager, req) 585 if err != nil { 586 return nil, err 587 } 588 if !contains([]int{http.StatusOK}, resp.StatusCode) { 589 i.newListAllPager.remove(req) 590 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 591 } 592 if !server.PagerResponderMore(newListAllPager) { 593 i.newListAllPager.remove(req) 594 } 595 return resp, nil 596 } 597 598 func (i *InterfacesServerTransport) dispatchNewListCloudServiceNetworkInterfacesPager(req *http.Request) (*http.Response, error) { 599 if i.srv.NewListCloudServiceNetworkInterfacesPager == nil { 600 return nil, &nonRetriableError{errors.New("fake for method NewListCloudServiceNetworkInterfacesPager not implemented")} 601 } 602 newListCloudServiceNetworkInterfacesPager := i.newListCloudServiceNetworkInterfacesPager.get(req) 603 if newListCloudServiceNetworkInterfacesPager == nil { 604 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~%@]+)/networkInterfaces` 605 regex := regexp.MustCompile(regexStr) 606 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 607 if matches == nil || len(matches) < 3 { 608 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 609 } 610 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 611 if err != nil { 612 return nil, err 613 } 614 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 615 if err != nil { 616 return nil, err 617 } 618 resp := i.srv.NewListCloudServiceNetworkInterfacesPager(resourceGroupNameParam, cloudServiceNameParam, nil) 619 newListCloudServiceNetworkInterfacesPager = &resp 620 i.newListCloudServiceNetworkInterfacesPager.add(req, newListCloudServiceNetworkInterfacesPager) 621 server.PagerResponderInjectNextLinks(newListCloudServiceNetworkInterfacesPager, req, func(page *armnetwork.InterfacesClientListCloudServiceNetworkInterfacesResponse, createLink func() string) { 622 page.NextLink = to.Ptr(createLink()) 623 }) 624 } 625 resp, err := server.PagerResponderNext(newListCloudServiceNetworkInterfacesPager, req) 626 if err != nil { 627 return nil, err 628 } 629 if !contains([]int{http.StatusOK}, resp.StatusCode) { 630 i.newListCloudServiceNetworkInterfacesPager.remove(req) 631 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 632 } 633 if !server.PagerResponderMore(newListCloudServiceNetworkInterfacesPager) { 634 i.newListCloudServiceNetworkInterfacesPager.remove(req) 635 } 636 return resp, nil 637 } 638 639 func (i *InterfacesServerTransport) dispatchNewListCloudServiceRoleInstanceNetworkInterfacesPager(req *http.Request) (*http.Response, error) { 640 if i.srv.NewListCloudServiceRoleInstanceNetworkInterfacesPager == nil { 641 return nil, &nonRetriableError{errors.New("fake for method NewListCloudServiceRoleInstanceNetworkInterfacesPager not implemented")} 642 } 643 newListCloudServiceRoleInstanceNetworkInterfacesPager := i.newListCloudServiceRoleInstanceNetworkInterfacesPager.get(req) 644 if newListCloudServiceRoleInstanceNetworkInterfacesPager == nil { 645 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` 646 regex := regexp.MustCompile(regexStr) 647 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 648 if matches == nil || len(matches) < 4 { 649 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 650 } 651 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 652 if err != nil { 653 return nil, err 654 } 655 cloudServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudServiceName")]) 656 if err != nil { 657 return nil, err 658 } 659 roleInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("roleInstanceName")]) 660 if err != nil { 661 return nil, err 662 } 663 resp := i.srv.NewListCloudServiceRoleInstanceNetworkInterfacesPager(resourceGroupNameParam, cloudServiceNameParam, roleInstanceNameParam, nil) 664 newListCloudServiceRoleInstanceNetworkInterfacesPager = &resp 665 i.newListCloudServiceRoleInstanceNetworkInterfacesPager.add(req, newListCloudServiceRoleInstanceNetworkInterfacesPager) 666 server.PagerResponderInjectNextLinks(newListCloudServiceRoleInstanceNetworkInterfacesPager, req, func(page *armnetwork.InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse, createLink func() string) { 667 page.NextLink = to.Ptr(createLink()) 668 }) 669 } 670 resp, err := server.PagerResponderNext(newListCloudServiceRoleInstanceNetworkInterfacesPager, req) 671 if err != nil { 672 return nil, err 673 } 674 if !contains([]int{http.StatusOK}, resp.StatusCode) { 675 i.newListCloudServiceRoleInstanceNetworkInterfacesPager.remove(req) 676 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 677 } 678 if !server.PagerResponderMore(newListCloudServiceRoleInstanceNetworkInterfacesPager) { 679 i.newListCloudServiceRoleInstanceNetworkInterfacesPager.remove(req) 680 } 681 return resp, nil 682 } 683 684 func (i *InterfacesServerTransport) dispatchBeginListEffectiveNetworkSecurityGroups(req *http.Request) (*http.Response, error) { 685 if i.srv.BeginListEffectiveNetworkSecurityGroups == nil { 686 return nil, &nonRetriableError{errors.New("fake for method BeginListEffectiveNetworkSecurityGroups not implemented")} 687 } 688 beginListEffectiveNetworkSecurityGroups := i.beginListEffectiveNetworkSecurityGroups.get(req) 689 if beginListEffectiveNetworkSecurityGroups == nil { 690 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/effectiveNetworkSecurityGroups` 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 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 701 if err != nil { 702 return nil, err 703 } 704 respr, errRespr := i.srv.BeginListEffectiveNetworkSecurityGroups(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, nil) 705 if respErr := server.GetError(errRespr, req); respErr != nil { 706 return nil, respErr 707 } 708 beginListEffectiveNetworkSecurityGroups = &respr 709 i.beginListEffectiveNetworkSecurityGroups.add(req, beginListEffectiveNetworkSecurityGroups) 710 } 711 712 resp, err := server.PollerResponderNext(beginListEffectiveNetworkSecurityGroups, req) 713 if err != nil { 714 return nil, err 715 } 716 717 if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { 718 i.beginListEffectiveNetworkSecurityGroups.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(beginListEffectiveNetworkSecurityGroups) { 722 i.beginListEffectiveNetworkSecurityGroups.remove(req) 723 } 724 725 return resp, nil 726 } 727 728 func (i *InterfacesServerTransport) dispatchNewListVirtualMachineScaleSetIPConfigurationsPager(req *http.Request) (*http.Response, error) { 729 if i.srv.NewListVirtualMachineScaleSetIPConfigurationsPager == nil { 730 return nil, &nonRetriableError{errors.New("fake for method NewListVirtualMachineScaleSetIPConfigurationsPager not implemented")} 731 } 732 newListVirtualMachineScaleSetIPConfigurationsPager := i.newListVirtualMachineScaleSetIPConfigurationsPager.get(req) 733 if newListVirtualMachineScaleSetIPConfigurationsPager == nil { 734 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` 735 regex := regexp.MustCompile(regexStr) 736 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 737 if matches == nil || len(matches) < 5 { 738 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 739 } 740 qp := req.URL.Query() 741 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 742 if err != nil { 743 return nil, err 744 } 745 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 746 if err != nil { 747 return nil, err 748 } 749 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 750 if err != nil { 751 return nil, err 752 } 753 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 754 if err != nil { 755 return nil, err 756 } 757 expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) 758 if err != nil { 759 return nil, err 760 } 761 expandParam := getOptional(expandUnescaped) 762 var options *armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions 763 if expandParam != nil { 764 options = &armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions{ 765 Expand: expandParam, 766 } 767 } 768 resp := i.srv.NewListVirtualMachineScaleSetIPConfigurationsPager(resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, networkInterfaceNameParam, options) 769 newListVirtualMachineScaleSetIPConfigurationsPager = &resp 770 i.newListVirtualMachineScaleSetIPConfigurationsPager.add(req, newListVirtualMachineScaleSetIPConfigurationsPager) 771 server.PagerResponderInjectNextLinks(newListVirtualMachineScaleSetIPConfigurationsPager, req, func(page *armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse, createLink func() string) { 772 page.NextLink = to.Ptr(createLink()) 773 }) 774 } 775 resp, err := server.PagerResponderNext(newListVirtualMachineScaleSetIPConfigurationsPager, req) 776 if err != nil { 777 return nil, err 778 } 779 if !contains([]int{http.StatusOK}, resp.StatusCode) { 780 i.newListVirtualMachineScaleSetIPConfigurationsPager.remove(req) 781 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 782 } 783 if !server.PagerResponderMore(newListVirtualMachineScaleSetIPConfigurationsPager) { 784 i.newListVirtualMachineScaleSetIPConfigurationsPager.remove(req) 785 } 786 return resp, nil 787 } 788 789 func (i *InterfacesServerTransport) dispatchNewListVirtualMachineScaleSetNetworkInterfacesPager(req *http.Request) (*http.Response, error) { 790 if i.srv.NewListVirtualMachineScaleSetNetworkInterfacesPager == nil { 791 return nil, &nonRetriableError{errors.New("fake for method NewListVirtualMachineScaleSetNetworkInterfacesPager not implemented")} 792 } 793 newListVirtualMachineScaleSetNetworkInterfacesPager := i.newListVirtualMachineScaleSetNetworkInterfacesPager.get(req) 794 if newListVirtualMachineScaleSetNetworkInterfacesPager == nil { 795 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~%@]+)/networkInterfaces` 796 regex := regexp.MustCompile(regexStr) 797 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 798 if matches == nil || len(matches) < 3 { 799 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 800 } 801 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 802 if err != nil { 803 return nil, err 804 } 805 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 806 if err != nil { 807 return nil, err 808 } 809 resp := i.srv.NewListVirtualMachineScaleSetNetworkInterfacesPager(resourceGroupNameParam, virtualMachineScaleSetNameParam, nil) 810 newListVirtualMachineScaleSetNetworkInterfacesPager = &resp 811 i.newListVirtualMachineScaleSetNetworkInterfacesPager.add(req, newListVirtualMachineScaleSetNetworkInterfacesPager) 812 server.PagerResponderInjectNextLinks(newListVirtualMachineScaleSetNetworkInterfacesPager, req, func(page *armnetwork.InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse, createLink func() string) { 813 page.NextLink = to.Ptr(createLink()) 814 }) 815 } 816 resp, err := server.PagerResponderNext(newListVirtualMachineScaleSetNetworkInterfacesPager, req) 817 if err != nil { 818 return nil, err 819 } 820 if !contains([]int{http.StatusOK}, resp.StatusCode) { 821 i.newListVirtualMachineScaleSetNetworkInterfacesPager.remove(req) 822 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 823 } 824 if !server.PagerResponderMore(newListVirtualMachineScaleSetNetworkInterfacesPager) { 825 i.newListVirtualMachineScaleSetNetworkInterfacesPager.remove(req) 826 } 827 return resp, nil 828 } 829 830 func (i *InterfacesServerTransport) dispatchNewListVirtualMachineScaleSetVMNetworkInterfacesPager(req *http.Request) (*http.Response, error) { 831 if i.srv.NewListVirtualMachineScaleSetVMNetworkInterfacesPager == nil { 832 return nil, &nonRetriableError{errors.New("fake for method NewListVirtualMachineScaleSetVMNetworkInterfacesPager not implemented")} 833 } 834 newListVirtualMachineScaleSetVMNetworkInterfacesPager := i.newListVirtualMachineScaleSetVMNetworkInterfacesPager.get(req) 835 if newListVirtualMachineScaleSetVMNetworkInterfacesPager == nil { 836 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` 837 regex := regexp.MustCompile(regexStr) 838 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 839 if matches == nil || len(matches) < 4 { 840 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 841 } 842 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 843 if err != nil { 844 return nil, err 845 } 846 virtualMachineScaleSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualMachineScaleSetName")]) 847 if err != nil { 848 return nil, err 849 } 850 virtualmachineIndexParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualmachineIndex")]) 851 if err != nil { 852 return nil, err 853 } 854 resp := i.srv.NewListVirtualMachineScaleSetVMNetworkInterfacesPager(resourceGroupNameParam, virtualMachineScaleSetNameParam, virtualmachineIndexParam, nil) 855 newListVirtualMachineScaleSetVMNetworkInterfacesPager = &resp 856 i.newListVirtualMachineScaleSetVMNetworkInterfacesPager.add(req, newListVirtualMachineScaleSetVMNetworkInterfacesPager) 857 server.PagerResponderInjectNextLinks(newListVirtualMachineScaleSetVMNetworkInterfacesPager, req, func(page *armnetwork.InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse, createLink func() string) { 858 page.NextLink = to.Ptr(createLink()) 859 }) 860 } 861 resp, err := server.PagerResponderNext(newListVirtualMachineScaleSetVMNetworkInterfacesPager, req) 862 if err != nil { 863 return nil, err 864 } 865 if !contains([]int{http.StatusOK}, resp.StatusCode) { 866 i.newListVirtualMachineScaleSetVMNetworkInterfacesPager.remove(req) 867 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} 868 } 869 if !server.PagerResponderMore(newListVirtualMachineScaleSetVMNetworkInterfacesPager) { 870 i.newListVirtualMachineScaleSetVMNetworkInterfacesPager.remove(req) 871 } 872 return resp, nil 873 } 874 875 func (i *InterfacesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { 876 if i.srv.UpdateTags == nil { 877 return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} 878 } 879 const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/networkInterfaces/(?P<networkInterfaceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` 880 regex := regexp.MustCompile(regexStr) 881 matches := regex.FindStringSubmatch(req.URL.EscapedPath()) 882 if matches == nil || len(matches) < 3 { 883 return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) 884 } 885 body, err := server.UnmarshalRequestAsJSON[armnetwork.TagsObject](req) 886 if err != nil { 887 return nil, err 888 } 889 resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) 890 if err != nil { 891 return nil, err 892 } 893 networkInterfaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkInterfaceName")]) 894 if err != nil { 895 return nil, err 896 } 897 respr, errRespr := i.srv.UpdateTags(req.Context(), resourceGroupNameParam, networkInterfaceNameParam, body, nil) 898 if respErr := server.GetError(errRespr, req); respErr != nil { 899 return nil, respErr 900 } 901 respContent := server.GetResponseContent(respr) 902 if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { 903 return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} 904 } 905 resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Interface, req) 906 if err != nil { 907 return nil, err 908 } 909 return resp, nil 910 }