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/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// LocalNetworkGatewaysClient is the network Client
30type LocalNetworkGatewaysClient struct {
31	BaseClient
32}
33
34// NewLocalNetworkGatewaysClient creates an instance of the LocalNetworkGatewaysClient client.
35func NewLocalNetworkGatewaysClient(subscriptionID string) LocalNetworkGatewaysClient {
36	return NewLocalNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
37}
38
39// NewLocalNetworkGatewaysClientWithBaseURI creates an instance of the LocalNetworkGatewaysClient client using a custom
40// endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
41// stack).
42func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) LocalNetworkGatewaysClient {
43	return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
44}
45
46// CreateOrUpdate creates or updates a local network gateway in the specified resource group.
47// Parameters:
48// resourceGroupName - the name of the resource group.
49// localNetworkGatewayName - the name of the local network gateway.
50// parameters - parameters supplied to the create or update local network gateway operation.
51func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (result LocalNetworkGatewaysCreateOrUpdateFuture, err error) {
52	if tracing.IsEnabled() {
53		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.CreateOrUpdate")
54		defer func() {
55			sc := -1
56			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
57				sc = result.FutureAPI.Response().StatusCode
58			}
59			tracing.EndSpan(ctx, sc, err)
60		}()
61	}
62	if err := validation.Validate([]validation.Validation{
63		{TargetValue: localNetworkGatewayName,
64			Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
65		{TargetValue: parameters,
66			Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
67		return result, validation.NewError("network.LocalNetworkGatewaysClient", "CreateOrUpdate", err.Error())
68	}
69
70	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
71	if err != nil {
72		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
73		return
74	}
75
76	result, err = client.CreateOrUpdateSender(req)
77	if err != nil {
78		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure sending request")
79		return
80	}
81
82	return
83}
84
85// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
86func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (*http.Request, error) {
87	pathParameters := map[string]interface{}{
88		"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
89		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
90		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
91	}
92
93	const APIVersion = "2018-02-01"
94	queryParameters := map[string]interface{}{
95		"api-version": APIVersion,
96	}
97
98	preparer := autorest.CreatePreparer(
99		autorest.AsContentType("application/json; charset=utf-8"),
100		autorest.AsPut(),
101		autorest.WithBaseURL(client.BaseURI),
102		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
103		autorest.WithJSON(parameters),
104		autorest.WithQueryParameters(queryParameters))
105	return preparer.Prepare((&http.Request{}).WithContext(ctx))
106}
107
108// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
109// http.Response Body if it receives an error.
110func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) {
111	var resp *http.Response
112	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
113	if err != nil {
114		return
115	}
116	var azf azure.Future
117	azf, err = azure.NewFutureFromResponse(resp)
118	future.FutureAPI = &azf
119	future.Result = func(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) {
120		var done bool
121		done, err = future.DoneWithContext(context.Background(), client)
122		if err != nil {
123			err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
124			return
125		}
126		if !done {
127			err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture")
128			return
129		}
130		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
131		lng.Response.Response, err = future.GetResult(sender)
132		if lng.Response.Response == nil && err == nil {
133			err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", nil, "received nil response and error")
134		}
135		if err == nil && lng.Response.Response.StatusCode != http.StatusNoContent {
136			lng, err = client.CreateOrUpdateResponder(lng.Response.Response)
137			if err != nil {
138				err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request")
139			}
140		}
141		return
142	}
143	return
144}
145
146// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
147// closes the http.Response Body.
148func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result LocalNetworkGateway, err error) {
149	err = autorest.Respond(
150		resp,
151		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
152		autorest.ByUnmarshallingJSON(&result),
153		autorest.ByClosing())
154	result.Response = autorest.Response{Response: resp}
155	return
156}
157
158// Delete deletes the specified local network gateway.
159// Parameters:
160// resourceGroupName - the name of the resource group.
161// localNetworkGatewayName - the name of the local network gateway.
162func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGatewaysDeleteFuture, err error) {
163	if tracing.IsEnabled() {
164		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.Delete")
165		defer func() {
166			sc := -1
167			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
168				sc = result.FutureAPI.Response().StatusCode
169			}
170			tracing.EndSpan(ctx, sc, err)
171		}()
172	}
173	if err := validation.Validate([]validation.Validation{
174		{TargetValue: localNetworkGatewayName,
175			Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
176		return result, validation.NewError("network.LocalNetworkGatewaysClient", "Delete", err.Error())
177	}
178
179	req, err := client.DeletePreparer(ctx, resourceGroupName, localNetworkGatewayName)
180	if err != nil {
181		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
182		return
183	}
184
185	result, err = client.DeleteSender(req)
186	if err != nil {
187		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure sending request")
188		return
189	}
190
191	return
192}
193
194// DeletePreparer prepares the Delete request.
195func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) {
196	pathParameters := map[string]interface{}{
197		"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
198		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
199		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
200	}
201
202	const APIVersion = "2018-02-01"
203	queryParameters := map[string]interface{}{
204		"api-version": APIVersion,
205	}
206
207	preparer := autorest.CreatePreparer(
208		autorest.AsDelete(),
209		autorest.WithBaseURL(client.BaseURI),
210		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
211		autorest.WithQueryParameters(queryParameters))
212	return preparer.Prepare((&http.Request{}).WithContext(ctx))
213}
214
215// DeleteSender sends the Delete request. The method will close the
216// http.Response Body if it receives an error.
217func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) {
218	var resp *http.Response
219	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
220	if err != nil {
221		return
222	}
223	var azf azure.Future
224	azf, err = azure.NewFutureFromResponse(resp)
225	future.FutureAPI = &azf
226	future.Result = func(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) {
227		var done bool
228		done, err = future.DoneWithContext(context.Background(), client)
229		if err != nil {
230			err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure")
231			return
232		}
233		if !done {
234			err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture")
235			return
236		}
237		ar.Response = future.Response()
238		return
239	}
240	return
241}
242
243// DeleteResponder handles the response to the Delete request. The method always
244// closes the http.Response Body.
245func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
246	err = autorest.Respond(
247		resp,
248		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
249		autorest.ByClosing())
250	result.Response = resp
251	return
252}
253
254// Get gets the specified local network gateway in a resource group.
255// Parameters:
256// resourceGroupName - the name of the resource group.
257// localNetworkGatewayName - the name of the local network gateway.
258func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) {
259	if tracing.IsEnabled() {
260		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.Get")
261		defer func() {
262			sc := -1
263			if result.Response.Response != nil {
264				sc = result.Response.Response.StatusCode
265			}
266			tracing.EndSpan(ctx, sc, err)
267		}()
268	}
269	if err := validation.Validate([]validation.Validation{
270		{TargetValue: localNetworkGatewayName,
271			Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
272		return result, validation.NewError("network.LocalNetworkGatewaysClient", "Get", err.Error())
273	}
274
275	req, err := client.GetPreparer(ctx, resourceGroupName, localNetworkGatewayName)
276	if err != nil {
277		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request")
278		return
279	}
280
281	resp, err := client.GetSender(req)
282	if err != nil {
283		result.Response = autorest.Response{Response: resp}
284		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure sending request")
285		return
286	}
287
288	result, err = client.GetResponder(resp)
289	if err != nil {
290		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request")
291		return
292	}
293
294	return
295}
296
297// GetPreparer prepares the Get request.
298func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) {
299	pathParameters := map[string]interface{}{
300		"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
301		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
302		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
303	}
304
305	const APIVersion = "2018-02-01"
306	queryParameters := map[string]interface{}{
307		"api-version": APIVersion,
308	}
309
310	preparer := autorest.CreatePreparer(
311		autorest.AsGet(),
312		autorest.WithBaseURL(client.BaseURI),
313		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
314		autorest.WithQueryParameters(queryParameters))
315	return preparer.Prepare((&http.Request{}).WithContext(ctx))
316}
317
318// GetSender sends the Get request. The method will close the
319// http.Response Body if it receives an error.
320func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
321	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
322}
323
324// GetResponder handles the response to the Get request. The method always
325// closes the http.Response Body.
326func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (result LocalNetworkGateway, err error) {
327	err = autorest.Respond(
328		resp,
329		azure.WithErrorUnlessStatusCode(http.StatusOK),
330		autorest.ByUnmarshallingJSON(&result),
331		autorest.ByClosing())
332	result.Response = autorest.Response{Response: resp}
333	return
334}
335
336// List gets all the local network gateways in a resource group.
337// Parameters:
338// resourceGroupName - the name of the resource group.
339func (client LocalNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultPage, err error) {
340	if tracing.IsEnabled() {
341		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.List")
342		defer func() {
343			sc := -1
344			if result.lnglr.Response.Response != nil {
345				sc = result.lnglr.Response.Response.StatusCode
346			}
347			tracing.EndSpan(ctx, sc, err)
348		}()
349	}
350	result.fn = client.listNextResults
351	req, err := client.ListPreparer(ctx, resourceGroupName)
352	if err != nil {
353		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request")
354		return
355	}
356
357	resp, err := client.ListSender(req)
358	if err != nil {
359		result.lnglr.Response = autorest.Response{Response: resp}
360		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request")
361		return
362	}
363
364	result.lnglr, err = client.ListResponder(resp)
365	if err != nil {
366		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request")
367		return
368	}
369	if result.lnglr.hasNextLink() && result.lnglr.IsEmpty() {
370		err = result.NextWithContext(ctx)
371		return
372	}
373
374	return
375}
376
377// ListPreparer prepares the List request.
378func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
379	pathParameters := map[string]interface{}{
380		"resourceGroupName": autorest.Encode("path", resourceGroupName),
381		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
382	}
383
384	const APIVersion = "2018-02-01"
385	queryParameters := map[string]interface{}{
386		"api-version": APIVersion,
387	}
388
389	preparer := autorest.CreatePreparer(
390		autorest.AsGet(),
391		autorest.WithBaseURL(client.BaseURI),
392		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters),
393		autorest.WithQueryParameters(queryParameters))
394	return preparer.Prepare((&http.Request{}).WithContext(ctx))
395}
396
397// ListSender sends the List request. The method will close the
398// http.Response Body if it receives an error.
399func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
400	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
401}
402
403// ListResponder handles the response to the List request. The method always
404// closes the http.Response Body.
405func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (result LocalNetworkGatewayListResult, err error) {
406	err = autorest.Respond(
407		resp,
408		azure.WithErrorUnlessStatusCode(http.StatusOK),
409		autorest.ByUnmarshallingJSON(&result),
410		autorest.ByClosing())
411	result.Response = autorest.Response{Response: resp}
412	return
413}
414
415// listNextResults retrieves the next set of results, if any.
416func (client LocalNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) {
417	req, err := lastResults.localNetworkGatewayListResultPreparer(ctx)
418	if err != nil {
419		return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
420	}
421	if req == nil {
422		return
423	}
424	resp, err := client.ListSender(req)
425	if err != nil {
426		result.Response = autorest.Response{Response: resp}
427		return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request")
428	}
429	result, err = client.ListResponder(resp)
430	if err != nil {
431		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
432	}
433	return
434}
435
436// ListComplete enumerates all values, automatically crossing page boundaries as required.
437func (client LocalNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultIterator, err error) {
438	if tracing.IsEnabled() {
439		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.List")
440		defer func() {
441			sc := -1
442			if result.Response().Response.Response != nil {
443				sc = result.page.Response().Response.Response.StatusCode
444			}
445			tracing.EndSpan(ctx, sc, err)
446		}()
447	}
448	result.page, err = client.List(ctx, resourceGroupName)
449	return
450}
451
452// UpdateTags updates a local network gateway tags.
453// Parameters:
454// resourceGroupName - the name of the resource group.
455// localNetworkGatewayName - the name of the local network gateway.
456// parameters - parameters supplied to update local network gateway tags.
457func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (result LocalNetworkGatewaysUpdateTagsFuture, err error) {
458	if tracing.IsEnabled() {
459		ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.UpdateTags")
460		defer func() {
461			sc := -1
462			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
463				sc = result.FutureAPI.Response().StatusCode
464			}
465			tracing.EndSpan(ctx, sc, err)
466		}()
467	}
468	if err := validation.Validate([]validation.Validation{
469		{TargetValue: localNetworkGatewayName,
470			Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
471		return result, validation.NewError("network.LocalNetworkGatewaysClient", "UpdateTags", err.Error())
472	}
473
474	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
475	if err != nil {
476		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request")
477		return
478	}
479
480	result, err = client.UpdateTagsSender(req)
481	if err != nil {
482		err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", nil, "Failure sending request")
483		return
484	}
485
486	return
487}
488
489// UpdateTagsPreparer prepares the UpdateTags request.
490func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (*http.Request, error) {
491	pathParameters := map[string]interface{}{
492		"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
493		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
494		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
495	}
496
497	const APIVersion = "2018-02-01"
498	queryParameters := map[string]interface{}{
499		"api-version": APIVersion,
500	}
501
502	preparer := autorest.CreatePreparer(
503		autorest.AsContentType("application/json; charset=utf-8"),
504		autorest.AsPatch(),
505		autorest.WithBaseURL(client.BaseURI),
506		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
507		autorest.WithJSON(parameters),
508		autorest.WithQueryParameters(queryParameters))
509	return preparer.Prepare((&http.Request{}).WithContext(ctx))
510}
511
512// UpdateTagsSender sends the UpdateTags request. The method will close the
513// http.Response Body if it receives an error.
514func (client LocalNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future LocalNetworkGatewaysUpdateTagsFuture, err error) {
515	var resp *http.Response
516	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
517	if err != nil {
518		return
519	}
520	var azf azure.Future
521	azf, err = azure.NewFutureFromResponse(resp)
522	future.FutureAPI = &azf
523	future.Result = func(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) {
524		var done bool
525		done, err = future.DoneWithContext(context.Background(), client)
526		if err != nil {
527			err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure")
528			return
529		}
530		if !done {
531			err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysUpdateTagsFuture")
532			return
533		}
534		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
535		lng.Response.Response, err = future.GetResult(sender)
536		if lng.Response.Response == nil && err == nil {
537			err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", nil, "received nil response and error")
538		}
539		if err == nil && lng.Response.Response.StatusCode != http.StatusNoContent {
540			lng, err = client.UpdateTagsResponder(lng.Response.Response)
541			if err != nil {
542				err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", lng.Response.Response, "Failure responding to request")
543			}
544		}
545		return
546	}
547	return
548}
549
550// UpdateTagsResponder handles the response to the UpdateTags request. The method always
551// closes the http.Response Body.
552func (client LocalNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result LocalNetworkGateway, err error) {
553	err = autorest.Respond(
554		resp,
555		azure.WithErrorUnlessStatusCode(http.StatusOK),
556		autorest.ByUnmarshallingJSON(&result),
557		autorest.ByClosing())
558	result.Response = autorest.Response{Response: resp}
559	return
560}
561