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