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