1package network 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "net/http" 25) 26 27// InterfacesClient is the network Client 28type InterfacesClient struct { 29 BaseClient 30} 31 32// NewInterfacesClient creates an instance of the InterfacesClient client. 33func NewInterfacesClient(subscriptionID string) InterfacesClient { 34 return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID) 35} 36 37// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient client. 38func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient { 39 return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} 40} 41 42// CreateOrUpdate creates or updates a network interface. 43// Parameters: 44// resourceGroupName - the name of the resource group. 45// networkInterfaceName - the name of the network interface. 46// parameters - parameters supplied to the create or update network interface operation. 47func (client InterfacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface) (result InterfacesCreateOrUpdateFuture, err error) { 48 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkInterfaceName, parameters) 49 if err != nil { 50 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request") 51 return 52 } 53 54 result, err = client.CreateOrUpdateSender(req) 55 if err != nil { 56 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") 57 return 58 } 59 60 return 61} 62 63// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 64func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface) (*http.Request, error) { 65 pathParameters := map[string]interface{}{ 66 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 67 "resourceGroupName": autorest.Encode("path", resourceGroupName), 68 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 69 } 70 71 const APIVersion = "2018-02-01" 72 queryParameters := map[string]interface{}{ 73 "api-version": APIVersion, 74 } 75 76 preparer := autorest.CreatePreparer( 77 autorest.AsContentType("application/json; charset=utf-8"), 78 autorest.AsPut(), 79 autorest.WithBaseURL(client.BaseURI), 80 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), 81 autorest.WithJSON(parameters), 82 autorest.WithQueryParameters(queryParameters)) 83 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 84} 85 86// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 87// http.Response Body if it receives an error. 88func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (future InterfacesCreateOrUpdateFuture, err error) { 89 var resp *http.Response 90 resp, err = autorest.SendWithSender(client, req, 91 azure.DoRetryWithRegistration(client.Client)) 92 if err != nil { 93 return 94 } 95 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) 96 if err != nil { 97 return 98 } 99 future.Future, err = azure.NewFutureFromResponse(resp) 100 return 101} 102 103// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 104// closes the http.Response Body. 105func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) { 106 err = autorest.Respond( 107 resp, 108 client.ByInspecting(), 109 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 110 autorest.ByUnmarshallingJSON(&result), 111 autorest.ByClosing()) 112 result.Response = autorest.Response{Response: resp} 113 return 114} 115 116// Delete deletes the specified network interface. 117// Parameters: 118// resourceGroupName - the name of the resource group. 119// networkInterfaceName - the name of the network interface. 120func (client InterfacesClient) Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesDeleteFuture, err error) { 121 req, err := client.DeletePreparer(ctx, resourceGroupName, networkInterfaceName) 122 if err != nil { 123 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request") 124 return 125 } 126 127 result, err = client.DeleteSender(req) 128 if err != nil { 129 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", result.Response(), "Failure sending request") 130 return 131 } 132 133 return 134} 135 136// DeletePreparer prepares the Delete request. 137func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { 138 pathParameters := map[string]interface{}{ 139 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 140 "resourceGroupName": autorest.Encode("path", resourceGroupName), 141 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 142 } 143 144 const APIVersion = "2018-02-01" 145 queryParameters := map[string]interface{}{ 146 "api-version": APIVersion, 147 } 148 149 preparer := autorest.CreatePreparer( 150 autorest.AsDelete(), 151 autorest.WithBaseURL(client.BaseURI), 152 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), 153 autorest.WithQueryParameters(queryParameters)) 154 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 155} 156 157// DeleteSender sends the Delete request. The method will close the 158// http.Response Body if it receives an error. 159func (client InterfacesClient) DeleteSender(req *http.Request) (future InterfacesDeleteFuture, err error) { 160 var resp *http.Response 161 resp, err = autorest.SendWithSender(client, req, 162 azure.DoRetryWithRegistration(client.Client)) 163 if err != nil { 164 return 165 } 166 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) 167 if err != nil { 168 return 169 } 170 future.Future, err = azure.NewFutureFromResponse(resp) 171 return 172} 173 174// DeleteResponder handles the response to the Delete request. The method always 175// closes the http.Response Body. 176func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 177 err = autorest.Respond( 178 resp, 179 client.ByInspecting(), 180 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 181 autorest.ByClosing()) 182 result.Response = resp 183 return 184} 185 186// Get gets information about the specified network interface. 187// Parameters: 188// resourceGroupName - the name of the resource group. 189// networkInterfaceName - the name of the network interface. 190// expand - expands referenced resources. 191func (client InterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { 192 req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, expand) 193 if err != nil { 194 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request") 195 return 196 } 197 198 resp, err := client.GetSender(req) 199 if err != nil { 200 result.Response = autorest.Response{Response: resp} 201 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request") 202 return 203 } 204 205 result, err = client.GetResponder(resp) 206 if err != nil { 207 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request") 208 } 209 210 return 211} 212 213// GetPreparer prepares the Get request. 214func (client InterfacesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) { 215 pathParameters := map[string]interface{}{ 216 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 217 "resourceGroupName": autorest.Encode("path", resourceGroupName), 218 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 219 } 220 221 const APIVersion = "2018-02-01" 222 queryParameters := map[string]interface{}{ 223 "api-version": APIVersion, 224 } 225 if len(expand) > 0 { 226 queryParameters["$expand"] = autorest.Encode("query", expand) 227 } 228 229 preparer := autorest.CreatePreparer( 230 autorest.AsGet(), 231 autorest.WithBaseURL(client.BaseURI), 232 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), 233 autorest.WithQueryParameters(queryParameters)) 234 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 235} 236 237// GetSender sends the Get request. The method will close the 238// http.Response Body if it receives an error. 239func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) { 240 return autorest.SendWithSender(client, req, 241 azure.DoRetryWithRegistration(client.Client)) 242} 243 244// GetResponder handles the response to the Get request. The method always 245// closes the http.Response Body. 246func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) { 247 err = autorest.Respond( 248 resp, 249 client.ByInspecting(), 250 azure.WithErrorUnlessStatusCode(http.StatusOK), 251 autorest.ByUnmarshallingJSON(&result), 252 autorest.ByClosing()) 253 result.Response = autorest.Response{Response: resp} 254 return 255} 256 257// GetEffectiveRouteTable gets all route tables applied to a network interface. 258// Parameters: 259// resourceGroupName - the name of the resource group. 260// networkInterfaceName - the name of the network interface. 261func (client InterfacesClient) GetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesGetEffectiveRouteTableFuture, err error) { 262 req, err := client.GetEffectiveRouteTablePreparer(ctx, resourceGroupName, networkInterfaceName) 263 if err != nil { 264 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request") 265 return 266 } 267 268 result, err = client.GetEffectiveRouteTableSender(req) 269 if err != nil { 270 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", result.Response(), "Failure sending request") 271 return 272 } 273 274 return 275} 276 277// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request. 278func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { 279 pathParameters := map[string]interface{}{ 280 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 281 "resourceGroupName": autorest.Encode("path", resourceGroupName), 282 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 283 } 284 285 const APIVersion = "2018-02-01" 286 queryParameters := map[string]interface{}{ 287 "api-version": APIVersion, 288 } 289 290 preparer := autorest.CreatePreparer( 291 autorest.AsPost(), 292 autorest.WithBaseURL(client.BaseURI), 293 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters), 294 autorest.WithQueryParameters(queryParameters)) 295 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 296} 297 298// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the 299// http.Response Body if it receives an error. 300func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (future InterfacesGetEffectiveRouteTableFuture, err error) { 301 var resp *http.Response 302 resp, err = autorest.SendWithSender(client, req, 303 azure.DoRetryWithRegistration(client.Client)) 304 if err != nil { 305 return 306 } 307 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) 308 if err != nil { 309 return 310 } 311 future.Future, err = azure.NewFutureFromResponse(resp) 312 return 313} 314 315// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always 316// closes the http.Response Body. 317func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) { 318 err = autorest.Respond( 319 resp, 320 client.ByInspecting(), 321 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 322 autorest.ByUnmarshallingJSON(&result), 323 autorest.ByClosing()) 324 result.Response = autorest.Response{Response: resp} 325 return 326} 327 328// GetVirtualMachineScaleSetIPConfiguration get the specified network interface ip configuration in a virtual machine 329// scale set. 330// Parameters: 331// resourceGroupName - the name of the resource group. 332// virtualMachineScaleSetName - the name of the virtual machine scale set. 333// virtualmachineIndex - the virtual machine index. 334// networkInterfaceName - the name of the network interface. 335// IPConfigurationName - the name of the ip configuration. 336// expand - expands referenced resources. 337func (client InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result InterfaceIPConfiguration, err error) { 338 req, err := client.GetVirtualMachineScaleSetIPConfigurationPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, expand) 339 if err != nil { 340 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", nil, "Failure preparing request") 341 return 342 } 343 344 resp, err := client.GetVirtualMachineScaleSetIPConfigurationSender(req) 345 if err != nil { 346 result.Response = autorest.Response{Response: resp} 347 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", resp, "Failure sending request") 348 return 349 } 350 351 result, err = client.GetVirtualMachineScaleSetIPConfigurationResponder(resp) 352 if err != nil { 353 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", resp, "Failure responding to request") 354 } 355 356 return 357} 358 359// GetVirtualMachineScaleSetIPConfigurationPreparer prepares the GetVirtualMachineScaleSetIPConfiguration request. 360func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (*http.Request, error) { 361 pathParameters := map[string]interface{}{ 362 "ipConfigurationName": autorest.Encode("path", IPConfigurationName), 363 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 364 "resourceGroupName": autorest.Encode("path", resourceGroupName), 365 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 366 "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), 367 "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), 368 } 369 370 const APIVersion = "2017-03-30" 371 queryParameters := map[string]interface{}{ 372 "api-version": APIVersion, 373 } 374 if len(expand) > 0 { 375 queryParameters["$expand"] = autorest.Encode("query", expand) 376 } 377 378 preparer := autorest.CreatePreparer( 379 autorest.AsGet(), 380 autorest.WithBaseURL(client.BaseURI), 381 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters), 382 autorest.WithQueryParameters(queryParameters)) 383 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 384} 385 386// GetVirtualMachineScaleSetIPConfigurationSender sends the GetVirtualMachineScaleSetIPConfiguration request. The method will close the 387// http.Response Body if it receives an error. 388func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationSender(req *http.Request) (*http.Response, error) { 389 return autorest.SendWithSender(client, req, 390 azure.DoRetryWithRegistration(client.Client)) 391} 392 393// GetVirtualMachineScaleSetIPConfigurationResponder handles the response to the GetVirtualMachineScaleSetIPConfiguration request. The method always 394// closes the http.Response Body. 395func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationResponder(resp *http.Response) (result InterfaceIPConfiguration, err error) { 396 err = autorest.Respond( 397 resp, 398 client.ByInspecting(), 399 azure.WithErrorUnlessStatusCode(http.StatusOK), 400 autorest.ByUnmarshallingJSON(&result), 401 autorest.ByClosing()) 402 result.Response = autorest.Response{Response: resp} 403 return 404} 405 406// GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set. 407// Parameters: 408// resourceGroupName - the name of the resource group. 409// virtualMachineScaleSetName - the name of the virtual machine scale set. 410// virtualmachineIndex - the virtual machine index. 411// networkInterfaceName - the name of the network interface. 412// expand - expands referenced resources. 413func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { 414 req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) 415 if err != nil { 416 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request") 417 return 418 } 419 420 resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req) 421 if err != nil { 422 result.Response = autorest.Response{Response: resp} 423 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request") 424 return 425 } 426 427 result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp) 428 if err != nil { 429 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request") 430 } 431 432 return 433} 434 435// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request. 436func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { 437 pathParameters := map[string]interface{}{ 438 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 439 "resourceGroupName": autorest.Encode("path", resourceGroupName), 440 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 441 "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), 442 "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), 443 } 444 445 const APIVersion = "2017-03-30" 446 queryParameters := map[string]interface{}{ 447 "api-version": APIVersion, 448 } 449 if len(expand) > 0 { 450 queryParameters["$expand"] = autorest.Encode("query", expand) 451 } 452 453 preparer := autorest.CreatePreparer( 454 autorest.AsGet(), 455 autorest.WithBaseURL(client.BaseURI), 456 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters), 457 autorest.WithQueryParameters(queryParameters)) 458 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 459} 460 461// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the 462// http.Response Body if it receives an error. 463func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) { 464 return autorest.SendWithSender(client, req, 465 azure.DoRetryWithRegistration(client.Client)) 466} 467 468// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always 469// closes the http.Response Body. 470func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) { 471 err = autorest.Respond( 472 resp, 473 client.ByInspecting(), 474 azure.WithErrorUnlessStatusCode(http.StatusOK), 475 autorest.ByUnmarshallingJSON(&result), 476 autorest.ByClosing()) 477 result.Response = autorest.Response{Response: resp} 478 return 479} 480 481// List gets all network interfaces in a resource group. 482// Parameters: 483// resourceGroupName - the name of the resource group. 484func (client InterfacesClient) List(ctx context.Context, resourceGroupName string) (result InterfaceListResultPage, err error) { 485 result.fn = client.listNextResults 486 req, err := client.ListPreparer(ctx, resourceGroupName) 487 if err != nil { 488 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request") 489 return 490 } 491 492 resp, err := client.ListSender(req) 493 if err != nil { 494 result.ilr.Response = autorest.Response{Response: resp} 495 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request") 496 return 497 } 498 499 result.ilr, err = client.ListResponder(resp) 500 if err != nil { 501 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request") 502 } 503 504 return 505} 506 507// ListPreparer prepares the List request. 508func (client InterfacesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 509 pathParameters := map[string]interface{}{ 510 "resourceGroupName": autorest.Encode("path", resourceGroupName), 511 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 512 } 513 514 const APIVersion = "2018-02-01" 515 queryParameters := map[string]interface{}{ 516 "api-version": APIVersion, 517 } 518 519 preparer := autorest.CreatePreparer( 520 autorest.AsGet(), 521 autorest.WithBaseURL(client.BaseURI), 522 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters), 523 autorest.WithQueryParameters(queryParameters)) 524 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 525} 526 527// ListSender sends the List request. The method will close the 528// http.Response Body if it receives an error. 529func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) { 530 return autorest.SendWithSender(client, req, 531 azure.DoRetryWithRegistration(client.Client)) 532} 533 534// ListResponder handles the response to the List request. The method always 535// closes the http.Response Body. 536func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) { 537 err = autorest.Respond( 538 resp, 539 client.ByInspecting(), 540 azure.WithErrorUnlessStatusCode(http.StatusOK), 541 autorest.ByUnmarshallingJSON(&result), 542 autorest.ByClosing()) 543 result.Response = autorest.Response{Response: resp} 544 return 545} 546 547// listNextResults retrieves the next set of results, if any. 548func (client InterfacesClient) listNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { 549 req, err := lastResults.interfaceListResultPreparer() 550 if err != nil { 551 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", nil, "Failure preparing next results request") 552 } 553 if req == nil { 554 return 555 } 556 resp, err := client.ListSender(req) 557 if err != nil { 558 result.Response = autorest.Response{Response: resp} 559 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", resp, "Failure sending next results request") 560 } 561 result, err = client.ListResponder(resp) 562 if err != nil { 563 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", resp, "Failure responding to next results request") 564 } 565 return 566} 567 568// ListComplete enumerates all values, automatically crossing page boundaries as required. 569func (client InterfacesClient) ListComplete(ctx context.Context, resourceGroupName string) (result InterfaceListResultIterator, err error) { 570 result.page, err = client.List(ctx, resourceGroupName) 571 return 572} 573 574// ListAll gets all network interfaces in a subscription. 575func (client InterfacesClient) ListAll(ctx context.Context) (result InterfaceListResultPage, err error) { 576 result.fn = client.listAllNextResults 577 req, err := client.ListAllPreparer(ctx) 578 if err != nil { 579 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request") 580 return 581 } 582 583 resp, err := client.ListAllSender(req) 584 if err != nil { 585 result.ilr.Response = autorest.Response{Response: resp} 586 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request") 587 return 588 } 589 590 result.ilr, err = client.ListAllResponder(resp) 591 if err != nil { 592 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request") 593 } 594 595 return 596} 597 598// ListAllPreparer prepares the ListAll request. 599func (client InterfacesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { 600 pathParameters := map[string]interface{}{ 601 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 602 } 603 604 const APIVersion = "2018-02-01" 605 queryParameters := map[string]interface{}{ 606 "api-version": APIVersion, 607 } 608 609 preparer := autorest.CreatePreparer( 610 autorest.AsGet(), 611 autorest.WithBaseURL(client.BaseURI), 612 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters), 613 autorest.WithQueryParameters(queryParameters)) 614 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 615} 616 617// ListAllSender sends the ListAll request. The method will close the 618// http.Response Body if it receives an error. 619func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) { 620 return autorest.SendWithSender(client, req, 621 azure.DoRetryWithRegistration(client.Client)) 622} 623 624// ListAllResponder handles the response to the ListAll request. The method always 625// closes the http.Response Body. 626func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) { 627 err = autorest.Respond( 628 resp, 629 client.ByInspecting(), 630 azure.WithErrorUnlessStatusCode(http.StatusOK), 631 autorest.ByUnmarshallingJSON(&result), 632 autorest.ByClosing()) 633 result.Response = autorest.Response{Response: resp} 634 return 635} 636 637// listAllNextResults retrieves the next set of results, if any. 638func (client InterfacesClient) listAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { 639 req, err := lastResults.interfaceListResultPreparer() 640 if err != nil { 641 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", nil, "Failure preparing next results request") 642 } 643 if req == nil { 644 return 645 } 646 resp, err := client.ListAllSender(req) 647 if err != nil { 648 result.Response = autorest.Response{Response: resp} 649 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", resp, "Failure sending next results request") 650 } 651 result, err = client.ListAllResponder(resp) 652 if err != nil { 653 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", resp, "Failure responding to next results request") 654 } 655 return 656} 657 658// ListAllComplete enumerates all values, automatically crossing page boundaries as required. 659func (client InterfacesClient) ListAllComplete(ctx context.Context) (result InterfaceListResultIterator, err error) { 660 result.page, err = client.ListAll(ctx) 661 return 662} 663 664// ListEffectiveNetworkSecurityGroups gets all network security groups applied to a network interface. 665// Parameters: 666// resourceGroupName - the name of the resource group. 667// networkInterfaceName - the name of the network interface. 668func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { 669 req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(ctx, resourceGroupName, networkInterfaceName) 670 if err != nil { 671 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request") 672 return 673 } 674 675 result, err = client.ListEffectiveNetworkSecurityGroupsSender(req) 676 if err != nil { 677 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", result.Response(), "Failure sending request") 678 return 679 } 680 681 return 682} 683 684// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request. 685func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { 686 pathParameters := map[string]interface{}{ 687 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 688 "resourceGroupName": autorest.Encode("path", resourceGroupName), 689 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 690 } 691 692 const APIVersion = "2018-02-01" 693 queryParameters := map[string]interface{}{ 694 "api-version": APIVersion, 695 } 696 697 preparer := autorest.CreatePreparer( 698 autorest.AsPost(), 699 autorest.WithBaseURL(client.BaseURI), 700 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters), 701 autorest.WithQueryParameters(queryParameters)) 702 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 703} 704 705// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the 706// http.Response Body if it receives an error. 707func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (future InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { 708 var resp *http.Response 709 resp, err = autorest.SendWithSender(client, req, 710 azure.DoRetryWithRegistration(client.Client)) 711 if err != nil { 712 return 713 } 714 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) 715 if err != nil { 716 return 717 } 718 future.Future, err = azure.NewFutureFromResponse(resp) 719 return 720} 721 722// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always 723// closes the http.Response Body. 724func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) { 725 err = autorest.Respond( 726 resp, 727 client.ByInspecting(), 728 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 729 autorest.ByUnmarshallingJSON(&result), 730 autorest.ByClosing()) 731 result.Response = autorest.Response{Response: resp} 732 return 733} 734 735// ListVirtualMachineScaleSetIPConfigurations get the specified network interface ip configuration in a virtual machine 736// scale set. 737// Parameters: 738// resourceGroupName - the name of the resource group. 739// virtualMachineScaleSetName - the name of the virtual machine scale set. 740// virtualmachineIndex - the virtual machine index. 741// networkInterfaceName - the name of the network interface. 742// expand - expands referenced resources. 743func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultPage, err error) { 744 result.fn = client.listVirtualMachineScaleSetIPConfigurationsNextResults 745 req, err := client.ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) 746 if err != nil { 747 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", nil, "Failure preparing request") 748 return 749 } 750 751 resp, err := client.ListVirtualMachineScaleSetIPConfigurationsSender(req) 752 if err != nil { 753 result.iiclr.Response = autorest.Response{Response: resp} 754 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", resp, "Failure sending request") 755 return 756 } 757 758 result.iiclr, err = client.ListVirtualMachineScaleSetIPConfigurationsResponder(resp) 759 if err != nil { 760 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", resp, "Failure responding to request") 761 } 762 763 return 764} 765 766// ListVirtualMachineScaleSetIPConfigurationsPreparer prepares the ListVirtualMachineScaleSetIPConfigurations request. 767func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { 768 pathParameters := map[string]interface{}{ 769 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 770 "resourceGroupName": autorest.Encode("path", resourceGroupName), 771 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 772 "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), 773 "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), 774 } 775 776 const APIVersion = "2017-03-30" 777 queryParameters := map[string]interface{}{ 778 "api-version": APIVersion, 779 } 780 if len(expand) > 0 { 781 queryParameters["$expand"] = autorest.Encode("query", expand) 782 } 783 784 preparer := autorest.CreatePreparer( 785 autorest.AsGet(), 786 autorest.WithBaseURL(client.BaseURI), 787 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters), 788 autorest.WithQueryParameters(queryParameters)) 789 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 790} 791 792// ListVirtualMachineScaleSetIPConfigurationsSender sends the ListVirtualMachineScaleSetIPConfigurations request. The method will close the 793// http.Response Body if it receives an error. 794func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsSender(req *http.Request) (*http.Response, error) { 795 return autorest.SendWithSender(client, req, 796 azure.DoRetryWithRegistration(client.Client)) 797} 798 799// ListVirtualMachineScaleSetIPConfigurationsResponder handles the response to the ListVirtualMachineScaleSetIPConfigurations request. The method always 800// closes the http.Response Body. 801func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsResponder(resp *http.Response) (result InterfaceIPConfigurationListResult, err error) { 802 err = autorest.Respond( 803 resp, 804 client.ByInspecting(), 805 azure.WithErrorUnlessStatusCode(http.StatusOK), 806 autorest.ByUnmarshallingJSON(&result), 807 autorest.ByClosing()) 808 result.Response = autorest.Response{Response: resp} 809 return 810} 811 812// listVirtualMachineScaleSetIPConfigurationsNextResults retrieves the next set of results, if any. 813func (client InterfacesClient) listVirtualMachineScaleSetIPConfigurationsNextResults(lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) { 814 req, err := lastResults.interfaceIPConfigurationListResultPreparer() 815 if err != nil { 816 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", nil, "Failure preparing next results request") 817 } 818 if req == nil { 819 return 820 } 821 resp, err := client.ListVirtualMachineScaleSetIPConfigurationsSender(req) 822 if err != nil { 823 result.Response = autorest.Response{Response: resp} 824 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", resp, "Failure sending next results request") 825 } 826 result, err = client.ListVirtualMachineScaleSetIPConfigurationsResponder(resp) 827 if err != nil { 828 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", resp, "Failure responding to next results request") 829 } 830 return 831} 832 833// ListVirtualMachineScaleSetIPConfigurationsComplete enumerates all values, automatically crossing page boundaries as required. 834func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultIterator, err error) { 835 result.page, err = client.ListVirtualMachineScaleSetIPConfigurations(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) 836 return 837} 838 839// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set. 840// Parameters: 841// resourceGroupName - the name of the resource group. 842// virtualMachineScaleSetName - the name of the virtual machine scale set. 843func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultPage, err error) { 844 result.fn = client.listVirtualMachineScaleSetNetworkInterfacesNextResults 845 req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) 846 if err != nil { 847 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request") 848 return 849 } 850 851 resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) 852 if err != nil { 853 result.ilr.Response = autorest.Response{Response: resp} 854 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request") 855 return 856 } 857 858 result.ilr, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) 859 if err != nil { 860 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request") 861 } 862 863 return 864} 865 866// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request. 867func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { 868 pathParameters := map[string]interface{}{ 869 "resourceGroupName": autorest.Encode("path", resourceGroupName), 870 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 871 "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), 872 } 873 874 const APIVersion = "2017-03-30" 875 queryParameters := map[string]interface{}{ 876 "api-version": APIVersion, 877 } 878 879 preparer := autorest.CreatePreparer( 880 autorest.AsGet(), 881 autorest.WithBaseURL(client.BaseURI), 882 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters), 883 autorest.WithQueryParameters(queryParameters)) 884 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 885} 886 887// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the 888// http.Response Body if it receives an error. 889func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) { 890 return autorest.SendWithSender(client, req, 891 azure.DoRetryWithRegistration(client.Client)) 892} 893 894// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always 895// closes the http.Response Body. 896func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { 897 err = autorest.Respond( 898 resp, 899 client.ByInspecting(), 900 azure.WithErrorUnlessStatusCode(http.StatusOK), 901 autorest.ByUnmarshallingJSON(&result), 902 autorest.ByClosing()) 903 result.Response = autorest.Response{Response: resp} 904 return 905} 906 907// listVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any. 908func (client InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { 909 req, err := lastResults.interfaceListResultPreparer() 910 if err != nil { 911 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", nil, "Failure preparing next results request") 912 } 913 if req == nil { 914 return 915 } 916 resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) 917 if err != nil { 918 result.Response = autorest.Response{Response: resp} 919 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", resp, "Failure sending next results request") 920 } 921 result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) 922 if err != nil { 923 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", resp, "Failure responding to next results request") 924 } 925 return 926} 927 928// ListVirtualMachineScaleSetNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. 929func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultIterator, err error) { 930 result.page, err = client.ListVirtualMachineScaleSetNetworkInterfaces(ctx, resourceGroupName, virtualMachineScaleSetName) 931 return 932} 933 934// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in 935// a virtual machine scale set. 936// Parameters: 937// resourceGroupName - the name of the resource group. 938// virtualMachineScaleSetName - the name of the virtual machine scale set. 939// virtualmachineIndex - the virtual machine index. 940func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultPage, err error) { 941 result.fn = client.listVirtualMachineScaleSetVMNetworkInterfacesNextResults 942 req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) 943 if err != nil { 944 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request") 945 return 946 } 947 948 resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) 949 if err != nil { 950 result.ilr.Response = autorest.Response{Response: resp} 951 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request") 952 return 953 } 954 955 result.ilr, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) 956 if err != nil { 957 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request") 958 } 959 960 return 961} 962 963// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request. 964func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) { 965 pathParameters := map[string]interface{}{ 966 "resourceGroupName": autorest.Encode("path", resourceGroupName), 967 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 968 "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), 969 "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), 970 } 971 972 const APIVersion = "2017-03-30" 973 queryParameters := map[string]interface{}{ 974 "api-version": APIVersion, 975 } 976 977 preparer := autorest.CreatePreparer( 978 autorest.AsGet(), 979 autorest.WithBaseURL(client.BaseURI), 980 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters), 981 autorest.WithQueryParameters(queryParameters)) 982 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 983} 984 985// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the 986// http.Response Body if it receives an error. 987func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) { 988 return autorest.SendWithSender(client, req, 989 azure.DoRetryWithRegistration(client.Client)) 990} 991 992// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always 993// closes the http.Response Body. 994func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { 995 err = autorest.Respond( 996 resp, 997 client.ByInspecting(), 998 azure.WithErrorUnlessStatusCode(http.StatusOK), 999 autorest.ByUnmarshallingJSON(&result), 1000 autorest.ByClosing()) 1001 result.Response = autorest.Response{Response: resp} 1002 return 1003} 1004 1005// listVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any. 1006func (client InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { 1007 req, err := lastResults.interfaceListResultPreparer() 1008 if err != nil { 1009 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", nil, "Failure preparing next results request") 1010 } 1011 if req == nil { 1012 return 1013 } 1014 resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) 1015 if err != nil { 1016 result.Response = autorest.Response{Response: resp} 1017 return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", resp, "Failure sending next results request") 1018 } 1019 result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) 1020 if err != nil { 1021 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", resp, "Failure responding to next results request") 1022 } 1023 return 1024} 1025 1026// ListVirtualMachineScaleSetVMNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. 1027func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultIterator, err error) { 1028 result.page, err = client.ListVirtualMachineScaleSetVMNetworkInterfaces(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) 1029 return 1030} 1031 1032// UpdateTags updates a network interface tags. 1033// Parameters: 1034// resourceGroupName - the name of the resource group. 1035// networkInterfaceName - the name of the network interface. 1036// parameters - parameters supplied to update network interface tags. 1037func (client InterfacesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject) (result InterfacesUpdateTagsFuture, err error) { 1038 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkInterfaceName, parameters) 1039 if err != nil { 1040 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "UpdateTags", nil, "Failure preparing request") 1041 return 1042 } 1043 1044 result, err = client.UpdateTagsSender(req) 1045 if err != nil { 1046 err = autorest.NewErrorWithError(err, "network.InterfacesClient", "UpdateTags", result.Response(), "Failure sending request") 1047 return 1048 } 1049 1050 return 1051} 1052 1053// UpdateTagsPreparer prepares the UpdateTags request. 1054func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject) (*http.Request, error) { 1055 pathParameters := map[string]interface{}{ 1056 "networkInterfaceName": autorest.Encode("path", networkInterfaceName), 1057 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1058 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1059 } 1060 1061 const APIVersion = "2018-02-01" 1062 queryParameters := map[string]interface{}{ 1063 "api-version": APIVersion, 1064 } 1065 1066 preparer := autorest.CreatePreparer( 1067 autorest.AsContentType("application/json; charset=utf-8"), 1068 autorest.AsPatch(), 1069 autorest.WithBaseURL(client.BaseURI), 1070 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), 1071 autorest.WithJSON(parameters), 1072 autorest.WithQueryParameters(queryParameters)) 1073 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1074} 1075 1076// UpdateTagsSender sends the UpdateTags request. The method will close the 1077// http.Response Body if it receives an error. 1078func (client InterfacesClient) UpdateTagsSender(req *http.Request) (future InterfacesUpdateTagsFuture, err error) { 1079 var resp *http.Response 1080 resp, err = autorest.SendWithSender(client, req, 1081 azure.DoRetryWithRegistration(client.Client)) 1082 if err != nil { 1083 return 1084 } 1085 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) 1086 if err != nil { 1087 return 1088 } 1089 future.Future, err = azure.NewFutureFromResponse(resp) 1090 return 1091} 1092 1093// UpdateTagsResponder handles the response to the UpdateTags request. The method always 1094// closes the http.Response Body. 1095func (client InterfacesClient) UpdateTagsResponder(resp *http.Response) (result Interface, err error) { 1096 err = autorest.Respond( 1097 resp, 1098 client.ByInspecting(), 1099 azure.WithErrorUnlessStatusCode(http.StatusOK), 1100 autorest.ByUnmarshallingJSON(&result), 1101 autorest.ByClosing()) 1102 result.Response = autorest.Response{Response: resp} 1103 return 1104} 1105