1 package network
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 type VirtualNetworkTapsClient struct {
20 BaseClient
21 }
22
23
24 func NewVirtualNetworkTapsClient(subscriptionID string) VirtualNetworkTapsClient {
25 return NewVirtualNetworkTapsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30
31 func NewVirtualNetworkTapsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkTapsClient {
32 return VirtualNetworkTapsClient{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40 func (client VirtualNetworkTapsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (result VirtualNetworkTapsCreateOrUpdateFuture, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.CreateOrUpdate")
43 defer func() {
44 sc := -1
45 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
46 sc = result.FutureAPI.Response().StatusCode
47 }
48 tracing.EndSpan(ctx, sc, err)
49 }()
50 }
51 if err := validation.Validate([]validation.Validation{
52 {TargetValue: parameters,
53 Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat", Name: validation.Null, Rule: false,
54 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration", Name: validation.Null, Rule: false,
55 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
56 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false,
57 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
58 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
59 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
60 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
61 }},
62 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
63 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
64 }},
65 }},
66 }},
67 }},
68 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration", Name: validation.Null, Rule: false,
69 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
70 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false,
71 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
72 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
73 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
74 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
75 }},
76 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
77 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
78 }},
79 }},
80 }},
81 }},
82 }}}}}); err != nil {
83 return result, validation.NewError("network.VirtualNetworkTapsClient", "CreateOrUpdate", err.Error())
84 }
85
86 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, tapName, parameters)
87 if err != nil {
88 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", nil, "Failure preparing request")
89 return
90 }
91
92 result, err = client.CreateOrUpdateSender(req)
93 if err != nil {
94 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
95 return
96 }
97
98 return
99 }
100
101
102 func (client VirtualNetworkTapsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (*http.Request, error) {
103 pathParameters := map[string]interface{}{
104 "resourceGroupName": autorest.Encode("path", resourceGroupName),
105 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
106 "tapName": autorest.Encode("path", tapName),
107 }
108
109 const APIVersion = "2022-01-01"
110 queryParameters := map[string]interface{}{
111 "api-version": APIVersion,
112 }
113
114 parameters.Etag = nil
115 preparer := autorest.CreatePreparer(
116 autorest.AsContentType("application/json; charset=utf-8"),
117 autorest.AsPut(),
118 autorest.WithBaseURL(client.BaseURI),
119 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
120 autorest.WithJSON(parameters),
121 autorest.WithQueryParameters(queryParameters))
122 return preparer.Prepare((&http.Request{}).WithContext(ctx))
123 }
124
125
126
127 func (client VirtualNetworkTapsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkTapsCreateOrUpdateFuture, err error) {
128 var resp *http.Response
129 future.FutureAPI = &azure.Future{}
130 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
131 if err != nil {
132 return
133 }
134 var azf azure.Future
135 azf, err = azure.NewFutureFromResponse(resp)
136 future.FutureAPI = &azf
137 future.Result = future.result
138 return
139 }
140
141
142
143 func (client VirtualNetworkTapsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
144 err = autorest.Respond(
145 resp,
146 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
147 autorest.ByUnmarshallingJSON(&result),
148 autorest.ByClosing())
149 result.Response = autorest.Response{Response: resp}
150 return
151 }
152
153
154
155
156
157 func (client VirtualNetworkTapsClient) Delete(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTapsDeleteFuture, err error) {
158 if tracing.IsEnabled() {
159 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Delete")
160 defer func() {
161 sc := -1
162 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
163 sc = result.FutureAPI.Response().StatusCode
164 }
165 tracing.EndSpan(ctx, sc, err)
166 }()
167 }
168 req, err := client.DeletePreparer(ctx, resourceGroupName, tapName)
169 if err != nil {
170 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", nil, "Failure preparing request")
171 return
172 }
173
174 result, err = client.DeleteSender(req)
175 if err != nil {
176 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", result.Response(), "Failure sending request")
177 return
178 }
179
180 return
181 }
182
183
184 func (client VirtualNetworkTapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) {
185 pathParameters := map[string]interface{}{
186 "resourceGroupName": autorest.Encode("path", resourceGroupName),
187 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
188 "tapName": autorest.Encode("path", tapName),
189 }
190
191 const APIVersion = "2022-01-01"
192 queryParameters := map[string]interface{}{
193 "api-version": APIVersion,
194 }
195
196 preparer := autorest.CreatePreparer(
197 autorest.AsDelete(),
198 autorest.WithBaseURL(client.BaseURI),
199 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
200 autorest.WithQueryParameters(queryParameters))
201 return preparer.Prepare((&http.Request{}).WithContext(ctx))
202 }
203
204
205
206 func (client VirtualNetworkTapsClient) DeleteSender(req *http.Request) (future VirtualNetworkTapsDeleteFuture, err error) {
207 var resp *http.Response
208 future.FutureAPI = &azure.Future{}
209 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
210 if err != nil {
211 return
212 }
213 var azf azure.Future
214 azf, err = azure.NewFutureFromResponse(resp)
215 future.FutureAPI = &azf
216 future.Result = future.result
217 return
218 }
219
220
221
222 func (client VirtualNetworkTapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
223 err = autorest.Respond(
224 resp,
225 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
226 autorest.ByClosing())
227 result.Response = resp
228 return
229 }
230
231
232
233
234
235 func (client VirtualNetworkTapsClient) Get(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTap, err error) {
236 if tracing.IsEnabled() {
237 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Get")
238 defer func() {
239 sc := -1
240 if result.Response.Response != nil {
241 sc = result.Response.Response.StatusCode
242 }
243 tracing.EndSpan(ctx, sc, err)
244 }()
245 }
246 req, err := client.GetPreparer(ctx, resourceGroupName, tapName)
247 if err != nil {
248 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", nil, "Failure preparing request")
249 return
250 }
251
252 resp, err := client.GetSender(req)
253 if err != nil {
254 result.Response = autorest.Response{Response: resp}
255 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure sending request")
256 return
257 }
258
259 result, err = client.GetResponder(resp)
260 if err != nil {
261 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure responding to request")
262 return
263 }
264
265 return
266 }
267
268
269 func (client VirtualNetworkTapsClient) GetPreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) {
270 pathParameters := map[string]interface{}{
271 "resourceGroupName": autorest.Encode("path", resourceGroupName),
272 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
273 "tapName": autorest.Encode("path", tapName),
274 }
275
276 const APIVersion = "2022-01-01"
277 queryParameters := map[string]interface{}{
278 "api-version": APIVersion,
279 }
280
281 preparer := autorest.CreatePreparer(
282 autorest.AsGet(),
283 autorest.WithBaseURL(client.BaseURI),
284 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
285 autorest.WithQueryParameters(queryParameters))
286 return preparer.Prepare((&http.Request{}).WithContext(ctx))
287 }
288
289
290
291 func (client VirtualNetworkTapsClient) GetSender(req *http.Request) (*http.Response, error) {
292 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
293 }
294
295
296
297 func (client VirtualNetworkTapsClient) GetResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
298 err = autorest.Respond(
299 resp,
300 azure.WithErrorUnlessStatusCode(http.StatusOK),
301 autorest.ByUnmarshallingJSON(&result),
302 autorest.ByClosing())
303 result.Response = autorest.Response{Response: resp}
304 return
305 }
306
307
308 func (client VirtualNetworkTapsClient) ListAll(ctx context.Context) (result VirtualNetworkTapListResultPage, err error) {
309 if tracing.IsEnabled() {
310 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll")
311 defer func() {
312 sc := -1
313 if result.vntlr.Response.Response != nil {
314 sc = result.vntlr.Response.Response.StatusCode
315 }
316 tracing.EndSpan(ctx, sc, err)
317 }()
318 }
319 result.fn = client.listAllNextResults
320 req, err := client.ListAllPreparer(ctx)
321 if err != nil {
322 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", nil, "Failure preparing request")
323 return
324 }
325
326 resp, err := client.ListAllSender(req)
327 if err != nil {
328 result.vntlr.Response = autorest.Response{Response: resp}
329 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure sending request")
330 return
331 }
332
333 result.vntlr, err = client.ListAllResponder(resp)
334 if err != nil {
335 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure responding to request")
336 return
337 }
338 if result.vntlr.hasNextLink() && result.vntlr.IsEmpty() {
339 err = result.NextWithContext(ctx)
340 return
341 }
342
343 return
344 }
345
346
347 func (client VirtualNetworkTapsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
348 pathParameters := map[string]interface{}{
349 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
350 }
351
352 const APIVersion = "2022-01-01"
353 queryParameters := map[string]interface{}{
354 "api-version": APIVersion,
355 }
356
357 preparer := autorest.CreatePreparer(
358 autorest.AsGet(),
359 autorest.WithBaseURL(client.BaseURI),
360 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters),
361 autorest.WithQueryParameters(queryParameters))
362 return preparer.Prepare((&http.Request{}).WithContext(ctx))
363 }
364
365
366
367 func (client VirtualNetworkTapsClient) ListAllSender(req *http.Request) (*http.Response, error) {
368 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
369 }
370
371
372
373 func (client VirtualNetworkTapsClient) ListAllResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) {
374 err = autorest.Respond(
375 resp,
376 azure.WithErrorUnlessStatusCode(http.StatusOK),
377 autorest.ByUnmarshallingJSON(&result),
378 autorest.ByClosing())
379 result.Response = autorest.Response{Response: resp}
380 return
381 }
382
383
384 func (client VirtualNetworkTapsClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) {
385 req, err := lastResults.virtualNetworkTapListResultPreparer(ctx)
386 if err != nil {
387 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", nil, "Failure preparing next results request")
388 }
389 if req == nil {
390 return
391 }
392 resp, err := client.ListAllSender(req)
393 if err != nil {
394 result.Response = autorest.Response{Response: resp}
395 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure sending next results request")
396 }
397 result, err = client.ListAllResponder(resp)
398 if err != nil {
399 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure responding to next results request")
400 }
401 return
402 }
403
404
405 func (client VirtualNetworkTapsClient) ListAllComplete(ctx context.Context) (result VirtualNetworkTapListResultIterator, err error) {
406 if tracing.IsEnabled() {
407 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll")
408 defer func() {
409 sc := -1
410 if result.Response().Response.Response != nil {
411 sc = result.page.Response().Response.Response.StatusCode
412 }
413 tracing.EndSpan(ctx, sc, err)
414 }()
415 }
416 result.page, err = client.ListAll(ctx)
417 return
418 }
419
420
421
422
423 func (client VirtualNetworkTapsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultPage, err error) {
424 if tracing.IsEnabled() {
425 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup")
426 defer func() {
427 sc := -1
428 if result.vntlr.Response.Response != nil {
429 sc = result.vntlr.Response.Response.StatusCode
430 }
431 tracing.EndSpan(ctx, sc, err)
432 }()
433 }
434 result.fn = client.listByResourceGroupNextResults
435 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
436 if err != nil {
437 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", nil, "Failure preparing request")
438 return
439 }
440
441 resp, err := client.ListByResourceGroupSender(req)
442 if err != nil {
443 result.vntlr.Response = autorest.Response{Response: resp}
444 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure sending request")
445 return
446 }
447
448 result.vntlr, err = client.ListByResourceGroupResponder(resp)
449 if err != nil {
450 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure responding to request")
451 return
452 }
453 if result.vntlr.hasNextLink() && result.vntlr.IsEmpty() {
454 err = result.NextWithContext(ctx)
455 return
456 }
457
458 return
459 }
460
461
462 func (client VirtualNetworkTapsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
463 pathParameters := map[string]interface{}{
464 "resourceGroupName": autorest.Encode("path", resourceGroupName),
465 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
466 }
467
468 const APIVersion = "2022-01-01"
469 queryParameters := map[string]interface{}{
470 "api-version": APIVersion,
471 }
472
473 preparer := autorest.CreatePreparer(
474 autorest.AsGet(),
475 autorest.WithBaseURL(client.BaseURI),
476 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters),
477 autorest.WithQueryParameters(queryParameters))
478 return preparer.Prepare((&http.Request{}).WithContext(ctx))
479 }
480
481
482
483 func (client VirtualNetworkTapsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
484 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
485 }
486
487
488
489 func (client VirtualNetworkTapsClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) {
490 err = autorest.Respond(
491 resp,
492 azure.WithErrorUnlessStatusCode(http.StatusOK),
493 autorest.ByUnmarshallingJSON(&result),
494 autorest.ByClosing())
495 result.Response = autorest.Response{Response: resp}
496 return
497 }
498
499
500 func (client VirtualNetworkTapsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) {
501 req, err := lastResults.virtualNetworkTapListResultPreparer(ctx)
502 if err != nil {
503 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
504 }
505 if req == nil {
506 return
507 }
508 resp, err := client.ListByResourceGroupSender(req)
509 if err != nil {
510 result.Response = autorest.Response{Response: resp}
511 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
512 }
513 result, err = client.ListByResourceGroupResponder(resp)
514 if err != nil {
515 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
516 }
517 return
518 }
519
520
521 func (client VirtualNetworkTapsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultIterator, err error) {
522 if tracing.IsEnabled() {
523 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup")
524 defer func() {
525 sc := -1
526 if result.Response().Response.Response != nil {
527 sc = result.page.Response().Response.Response.StatusCode
528 }
529 tracing.EndSpan(ctx, sc, err)
530 }()
531 }
532 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
533 return
534 }
535
536
537
538
539
540
541 func (client VirtualNetworkTapsClient) UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (result VirtualNetworkTap, err error) {
542 if tracing.IsEnabled() {
543 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.UpdateTags")
544 defer func() {
545 sc := -1
546 if result.Response.Response != nil {
547 sc = result.Response.Response.StatusCode
548 }
549 tracing.EndSpan(ctx, sc, err)
550 }()
551 }
552 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, tapName, tapParameters)
553 if err != nil {
554 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", nil, "Failure preparing request")
555 return
556 }
557
558 resp, err := client.UpdateTagsSender(req)
559 if err != nil {
560 result.Response = autorest.Response{Response: resp}
561 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", resp, "Failure sending request")
562 return
563 }
564
565 result, err = client.UpdateTagsResponder(resp)
566 if err != nil {
567 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", resp, "Failure responding to request")
568 return
569 }
570
571 return
572 }
573
574
575 func (client VirtualNetworkTapsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (*http.Request, error) {
576 pathParameters := map[string]interface{}{
577 "resourceGroupName": autorest.Encode("path", resourceGroupName),
578 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
579 "tapName": autorest.Encode("path", tapName),
580 }
581
582 const APIVersion = "2022-01-01"
583 queryParameters := map[string]interface{}{
584 "api-version": APIVersion,
585 }
586
587 preparer := autorest.CreatePreparer(
588 autorest.AsContentType("application/json; charset=utf-8"),
589 autorest.AsPatch(),
590 autorest.WithBaseURL(client.BaseURI),
591 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters),
592 autorest.WithJSON(tapParameters),
593 autorest.WithQueryParameters(queryParameters))
594 return preparer.Prepare((&http.Request{}).WithContext(ctx))
595 }
596
597
598
599 func (client VirtualNetworkTapsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) {
600 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
601 }
602
603
604
605 func (client VirtualNetworkTapsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkTap, err error) {
606 err = autorest.Respond(
607 resp,
608 azure.WithErrorUnlessStatusCode(http.StatusOK),
609 autorest.ByUnmarshallingJSON(&result),
610 autorest.ByClosing())
611 result.Response = autorest.Response{Response: resp}
612 return
613 }
614
View as plain text