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