1package network
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
18// Changes may cause incorrect behavior and will be lost if the code is
19// regenerated.
20
21import (
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"net/http"
26)
27
28// InterfacesClient is the the Microsoft Azure Network management API provides
29// a RESTful set of web services that interact with Microsoft Azure Networks
30// service to manage your network resources. The API has entities that
31// capture the relationship between an end user and the Microsoft Azure
32// Networks service.
33type InterfacesClient struct {
34	ManagementClient
35}
36
37// NewInterfacesClient creates an instance of the InterfacesClient client.
38func NewInterfacesClient(subscriptionID string) InterfacesClient {
39	return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID)
40}
41
42// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient
43// client.
44func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient {
45	return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)}
46}
47
48// CreateOrUpdate the Put NetworkInterface operation creates/updates a
49// networkInterface This method may poll for completion. Polling can be
50// canceled by passing the cancel channel argument. The channel will be used
51// to cancel polling and any outstanding HTTP requests.
52//
53// resourceGroupName is the name of the resource group. networkInterfaceName
54// is the name of the network interface. parameters is parameters supplied to
55// the create/update NetworkInterface operation
56func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) {
57	if err := validation.Validate([]validation.Validation{
58		{TargetValue: parameters,
59			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false,
60				Chain: []validation.Constraint{{Target: "parameters.Properties.NetworkSecurityGroup", Name: validation.Null, Rule: false,
61					Chain: []validation.Constraint{{Target: "parameters.Properties.NetworkSecurityGroup.Properties", Name: validation.Null, Rule: false,
62						Chain: []validation.Constraint{{Target: "parameters.Properties.NetworkSecurityGroup.Properties.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
63							{Target: "parameters.Properties.NetworkSecurityGroup.Properties.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
64						}},
65					}},
66				}}}}}); err != nil {
67		return result, validation.NewErrorWithValidationError(err, "network.InterfacesClient", "CreateOrUpdate")
68	}
69
70	req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
71	if err != nil {
72		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")
73	}
74
75	resp, err := client.CreateOrUpdateSender(req)
76	if err != nil {
77		result.Response = resp
78		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request")
79	}
80
81	result, err = client.CreateOrUpdateResponder(resp)
82	if err != nil {
83		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request")
84	}
85
86	return
87}
88
89// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
90func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) {
91	pathParameters := map[string]interface{}{
92		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
93		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
94		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
95	}
96
97	queryParameters := map[string]interface{}{
98		"api-version": client.APIVersion,
99	}
100
101	preparer := autorest.CreatePreparer(
102		autorest.AsJSON(),
103		autorest.AsPut(),
104		autorest.WithBaseURL(client.BaseURI),
105		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
106		autorest.WithJSON(parameters),
107		autorest.WithQueryParameters(queryParameters))
108	return preparer.Prepare(&http.Request{Cancel: cancel})
109}
110
111// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
112// http.Response Body if it receives an error.
113func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
114	return autorest.SendWithSender(client,
115		req,
116		azure.DoPollForAsynchronous(client.PollingDelay))
117}
118
119// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
120// closes the http.Response Body.
121func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
122	err = autorest.Respond(
123		resp,
124		client.ByInspecting(),
125		azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
126		autorest.ByClosing())
127	result.Response = resp
128	return
129}
130
131// Delete the delete netwokInterface operation deletes the specified
132// netwokInterface. This method may poll for completion. Polling can be
133// canceled by passing the cancel channel argument. The channel will be used
134// to cancel polling and any outstanding HTTP requests.
135//
136// resourceGroupName is the name of the resource group. networkInterfaceName
137// is the name of the network interface.
138func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
139	req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel)
140	if err != nil {
141		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request")
142	}
143
144	resp, err := client.DeleteSender(req)
145	if err != nil {
146		result.Response = resp
147		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request")
148	}
149
150	result, err = client.DeleteResponder(resp)
151	if err != nil {
152		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request")
153	}
154
155	return
156}
157
158// DeletePreparer prepares the Delete request.
159func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
160	pathParameters := map[string]interface{}{
161		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
162		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
163		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
164	}
165
166	queryParameters := map[string]interface{}{
167		"api-version": client.APIVersion,
168	}
169
170	preparer := autorest.CreatePreparer(
171		autorest.AsDelete(),
172		autorest.WithBaseURL(client.BaseURI),
173		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
174		autorest.WithQueryParameters(queryParameters))
175	return preparer.Prepare(&http.Request{Cancel: cancel})
176}
177
178// DeleteSender sends the Delete request. The method will close the
179// http.Response Body if it receives an error.
180func (client InterfacesClient) DeleteSender(req *http.Request) (*http.Response, error) {
181	return autorest.SendWithSender(client,
182		req,
183		azure.DoPollForAsynchronous(client.PollingDelay))
184}
185
186// DeleteResponder handles the response to the Delete request. The method always
187// closes the http.Response Body.
188func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
189	err = autorest.Respond(
190		resp,
191		client.ByInspecting(),
192		azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
193		autorest.ByClosing())
194	result.Response = resp
195	return
196}
197
198// Get the Get network interface operation retrieves information about the
199// specified network interface.
200//
201// resourceGroupName is the name of the resource group. networkInterfaceName
202// is the name of the network interface. expand is expand references
203// resources.
204func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) {
205	req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand)
206	if err != nil {
207		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request")
208	}
209
210	resp, err := client.GetSender(req)
211	if err != nil {
212		result.Response = autorest.Response{Response: resp}
213		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request")
214	}
215
216	result, err = client.GetResponder(resp)
217	if err != nil {
218		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request")
219	}
220
221	return
222}
223
224// GetPreparer prepares the Get request.
225func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) {
226	pathParameters := map[string]interface{}{
227		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
228		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
229		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
230	}
231
232	queryParameters := map[string]interface{}{
233		"api-version": client.APIVersion,
234	}
235	if len(expand) > 0 {
236		queryParameters["$expand"] = autorest.Encode("query", expand)
237	}
238
239	preparer := autorest.CreatePreparer(
240		autorest.AsGet(),
241		autorest.WithBaseURL(client.BaseURI),
242		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
243		autorest.WithQueryParameters(queryParameters))
244	return preparer.Prepare(&http.Request{})
245}
246
247// GetSender sends the Get request. The method will close the
248// http.Response Body if it receives an error.
249func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) {
250	return autorest.SendWithSender(client, req)
251}
252
253// GetResponder handles the response to the Get request. The method always
254// closes the http.Response Body.
255func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) {
256	err = autorest.Respond(
257		resp,
258		client.ByInspecting(),
259		azure.WithErrorUnlessStatusCode(http.StatusOK),
260		autorest.ByUnmarshallingJSON(&result),
261		autorest.ByClosing())
262	result.Response = autorest.Response{Response: resp}
263	return
264}
265
266// GetEffectiveRouteTable the get effective routetable operation retrieves all
267// the route tables applied on a networkInterface. This method may poll for
268// completion. Polling can be canceled by passing the cancel channel
269// argument. The channel will be used to cancel polling and any outstanding
270// HTTP requests.
271//
272// resourceGroupName is the name of the resource group. networkInterfaceName
273// is the name of the network interface.
274func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
275	req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel)
276	if err != nil {
277		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request")
278	}
279
280	resp, err := client.GetEffectiveRouteTableSender(req)
281	if err != nil {
282		result.Response = resp
283		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request")
284	}
285
286	result, err = client.GetEffectiveRouteTableResponder(resp)
287	if err != nil {
288		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request")
289	}
290
291	return
292}
293
294// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request.
295func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
296	pathParameters := map[string]interface{}{
297		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
298		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
299		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
300	}
301
302	queryParameters := map[string]interface{}{
303		"api-version": client.APIVersion,
304	}
305
306	preparer := autorest.CreatePreparer(
307		autorest.AsPost(),
308		autorest.WithBaseURL(client.BaseURI),
309		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters),
310		autorest.WithQueryParameters(queryParameters))
311	return preparer.Prepare(&http.Request{Cancel: cancel})
312}
313
314// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the
315// http.Response Body if it receives an error.
316func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) {
317	return autorest.SendWithSender(client,
318		req,
319		azure.DoPollForAsynchronous(client.PollingDelay))
320}
321
322// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always
323// closes the http.Response Body.
324func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result autorest.Response, err error) {
325	err = autorest.Respond(
326		resp,
327		client.ByInspecting(),
328		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
329		autorest.ByClosing())
330	result.Response = resp
331	return
332}
333
334// GetVirtualMachineScaleSetNetworkInterface the Get network interface
335// operation retrieves information about the specified network interface in a
336// virtual machine scale set.
337//
338// resourceGroupName is the name of the resource group.
339// virtualMachineScaleSetName is the name of the virtual machine scale set.
340// virtualmachineIndex is the virtual machine index. networkInterfaceName is
341// the name of the network interface. expand is expand references resources.
342func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) {
343	req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
344	if err != nil {
345		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request")
346	}
347
348	resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req)
349	if err != nil {
350		result.Response = autorest.Response{Response: resp}
351		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request")
352	}
353
354	result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp)
355	if err != nil {
356		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request")
357	}
358
359	return
360}
361
362// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request.
363func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) {
364	pathParameters := map[string]interface{}{
365		"networkInterfaceName":       autorest.Encode("path", networkInterfaceName),
366		"resourceGroupName":          autorest.Encode("path", resourceGroupName),
367		"subscriptionId":             autorest.Encode("path", client.SubscriptionID),
368		"virtualmachineIndex":        autorest.Encode("path", virtualmachineIndex),
369		"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
370	}
371
372	queryParameters := map[string]interface{}{
373		"api-version": client.APIVersion,
374	}
375	if len(expand) > 0 {
376		queryParameters["$expand"] = autorest.Encode("query", expand)
377	}
378
379	preparer := autorest.CreatePreparer(
380		autorest.AsGet(),
381		autorest.WithBaseURL(client.BaseURI),
382		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters),
383		autorest.WithQueryParameters(queryParameters))
384	return preparer.Prepare(&http.Request{})
385}
386
387// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the
388// http.Response Body if it receives an error.
389func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) {
390	return autorest.SendWithSender(client, req)
391}
392
393// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always
394// closes the http.Response Body.
395func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) {
396	err = autorest.Respond(
397		resp,
398		client.ByInspecting(),
399		azure.WithErrorUnlessStatusCode(http.StatusOK),
400		autorest.ByUnmarshallingJSON(&result),
401		autorest.ByClosing())
402	result.Response = autorest.Response{Response: resp}
403	return
404}
405
406// List the List networkInterfaces operation retrieves all the
407// networkInterfaces in a resource group.
408//
409// resourceGroupName is the name of the resource group.
410func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) {
411	req, err := client.ListPreparer(resourceGroupName)
412	if err != nil {
413		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request")
414	}
415
416	resp, err := client.ListSender(req)
417	if err != nil {
418		result.Response = autorest.Response{Response: resp}
419		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request")
420	}
421
422	result, err = client.ListResponder(resp)
423	if err != nil {
424		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request")
425	}
426
427	return
428}
429
430// ListPreparer prepares the List request.
431func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
432	pathParameters := map[string]interface{}{
433		"resourceGroupName": autorest.Encode("path", resourceGroupName),
434		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
435	}
436
437	queryParameters := map[string]interface{}{
438		"api-version": client.APIVersion,
439	}
440
441	preparer := autorest.CreatePreparer(
442		autorest.AsGet(),
443		autorest.WithBaseURL(client.BaseURI),
444		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters),
445		autorest.WithQueryParameters(queryParameters))
446	return preparer.Prepare(&http.Request{})
447}
448
449// ListSender sends the List request. The method will close the
450// http.Response Body if it receives an error.
451func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) {
452	return autorest.SendWithSender(client, req)
453}
454
455// ListResponder handles the response to the List request. The method always
456// closes the http.Response Body.
457func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) {
458	err = autorest.Respond(
459		resp,
460		client.ByInspecting(),
461		azure.WithErrorUnlessStatusCode(http.StatusOK),
462		autorest.ByUnmarshallingJSON(&result),
463		autorest.ByClosing())
464	result.Response = autorest.Response{Response: resp}
465	return
466}
467
468// ListNextResults retrieves the next set of results, if any.
469func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
470	req, err := lastResults.InterfaceListResultPreparer()
471	if err != nil {
472		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request")
473	}
474	if req == nil {
475		return
476	}
477
478	resp, err := client.ListSender(req)
479	if err != nil {
480		result.Response = autorest.Response{Response: resp}
481		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request")
482	}
483
484	result, err = client.ListResponder(resp)
485	if err != nil {
486		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request")
487	}
488
489	return
490}
491
492// ListAll the List networkInterfaces operation retrieves all the
493// networkInterfaces in a subscription.
494func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
495	req, err := client.ListAllPreparer()
496	if err != nil {
497		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request")
498	}
499
500	resp, err := client.ListAllSender(req)
501	if err != nil {
502		result.Response = autorest.Response{Response: resp}
503		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request")
504	}
505
506	result, err = client.ListAllResponder(resp)
507	if err != nil {
508		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request")
509	}
510
511	return
512}
513
514// ListAllPreparer prepares the ListAll request.
515func (client InterfacesClient) ListAllPreparer() (*http.Request, error) {
516	pathParameters := map[string]interface{}{
517		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
518	}
519
520	queryParameters := map[string]interface{}{
521		"api-version": client.APIVersion,
522	}
523
524	preparer := autorest.CreatePreparer(
525		autorest.AsGet(),
526		autorest.WithBaseURL(client.BaseURI),
527		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters),
528		autorest.WithQueryParameters(queryParameters))
529	return preparer.Prepare(&http.Request{})
530}
531
532// ListAllSender sends the ListAll request. The method will close the
533// http.Response Body if it receives an error.
534func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) {
535	return autorest.SendWithSender(client, req)
536}
537
538// ListAllResponder handles the response to the ListAll request. The method always
539// closes the http.Response Body.
540func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) {
541	err = autorest.Respond(
542		resp,
543		client.ByInspecting(),
544		azure.WithErrorUnlessStatusCode(http.StatusOK),
545		autorest.ByUnmarshallingJSON(&result),
546		autorest.ByClosing())
547	result.Response = autorest.Response{Response: resp}
548	return
549}
550
551// ListAllNextResults retrieves the next set of results, if any.
552func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
553	req, err := lastResults.InterfaceListResultPreparer()
554	if err != nil {
555		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request")
556	}
557	if req == nil {
558		return
559	}
560
561	resp, err := client.ListAllSender(req)
562	if err != nil {
563		result.Response = autorest.Response{Response: resp}
564		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request")
565	}
566
567	result, err = client.ListAllResponder(resp)
568	if err != nil {
569		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request")
570	}
571
572	return
573}
574
575// ListEffectiveNetworkSecurityGroups the list effective network security
576// group operation retrieves all the network security groups applied on a
577// networkInterface. This method may poll for completion. Polling can be
578// canceled by passing the cancel channel argument. The channel will be used
579// to cancel polling and any outstanding HTTP requests.
580//
581// resourceGroupName is the name of the resource group. networkInterfaceName
582// is the name of the network interface.
583func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
584	req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel)
585	if err != nil {
586		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request")
587	}
588
589	resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req)
590	if err != nil {
591		result.Response = resp
592		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request")
593	}
594
595	result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp)
596	if err != nil {
597		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request")
598	}
599
600	return
601}
602
603// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request.
604func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
605	pathParameters := map[string]interface{}{
606		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
607		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
608		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
609	}
610
611	queryParameters := map[string]interface{}{
612		"api-version": client.APIVersion,
613	}
614
615	preparer := autorest.CreatePreparer(
616		autorest.AsPost(),
617		autorest.WithBaseURL(client.BaseURI),
618		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters),
619		autorest.WithQueryParameters(queryParameters))
620	return preparer.Prepare(&http.Request{Cancel: cancel})
621}
622
623// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the
624// http.Response Body if it receives an error.
625func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) {
626	return autorest.SendWithSender(client,
627		req,
628		azure.DoPollForAsynchronous(client.PollingDelay))
629}
630
631// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always
632// closes the http.Response Body.
633func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result autorest.Response, err error) {
634	err = autorest.Respond(
635		resp,
636		client.ByInspecting(),
637		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
638		autorest.ByClosing())
639	result.Response = resp
640	return
641}
642
643// ListVirtualMachineScaleSetNetworkInterfaces the list network interface
644// operation retrieves information about all network interfaces in a virtual
645// machine scale set.
646//
647// resourceGroupName is the name of the resource group.
648// virtualMachineScaleSetName is the name of the virtual machine scale set.
649func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) {
650	req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName)
651	if err != nil {
652		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request")
653	}
654
655	resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
656	if err != nil {
657		result.Response = autorest.Response{Response: resp}
658		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request")
659	}
660
661	result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
662	if err != nil {
663		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request")
664	}
665
666	return
667}
668
669// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request.
670func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) {
671	pathParameters := map[string]interface{}{
672		"resourceGroupName":          autorest.Encode("path", resourceGroupName),
673		"subscriptionId":             autorest.Encode("path", client.SubscriptionID),
674		"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
675	}
676
677	queryParameters := map[string]interface{}{
678		"api-version": client.APIVersion,
679	}
680
681	preparer := autorest.CreatePreparer(
682		autorest.AsGet(),
683		autorest.WithBaseURL(client.BaseURI),
684		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters),
685		autorest.WithQueryParameters(queryParameters))
686	return preparer.Prepare(&http.Request{})
687}
688
689// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the
690// http.Response Body if it receives an error.
691func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
692	return autorest.SendWithSender(client, req)
693}
694
695// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always
696// closes the http.Response Body.
697func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
698	err = autorest.Respond(
699		resp,
700		client.ByInspecting(),
701		azure.WithErrorUnlessStatusCode(http.StatusOK),
702		autorest.ByUnmarshallingJSON(&result),
703		autorest.ByClosing())
704	result.Response = autorest.Response{Response: resp}
705	return
706}
707
708// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any.
709func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
710	req, err := lastResults.InterfaceListResultPreparer()
711	if err != nil {
712		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request")
713	}
714	if req == nil {
715		return
716	}
717
718	resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
719	if err != nil {
720		result.Response = autorest.Response{Response: resp}
721		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request")
722	}
723
724	result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
725	if err != nil {
726		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request")
727	}
728
729	return
730}
731
732// ListVirtualMachineScaleSetVMNetworkInterfaces the list network interface
733// operation retrieves information about all network interfaces in a virtual
734// machine from a virtual machine scale set.
735//
736// resourceGroupName is the name of the resource group.
737// virtualMachineScaleSetName is the name of the virtual machine scale set.
738// virtualmachineIndex is the virtual machine index.
739func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) {
740	req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
741	if err != nil {
742		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request")
743	}
744
745	resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
746	if err != nil {
747		result.Response = autorest.Response{Response: resp}
748		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request")
749	}
750
751	result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
752	if err != nil {
753		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request")
754	}
755
756	return
757}
758
759// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request.
760func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) {
761	pathParameters := map[string]interface{}{
762		"resourceGroupName":          autorest.Encode("path", resourceGroupName),
763		"subscriptionId":             autorest.Encode("path", client.SubscriptionID),
764		"virtualmachineIndex":        autorest.Encode("path", virtualmachineIndex),
765		"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
766	}
767
768	queryParameters := map[string]interface{}{
769		"api-version": client.APIVersion,
770	}
771
772	preparer := autorest.CreatePreparer(
773		autorest.AsGet(),
774		autorest.WithBaseURL(client.BaseURI),
775		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters),
776		autorest.WithQueryParameters(queryParameters))
777	return preparer.Prepare(&http.Request{})
778}
779
780// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the
781// http.Response Body if it receives an error.
782func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
783	return autorest.SendWithSender(client, req)
784}
785
786// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always
787// closes the http.Response Body.
788func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
789	err = autorest.Respond(
790		resp,
791		client.ByInspecting(),
792		azure.WithErrorUnlessStatusCode(http.StatusOK),
793		autorest.ByUnmarshallingJSON(&result),
794		autorest.ByClosing())
795	result.Response = autorest.Response{Response: resp}
796	return
797}
798
799// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any.
800func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
801	req, err := lastResults.InterfaceListResultPreparer()
802	if err != nil {
803		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request")
804	}
805	if req == nil {
806		return
807	}
808
809	resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
810	if err != nil {
811		result.Response = autorest.Response{Response: resp}
812		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request")
813	}
814
815	result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
816	if err != nil {
817		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request")
818	}
819
820	return
821}
822