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	"net/http"
26)
27
28// VirtualNetworkTapsClient is the network Client
29type VirtualNetworkTapsClient struct {
30	BaseClient
31}
32
33// NewVirtualNetworkTapsClient creates an instance of the VirtualNetworkTapsClient client.
34func NewVirtualNetworkTapsClient(subscriptionID string) VirtualNetworkTapsClient {
35	return NewVirtualNetworkTapsClientWithBaseURI(DefaultBaseURI, subscriptionID)
36}
37
38// NewVirtualNetworkTapsClientWithBaseURI creates an instance of the VirtualNetworkTapsClient client.
39func NewVirtualNetworkTapsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkTapsClient {
40	return VirtualNetworkTapsClient{NewWithBaseURI(baseURI, subscriptionID)}
41}
42
43// CreateOrUpdate creates or updates a Virtual Network Tap.
44// Parameters:
45// resourceGroupName - the name of the resource group.
46// tapName - the name of the virtual network tap.
47// parameters - parameters supplied to the create or update virtual network tap operation.
48func (client VirtualNetworkTapsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (result VirtualNetworkTapsCreateOrUpdateFuture, err error) {
49	if err := validation.Validate([]validation.Validation{
50		{TargetValue: parameters,
51			Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat", Name: validation.Null, Rule: false,
52				Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration", Name: validation.Null, Rule: false,
53					Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
54						Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false,
55							Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
56								Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
57									Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
58										Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
59									}},
60								}},
61							}},
62						}},
63					}},
64					{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration", Name: validation.Null, Rule: false,
65						Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
66							Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false,
67								Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
68									Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
69										Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
70											Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
71										}},
72									}},
73								}},
74							}},
75						}},
76				}}}}}); err != nil {
77		return result, validation.NewError("network.VirtualNetworkTapsClient", "CreateOrUpdate", err.Error())
78	}
79
80	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, tapName, parameters)
81	if err != nil {
82		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", nil, "Failure preparing request")
83		return
84	}
85
86	result, err = client.CreateOrUpdateSender(req)
87	if err != nil {
88		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
89		return
90	}
91
92	return
93}
94
95// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
96func (client VirtualNetworkTapsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (*http.Request, error) {
97	pathParameters := map[string]interface{}{
98		"resourceGroupName": autorest.Encode("path", resourceGroupName),
99		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
100		"tapName":           autorest.Encode("path", tapName),
101	}
102
103	const APIVersion = "2018-08-01"
104	queryParameters := map[string]interface{}{
105		"api-version": APIVersion,
106	}
107
108	preparer := autorest.CreatePreparer(
109		autorest.AsContentType("application/json; charset=utf-8"),
110		autorest.AsPut(),
111		autorest.WithBaseURL(client.BaseURI),
112		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
113		autorest.WithJSON(parameters),
114		autorest.WithQueryParameters(queryParameters))
115	return preparer.Prepare((&http.Request{}).WithContext(ctx))
116}
117
118// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
119// http.Response Body if it receives an error.
120func (client VirtualNetworkTapsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkTapsCreateOrUpdateFuture, err error) {
121	var resp *http.Response
122	resp, err = autorest.SendWithSender(client, req,
123		azure.DoRetryWithRegistration(client.Client))
124	if err != nil {
125		return
126	}
127	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
128	if err != nil {
129		return
130	}
131	future.Future, err = azure.NewFutureFromResponse(resp)
132	return
133}
134
135// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
136// closes the http.Response Body.
137func (client VirtualNetworkTapsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
138	err = autorest.Respond(
139		resp,
140		client.ByInspecting(),
141		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
142		autorest.ByUnmarshallingJSON(&result),
143		autorest.ByClosing())
144	result.Response = autorest.Response{Response: resp}
145	return
146}
147
148// Delete deletes the specified virtual network tap.
149// Parameters:
150// resourceGroupName - the name of the resource group.
151// tapName - the name of the virtual network tap.
152func (client VirtualNetworkTapsClient) Delete(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTapsDeleteFuture, err error) {
153	req, err := client.DeletePreparer(ctx, resourceGroupName, tapName)
154	if err != nil {
155		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", nil, "Failure preparing request")
156		return
157	}
158
159	result, err = client.DeleteSender(req)
160	if err != nil {
161		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", result.Response(), "Failure sending request")
162		return
163	}
164
165	return
166}
167
168// DeletePreparer prepares the Delete request.
169func (client VirtualNetworkTapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) {
170	pathParameters := map[string]interface{}{
171		"resourceGroupName": autorest.Encode("path", resourceGroupName),
172		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
173		"tapName":           autorest.Encode("path", tapName),
174	}
175
176	const APIVersion = "2018-08-01"
177	queryParameters := map[string]interface{}{
178		"api-version": APIVersion,
179	}
180
181	preparer := autorest.CreatePreparer(
182		autorest.AsDelete(),
183		autorest.WithBaseURL(client.BaseURI),
184		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
185		autorest.WithQueryParameters(queryParameters))
186	return preparer.Prepare((&http.Request{}).WithContext(ctx))
187}
188
189// DeleteSender sends the Delete request. The method will close the
190// http.Response Body if it receives an error.
191func (client VirtualNetworkTapsClient) DeleteSender(req *http.Request) (future VirtualNetworkTapsDeleteFuture, err error) {
192	var resp *http.Response
193	resp, err = autorest.SendWithSender(client, req,
194		azure.DoRetryWithRegistration(client.Client))
195	if err != nil {
196		return
197	}
198	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
199	if err != nil {
200		return
201	}
202	future.Future, err = azure.NewFutureFromResponse(resp)
203	return
204}
205
206// DeleteResponder handles the response to the Delete request. The method always
207// closes the http.Response Body.
208func (client VirtualNetworkTapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
209	err = autorest.Respond(
210		resp,
211		client.ByInspecting(),
212		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
213		autorest.ByClosing())
214	result.Response = resp
215	return
216}
217
218// Get gets information about the specified virtual network tap.
219// Parameters:
220// resourceGroupName - the name of the resource group.
221// tapName - the name of virtual network tap.
222func (client VirtualNetworkTapsClient) Get(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTap, err error) {
223	req, err := client.GetPreparer(ctx, resourceGroupName, tapName)
224	if err != nil {
225		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", nil, "Failure preparing request")
226		return
227	}
228
229	resp, err := client.GetSender(req)
230	if err != nil {
231		result.Response = autorest.Response{Response: resp}
232		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure sending request")
233		return
234	}
235
236	result, err = client.GetResponder(resp)
237	if err != nil {
238		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure responding to request")
239	}
240
241	return
242}
243
244// GetPreparer prepares the Get request.
245func (client VirtualNetworkTapsClient) GetPreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) {
246	pathParameters := map[string]interface{}{
247		"resourceGroupName": autorest.Encode("path", resourceGroupName),
248		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
249		"tapName":           autorest.Encode("path", tapName),
250	}
251
252	const APIVersion = "2018-08-01"
253	queryParameters := map[string]interface{}{
254		"api-version": APIVersion,
255	}
256
257	preparer := autorest.CreatePreparer(
258		autorest.AsGet(),
259		autorest.WithBaseURL(client.BaseURI),
260		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
261		autorest.WithQueryParameters(queryParameters))
262	return preparer.Prepare((&http.Request{}).WithContext(ctx))
263}
264
265// GetSender sends the Get request. The method will close the
266// http.Response Body if it receives an error.
267func (client VirtualNetworkTapsClient) GetSender(req *http.Request) (*http.Response, error) {
268	return autorest.SendWithSender(client, req,
269		azure.DoRetryWithRegistration(client.Client))
270}
271
272// GetResponder handles the response to the Get request. The method always
273// closes the http.Response Body.
274func (client VirtualNetworkTapsClient) GetResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
275	err = autorest.Respond(
276		resp,
277		client.ByInspecting(),
278		azure.WithErrorUnlessStatusCode(http.StatusOK),
279		autorest.ByUnmarshallingJSON(&result),
280		autorest.ByClosing())
281	result.Response = autorest.Response{Response: resp}
282	return
283}
284
285// ListAll gets all the VirtualNetworkTaps in a subscription.
286func (client VirtualNetworkTapsClient) ListAll(ctx context.Context) (result VirtualNetworkTapListResultPage, err error) {
287	result.fn = client.listAllNextResults
288	req, err := client.ListAllPreparer(ctx)
289	if err != nil {
290		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", nil, "Failure preparing request")
291		return
292	}
293
294	resp, err := client.ListAllSender(req)
295	if err != nil {
296		result.vntlr.Response = autorest.Response{Response: resp}
297		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure sending request")
298		return
299	}
300
301	result.vntlr, err = client.ListAllResponder(resp)
302	if err != nil {
303		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure responding to request")
304	}
305
306	return
307}
308
309// ListAllPreparer prepares the ListAll request.
310func (client VirtualNetworkTapsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
311	pathParameters := map[string]interface{}{
312		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
313	}
314
315	const APIVersion = "2018-08-01"
316	queryParameters := map[string]interface{}{
317		"api-version": APIVersion,
318	}
319
320	preparer := autorest.CreatePreparer(
321		autorest.AsGet(),
322		autorest.WithBaseURL(client.BaseURI),
323		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters),
324		autorest.WithQueryParameters(queryParameters))
325	return preparer.Prepare((&http.Request{}).WithContext(ctx))
326}
327
328// ListAllSender sends the ListAll request. The method will close the
329// http.Response Body if it receives an error.
330func (client VirtualNetworkTapsClient) ListAllSender(req *http.Request) (*http.Response, error) {
331	return autorest.SendWithSender(client, req,
332		azure.DoRetryWithRegistration(client.Client))
333}
334
335// ListAllResponder handles the response to the ListAll request. The method always
336// closes the http.Response Body.
337func (client VirtualNetworkTapsClient) ListAllResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) {
338	err = autorest.Respond(
339		resp,
340		client.ByInspecting(),
341		azure.WithErrorUnlessStatusCode(http.StatusOK),
342		autorest.ByUnmarshallingJSON(&result),
343		autorest.ByClosing())
344	result.Response = autorest.Response{Response: resp}
345	return
346}
347
348// listAllNextResults retrieves the next set of results, if any.
349func (client VirtualNetworkTapsClient) listAllNextResults(lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) {
350	req, err := lastResults.virtualNetworkTapListResultPreparer()
351	if err != nil {
352		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", nil, "Failure preparing next results request")
353	}
354	if req == nil {
355		return
356	}
357	resp, err := client.ListAllSender(req)
358	if err != nil {
359		result.Response = autorest.Response{Response: resp}
360		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure sending next results request")
361	}
362	result, err = client.ListAllResponder(resp)
363	if err != nil {
364		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure responding to next results request")
365	}
366	return
367}
368
369// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
370func (client VirtualNetworkTapsClient) ListAllComplete(ctx context.Context) (result VirtualNetworkTapListResultIterator, err error) {
371	result.page, err = client.ListAll(ctx)
372	return
373}
374
375// ListByResourceGroup gets all the VirtualNetworkTaps in a subscription.
376// Parameters:
377// resourceGroupName - the name of the resource group.
378func (client VirtualNetworkTapsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultPage, err error) {
379	result.fn = client.listByResourceGroupNextResults
380	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
381	if err != nil {
382		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", nil, "Failure preparing request")
383		return
384	}
385
386	resp, err := client.ListByResourceGroupSender(req)
387	if err != nil {
388		result.vntlr.Response = autorest.Response{Response: resp}
389		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure sending request")
390		return
391	}
392
393	result.vntlr, err = client.ListByResourceGroupResponder(resp)
394	if err != nil {
395		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure responding to request")
396	}
397
398	return
399}
400
401// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
402func (client VirtualNetworkTapsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
403	pathParameters := map[string]interface{}{
404		"resourceGroupName": autorest.Encode("path", resourceGroupName),
405		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
406	}
407
408	const APIVersion = "2018-08-01"
409	queryParameters := map[string]interface{}{
410		"api-version": APIVersion,
411	}
412
413	preparer := autorest.CreatePreparer(
414		autorest.AsGet(),
415		autorest.WithBaseURL(client.BaseURI),
416		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters),
417		autorest.WithQueryParameters(queryParameters))
418	return preparer.Prepare((&http.Request{}).WithContext(ctx))
419}
420
421// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
422// http.Response Body if it receives an error.
423func (client VirtualNetworkTapsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
424	return autorest.SendWithSender(client, req,
425		azure.DoRetryWithRegistration(client.Client))
426}
427
428// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
429// closes the http.Response Body.
430func (client VirtualNetworkTapsClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) {
431	err = autorest.Respond(
432		resp,
433		client.ByInspecting(),
434		azure.WithErrorUnlessStatusCode(http.StatusOK),
435		autorest.ByUnmarshallingJSON(&result),
436		autorest.ByClosing())
437	result.Response = autorest.Response{Response: resp}
438	return
439}
440
441// listByResourceGroupNextResults retrieves the next set of results, if any.
442func (client VirtualNetworkTapsClient) listByResourceGroupNextResults(lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) {
443	req, err := lastResults.virtualNetworkTapListResultPreparer()
444	if err != nil {
445		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
446	}
447	if req == nil {
448		return
449	}
450	resp, err := client.ListByResourceGroupSender(req)
451	if err != nil {
452		result.Response = autorest.Response{Response: resp}
453		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
454	}
455	result, err = client.ListByResourceGroupResponder(resp)
456	if err != nil {
457		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
458	}
459	return
460}
461
462// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
463func (client VirtualNetworkTapsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultIterator, err error) {
464	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
465	return
466}
467
468// UpdateTags updates an VirtualNetworkTap tags.
469// Parameters:
470// resourceGroupName - the name of the resource group.
471// tapName - the name of the tap.
472// tapParameters - parameters supplied to update VirtualNetworkTap tags.
473func (client VirtualNetworkTapsClient) UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (result VirtualNetworkTapsUpdateTagsFuture, err error) {
474	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, tapName, tapParameters)
475	if err != nil {
476		err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "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.VirtualNetworkTapsClient", "UpdateTags", result.Response(), "Failure sending request")
483		return
484	}
485
486	return
487}
488
489// UpdateTagsPreparer prepares the UpdateTags request.
490func (client VirtualNetworkTapsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (*http.Request, error) {
491	pathParameters := map[string]interface{}{
492		"resourceGroupName": autorest.Encode("path", resourceGroupName),
493		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
494		"tapName":           autorest.Encode("path", tapName),
495	}
496
497	const APIVersion = "2018-08-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/virtualNetworkTaps/{tapName}", pathParameters),
507		autorest.WithJSON(tapParameters),
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 VirtualNetworkTapsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkTapsUpdateTagsFuture, err error) {
515	var resp *http.Response
516	resp, err = autorest.SendWithSender(client, req,
517		azure.DoRetryWithRegistration(client.Client))
518	if err != nil {
519		return
520	}
521	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK))
522	if err != nil {
523		return
524	}
525	future.Future, err = azure.NewFutureFromResponse(resp)
526	return
527}
528
529// UpdateTagsResponder handles the response to the UpdateTags request. The method always
530// closes the http.Response Body.
531func (client VirtualNetworkTapsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
532	err = autorest.Respond(
533		resp,
534		client.ByInspecting(),
535		azure.WithErrorUnlessStatusCode(http.StatusOK),
536		autorest.ByUnmarshallingJSON(&result),
537		autorest.ByClosing())
538	result.Response = autorest.Response{Response: resp}
539	return
540}
541