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 WatchersClient struct {
20 BaseClient
21 }
22
23
24 func NewWatchersClient(subscriptionID string) WatchersClient {
25 return NewWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) WatchersClient {
31 return WatchersClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39
40 func (client WatchersClient) CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (result WatchersCheckConnectivityFuture, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CheckConnectivity")
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.Source", Name: validation.Null, Rule: true,
54 Chain: []validation.Constraint{{Target: "parameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil},
55 {Target: "parameters.Source.Port", Name: validation.Null, Rule: false,
56 Chain: []validation.Constraint{{Target: "parameters.Source.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil},
57 {Target: "parameters.Source.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
58 }},
59 }},
60 {Target: "parameters.Destination", Name: validation.Null, Rule: true,
61 Chain: []validation.Constraint{{Target: "parameters.Destination.Port", Name: validation.Null, Rule: false,
62 Chain: []validation.Constraint{{Target: "parameters.Destination.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil},
63 {Target: "parameters.Destination.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
64 }},
65 }}}}}); err != nil {
66 return result, validation.NewError("network.WatchersClient", "CheckConnectivity", err.Error())
67 }
68
69 req, err := client.CheckConnectivityPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
70 if err != nil {
71 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", nil, "Failure preparing request")
72 return
73 }
74
75 result, err = client.CheckConnectivitySender(req)
76 if err != nil {
77 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", result.Response(), "Failure sending request")
78 return
79 }
80
81 return
82 }
83
84
85 func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (*http.Request, error) {
86 pathParameters := map[string]interface{}{
87 "networkWatcherName": autorest.Encode("path", networkWatcherName),
88 "resourceGroupName": autorest.Encode("path", resourceGroupName),
89 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
90 }
91
92 const APIVersion = "2022-05-01"
93 queryParameters := map[string]interface{}{
94 "api-version": APIVersion,
95 }
96
97 preparer := autorest.CreatePreparer(
98 autorest.AsContentType("application/json; charset=utf-8"),
99 autorest.AsPost(),
100 autorest.WithBaseURL(client.BaseURI),
101 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck", pathParameters),
102 autorest.WithJSON(parameters),
103 autorest.WithQueryParameters(queryParameters))
104 return preparer.Prepare((&http.Request{}).WithContext(ctx))
105 }
106
107
108
109 func (client WatchersClient) CheckConnectivitySender(req *http.Request) (future WatchersCheckConnectivityFuture, err error) {
110 var resp *http.Response
111 future.FutureAPI = &azure.Future{}
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 = future.result
120 return
121 }
122
123
124
125 func (client WatchersClient) CheckConnectivityResponder(resp *http.Response) (result ConnectivityInformation, err error) {
126 err = autorest.Respond(
127 resp,
128 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
129 autorest.ByUnmarshallingJSON(&result),
130 autorest.ByClosing())
131 result.Response = autorest.Response{Response: resp}
132 return
133 }
134
135
136
137
138
139
140 func (client WatchersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) {
141 if tracing.IsEnabled() {
142 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CreateOrUpdate")
143 defer func() {
144 sc := -1
145 if result.Response.Response != nil {
146 sc = result.Response.Response.StatusCode
147 }
148 tracing.EndSpan(ctx, sc, err)
149 }()
150 }
151 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, parameters)
152 if err != nil {
153 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", nil, "Failure preparing request")
154 return
155 }
156
157 resp, err := client.CreateOrUpdateSender(req)
158 if err != nil {
159 result.Response = autorest.Response{Response: resp}
160 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure sending request")
161 return
162 }
163
164 result, err = client.CreateOrUpdateResponder(resp)
165 if err != nil {
166 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure responding to request")
167 return
168 }
169
170 return
171 }
172
173
174 func (client WatchersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (*http.Request, error) {
175 pathParameters := map[string]interface{}{
176 "networkWatcherName": autorest.Encode("path", networkWatcherName),
177 "resourceGroupName": autorest.Encode("path", resourceGroupName),
178 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
179 }
180
181 const APIVersion = "2022-05-01"
182 queryParameters := map[string]interface{}{
183 "api-version": APIVersion,
184 }
185
186 parameters.Etag = nil
187 preparer := autorest.CreatePreparer(
188 autorest.AsContentType("application/json; charset=utf-8"),
189 autorest.AsPut(),
190 autorest.WithBaseURL(client.BaseURI),
191 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
192 autorest.WithJSON(parameters),
193 autorest.WithQueryParameters(queryParameters))
194 return preparer.Prepare((&http.Request{}).WithContext(ctx))
195 }
196
197
198
199 func (client WatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
200 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
201 }
202
203
204
205 func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) {
206 err = autorest.Respond(
207 resp,
208 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
209 autorest.ByUnmarshallingJSON(&result),
210 autorest.ByClosing())
211 result.Response = autorest.Response{Response: resp}
212 return
213 }
214
215
216
217
218
219 func (client WatchersClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result WatchersDeleteFuture, err error) {
220 if tracing.IsEnabled() {
221 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Delete")
222 defer func() {
223 sc := -1
224 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
225 sc = result.FutureAPI.Response().StatusCode
226 }
227 tracing.EndSpan(ctx, sc, err)
228 }()
229 }
230 req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName)
231 if err != nil {
232 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure preparing request")
233 return
234 }
235
236 result, err = client.DeleteSender(req)
237 if err != nil {
238 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", result.Response(), "Failure sending request")
239 return
240 }
241
242 return
243 }
244
245
246 func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) {
247 pathParameters := map[string]interface{}{
248 "networkWatcherName": autorest.Encode("path", networkWatcherName),
249 "resourceGroupName": autorest.Encode("path", resourceGroupName),
250 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
251 }
252
253 const APIVersion = "2022-05-01"
254 queryParameters := map[string]interface{}{
255 "api-version": APIVersion,
256 }
257
258 preparer := autorest.CreatePreparer(
259 autorest.AsDelete(),
260 autorest.WithBaseURL(client.BaseURI),
261 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
262 autorest.WithQueryParameters(queryParameters))
263 return preparer.Prepare((&http.Request{}).WithContext(ctx))
264 }
265
266
267
268 func (client WatchersClient) DeleteSender(req *http.Request) (future WatchersDeleteFuture, err error) {
269 var resp *http.Response
270 future.FutureAPI = &azure.Future{}
271 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
272 if err != nil {
273 return
274 }
275 var azf azure.Future
276 azf, err = azure.NewFutureFromResponse(resp)
277 future.FutureAPI = &azf
278 future.Result = future.result
279 return
280 }
281
282
283
284 func (client WatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
285 err = autorest.Respond(
286 resp,
287 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
288 autorest.ByClosing())
289 result.Response = resp
290 return
291 }
292
293
294
295
296
297 func (client WatchersClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result Watcher, err error) {
298 if tracing.IsEnabled() {
299 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Get")
300 defer func() {
301 sc := -1
302 if result.Response.Response != nil {
303 sc = result.Response.Response.StatusCode
304 }
305 tracing.EndSpan(ctx, sc, err)
306 }()
307 }
308 req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName)
309 if err != nil {
310 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", nil, "Failure preparing request")
311 return
312 }
313
314 resp, err := client.GetSender(req)
315 if err != nil {
316 result.Response = autorest.Response{Response: resp}
317 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure sending request")
318 return
319 }
320
321 result, err = client.GetResponder(resp)
322 if err != nil {
323 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure responding to request")
324 return
325 }
326
327 return
328 }
329
330
331 func (client WatchersClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) {
332 pathParameters := map[string]interface{}{
333 "networkWatcherName": autorest.Encode("path", networkWatcherName),
334 "resourceGroupName": autorest.Encode("path", resourceGroupName),
335 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
336 }
337
338 const APIVersion = "2022-05-01"
339 queryParameters := map[string]interface{}{
340 "api-version": APIVersion,
341 }
342
343 preparer := autorest.CreatePreparer(
344 autorest.AsGet(),
345 autorest.WithBaseURL(client.BaseURI),
346 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
347 autorest.WithQueryParameters(queryParameters))
348 return preparer.Prepare((&http.Request{}).WithContext(ctx))
349 }
350
351
352
353 func (client WatchersClient) GetSender(req *http.Request) (*http.Response, error) {
354 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
355 }
356
357
358
359 func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, err error) {
360 err = autorest.Respond(
361 resp,
362 azure.WithErrorUnlessStatusCode(http.StatusOK),
363 autorest.ByUnmarshallingJSON(&result),
364 autorest.ByClosing())
365 result.Response = autorest.Response{Response: resp}
366 return
367 }
368
369
370
371
372
373
374
375 func (client WatchersClient) GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (result WatchersGetAzureReachabilityReportFuture, err error) {
376 if tracing.IsEnabled() {
377 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetAzureReachabilityReport")
378 defer func() {
379 sc := -1
380 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
381 sc = result.FutureAPI.Response().StatusCode
382 }
383 tracing.EndSpan(ctx, sc, err)
384 }()
385 }
386 if err := validation.Validate([]validation.Validation{
387 {TargetValue: parameters,
388 Constraints: []validation.Constraint{{Target: "parameters.ProviderLocation", Name: validation.Null, Rule: true,
389 Chain: []validation.Constraint{{Target: "parameters.ProviderLocation.Country", Name: validation.Null, Rule: true, Chain: nil}}},
390 {Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil},
391 {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
392 return result, validation.NewError("network.WatchersClient", "GetAzureReachabilityReport", err.Error())
393 }
394
395 req, err := client.GetAzureReachabilityReportPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
396 if err != nil {
397 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", nil, "Failure preparing request")
398 return
399 }
400
401 result, err = client.GetAzureReachabilityReportSender(req)
402 if err != nil {
403 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", result.Response(), "Failure sending request")
404 return
405 }
406
407 return
408 }
409
410
411 func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (*http.Request, error) {
412 pathParameters := map[string]interface{}{
413 "networkWatcherName": autorest.Encode("path", networkWatcherName),
414 "resourceGroupName": autorest.Encode("path", resourceGroupName),
415 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
416 }
417
418 const APIVersion = "2022-05-01"
419 queryParameters := map[string]interface{}{
420 "api-version": APIVersion,
421 }
422
423 preparer := autorest.CreatePreparer(
424 autorest.AsContentType("application/json; charset=utf-8"),
425 autorest.AsPost(),
426 autorest.WithBaseURL(client.BaseURI),
427 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport", pathParameters),
428 autorest.WithJSON(parameters),
429 autorest.WithQueryParameters(queryParameters))
430 return preparer.Prepare((&http.Request{}).WithContext(ctx))
431 }
432
433
434
435 func (client WatchersClient) GetAzureReachabilityReportSender(req *http.Request) (future WatchersGetAzureReachabilityReportFuture, err error) {
436 var resp *http.Response
437 future.FutureAPI = &azure.Future{}
438 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
439 if err != nil {
440 return
441 }
442 var azf azure.Future
443 azf, err = azure.NewFutureFromResponse(resp)
444 future.FutureAPI = &azf
445 future.Result = future.result
446 return
447 }
448
449
450
451 func (client WatchersClient) GetAzureReachabilityReportResponder(resp *http.Response) (result AzureReachabilityReport, err error) {
452 err = autorest.Respond(
453 resp,
454 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
455 autorest.ByUnmarshallingJSON(&result),
456 autorest.ByClosing())
457 result.Response = autorest.Response{Response: resp}
458 return
459 }
460
461
462
463
464
465
466 func (client WatchersClient) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (result WatchersGetFlowLogStatusFuture, err error) {
467 if tracing.IsEnabled() {
468 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetFlowLogStatus")
469 defer func() {
470 sc := -1
471 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
472 sc = result.FutureAPI.Response().StatusCode
473 }
474 tracing.EndSpan(ctx, sc, err)
475 }()
476 }
477 if err := validation.Validate([]validation.Validation{
478 {TargetValue: parameters,
479 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
480 return result, validation.NewError("network.WatchersClient", "GetFlowLogStatus", err.Error())
481 }
482
483 req, err := client.GetFlowLogStatusPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
484 if err != nil {
485 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure preparing request")
486 return
487 }
488
489 result, err = client.GetFlowLogStatusSender(req)
490 if err != nil {
491 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", result.Response(), "Failure sending request")
492 return
493 }
494
495 return
496 }
497
498
499 func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (*http.Request, error) {
500 pathParameters := map[string]interface{}{
501 "networkWatcherName": autorest.Encode("path", networkWatcherName),
502 "resourceGroupName": autorest.Encode("path", resourceGroupName),
503 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
504 }
505
506 const APIVersion = "2022-05-01"
507 queryParameters := map[string]interface{}{
508 "api-version": APIVersion,
509 }
510
511 preparer := autorest.CreatePreparer(
512 autorest.AsContentType("application/json; charset=utf-8"),
513 autorest.AsPost(),
514 autorest.WithBaseURL(client.BaseURI),
515 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters),
516 autorest.WithJSON(parameters),
517 autorest.WithQueryParameters(queryParameters))
518 return preparer.Prepare((&http.Request{}).WithContext(ctx))
519 }
520
521
522
523 func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (future WatchersGetFlowLogStatusFuture, err error) {
524 var resp *http.Response
525 future.FutureAPI = &azure.Future{}
526 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
527 if err != nil {
528 return
529 }
530 var azf azure.Future
531 azf, err = azure.NewFutureFromResponse(resp)
532 future.FutureAPI = &azf
533 future.Result = future.result
534 return
535 }
536
537
538
539 func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result FlowLogInformation, err error) {
540 err = autorest.Respond(
541 resp,
542 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
543 autorest.ByUnmarshallingJSON(&result),
544 autorest.ByClosing())
545 result.Response = autorest.Response{Response: resp}
546 return
547 }
548
549
550
551
552
553
554
555
556
557
558 func (client WatchersClient) GetNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (result WatchersGetNetworkConfigurationDiagnosticFuture, err error) {
559 if tracing.IsEnabled() {
560 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNetworkConfigurationDiagnostic")
561 defer func() {
562 sc := -1
563 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
564 sc = result.FutureAPI.Response().StatusCode
565 }
566 tracing.EndSpan(ctx, sc, err)
567 }()
568 }
569 if err := validation.Validate([]validation.Validation{
570 {TargetValue: parameters,
571 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil},
572 {Target: "parameters.Profiles", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
573 return result, validation.NewError("network.WatchersClient", "GetNetworkConfigurationDiagnostic", err.Error())
574 }
575
576 req, err := client.GetNetworkConfigurationDiagnosticPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
577 if err != nil {
578 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", nil, "Failure preparing request")
579 return
580 }
581
582 result, err = client.GetNetworkConfigurationDiagnosticSender(req)
583 if err != nil {
584 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", result.Response(), "Failure sending request")
585 return
586 }
587
588 return
589 }
590
591
592 func (client WatchersClient) GetNetworkConfigurationDiagnosticPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (*http.Request, error) {
593 pathParameters := map[string]interface{}{
594 "networkWatcherName": autorest.Encode("path", networkWatcherName),
595 "resourceGroupName": autorest.Encode("path", resourceGroupName),
596 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
597 }
598
599 const APIVersion = "2022-05-01"
600 queryParameters := map[string]interface{}{
601 "api-version": APIVersion,
602 }
603
604 preparer := autorest.CreatePreparer(
605 autorest.AsContentType("application/json; charset=utf-8"),
606 autorest.AsPost(),
607 autorest.WithBaseURL(client.BaseURI),
608 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic", pathParameters),
609 autorest.WithJSON(parameters),
610 autorest.WithQueryParameters(queryParameters))
611 return preparer.Prepare((&http.Request{}).WithContext(ctx))
612 }
613
614
615
616 func (client WatchersClient) GetNetworkConfigurationDiagnosticSender(req *http.Request) (future WatchersGetNetworkConfigurationDiagnosticFuture, err error) {
617 var resp *http.Response
618 future.FutureAPI = &azure.Future{}
619 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
620 if err != nil {
621 return
622 }
623 var azf azure.Future
624 azf, err = azure.NewFutureFromResponse(resp)
625 future.FutureAPI = &azf
626 future.Result = future.result
627 return
628 }
629
630
631
632 func (client WatchersClient) GetNetworkConfigurationDiagnosticResponder(resp *http.Response) (result ConfigurationDiagnosticResponse, err error) {
633 err = autorest.Respond(
634 resp,
635 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
636 autorest.ByUnmarshallingJSON(&result),
637 autorest.ByClosing())
638 result.Response = autorest.Response{Response: resp}
639 return
640 }
641
642
643
644
645
646
647 func (client WatchersClient) GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (result WatchersGetNextHopFuture, err error) {
648 if tracing.IsEnabled() {
649 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNextHop")
650 defer func() {
651 sc := -1
652 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
653 sc = result.FutureAPI.Response().StatusCode
654 }
655 tracing.EndSpan(ctx, sc, err)
656 }()
657 }
658 if err := validation.Validate([]validation.Validation{
659 {TargetValue: parameters,
660 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil},
661 {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil},
662 {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
663 return result, validation.NewError("network.WatchersClient", "GetNextHop", err.Error())
664 }
665
666 req, err := client.GetNextHopPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
667 if err != nil {
668 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure preparing request")
669 return
670 }
671
672 result, err = client.GetNextHopSender(req)
673 if err != nil {
674 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", result.Response(), "Failure sending request")
675 return
676 }
677
678 return
679 }
680
681
682 func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (*http.Request, error) {
683 pathParameters := map[string]interface{}{
684 "networkWatcherName": autorest.Encode("path", networkWatcherName),
685 "resourceGroupName": autorest.Encode("path", resourceGroupName),
686 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
687 }
688
689 const APIVersion = "2022-05-01"
690 queryParameters := map[string]interface{}{
691 "api-version": APIVersion,
692 }
693
694 preparer := autorest.CreatePreparer(
695 autorest.AsContentType("application/json; charset=utf-8"),
696 autorest.AsPost(),
697 autorest.WithBaseURL(client.BaseURI),
698 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters),
699 autorest.WithJSON(parameters),
700 autorest.WithQueryParameters(queryParameters))
701 return preparer.Prepare((&http.Request{}).WithContext(ctx))
702 }
703
704
705
706 func (client WatchersClient) GetNextHopSender(req *http.Request) (future WatchersGetNextHopFuture, err error) {
707 var resp *http.Response
708 future.FutureAPI = &azure.Future{}
709 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
710 if err != nil {
711 return
712 }
713 var azf azure.Future
714 azf, err = azure.NewFutureFromResponse(resp)
715 future.FutureAPI = &azf
716 future.Result = future.result
717 return
718 }
719
720
721
722 func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result NextHopResult, err error) {
723 err = autorest.Respond(
724 resp,
725 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
726 autorest.ByUnmarshallingJSON(&result),
727 autorest.ByClosing())
728 result.Response = autorest.Response{Response: resp}
729 return
730 }
731
732
733
734
735
736
737 func (client WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) {
738 if tracing.IsEnabled() {
739 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTopology")
740 defer func() {
741 sc := -1
742 if result.Response.Response != nil {
743 sc = result.Response.Response.StatusCode
744 }
745 tracing.EndSpan(ctx, sc, err)
746 }()
747 }
748 req, err := client.GetTopologyPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
749 if err != nil {
750 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request")
751 return
752 }
753
754 resp, err := client.GetTopologySender(req)
755 if err != nil {
756 result.Response = autorest.Response{Response: resp}
757 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure sending request")
758 return
759 }
760
761 result, err = client.GetTopologyResponder(resp)
762 if err != nil {
763 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure responding to request")
764 return
765 }
766
767 return
768 }
769
770
771 func (client WatchersClient) GetTopologyPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) {
772 pathParameters := map[string]interface{}{
773 "networkWatcherName": autorest.Encode("path", networkWatcherName),
774 "resourceGroupName": autorest.Encode("path", resourceGroupName),
775 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
776 }
777
778 const APIVersion = "2022-05-01"
779 queryParameters := map[string]interface{}{
780 "api-version": APIVersion,
781 }
782
783 preparer := autorest.CreatePreparer(
784 autorest.AsContentType("application/json; charset=utf-8"),
785 autorest.AsPost(),
786 autorest.WithBaseURL(client.BaseURI),
787 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters),
788 autorest.WithJSON(parameters),
789 autorest.WithQueryParameters(queryParameters))
790 return preparer.Prepare((&http.Request{}).WithContext(ctx))
791 }
792
793
794
795 func (client WatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) {
796 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
797 }
798
799
800
801 func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) {
802 err = autorest.Respond(
803 resp,
804 azure.WithErrorUnlessStatusCode(http.StatusOK),
805 autorest.ByUnmarshallingJSON(&result),
806 autorest.ByClosing())
807 result.Response = autorest.Response{Response: resp}
808 return
809 }
810
811
812
813
814
815
816 func (client WatchersClient) GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (result WatchersGetTroubleshootingFuture, err error) {
817 if tracing.IsEnabled() {
818 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshooting")
819 defer func() {
820 sc := -1
821 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
822 sc = result.FutureAPI.Response().StatusCode
823 }
824 tracing.EndSpan(ctx, sc, err)
825 }()
826 }
827 if err := validation.Validate([]validation.Validation{
828 {TargetValue: parameters,
829 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil},
830 {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true,
831 Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil},
832 {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil},
833 }}}}}); err != nil {
834 return result, validation.NewError("network.WatchersClient", "GetTroubleshooting", err.Error())
835 }
836
837 req, err := client.GetTroubleshootingPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
838 if err != nil {
839 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure preparing request")
840 return
841 }
842
843 result, err = client.GetTroubleshootingSender(req)
844 if err != nil {
845 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", result.Response(), "Failure sending request")
846 return
847 }
848
849 return
850 }
851
852
853 func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (*http.Request, error) {
854 pathParameters := map[string]interface{}{
855 "networkWatcherName": autorest.Encode("path", networkWatcherName),
856 "resourceGroupName": autorest.Encode("path", resourceGroupName),
857 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
858 }
859
860 const APIVersion = "2022-05-01"
861 queryParameters := map[string]interface{}{
862 "api-version": APIVersion,
863 }
864
865 preparer := autorest.CreatePreparer(
866 autorest.AsContentType("application/json; charset=utf-8"),
867 autorest.AsPost(),
868 autorest.WithBaseURL(client.BaseURI),
869 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters),
870 autorest.WithJSON(parameters),
871 autorest.WithQueryParameters(queryParameters))
872 return preparer.Prepare((&http.Request{}).WithContext(ctx))
873 }
874
875
876
877 func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (future WatchersGetTroubleshootingFuture, err error) {
878 var resp *http.Response
879 future.FutureAPI = &azure.Future{}
880 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
881 if err != nil {
882 return
883 }
884 var azf azure.Future
885 azf, err = azure.NewFutureFromResponse(resp)
886 future.FutureAPI = &azf
887 future.Result = future.result
888 return
889 }
890
891
892
893 func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (result TroubleshootingResult, err error) {
894 err = autorest.Respond(
895 resp,
896 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
897 autorest.ByUnmarshallingJSON(&result),
898 autorest.ByClosing())
899 result.Response = autorest.Response{Response: resp}
900 return
901 }
902
903
904
905
906
907
908 func (client WatchersClient) GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (result WatchersGetTroubleshootingResultFuture, err error) {
909 if tracing.IsEnabled() {
910 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshootingResult")
911 defer func() {
912 sc := -1
913 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
914 sc = result.FutureAPI.Response().StatusCode
915 }
916 tracing.EndSpan(ctx, sc, err)
917 }()
918 }
919 if err := validation.Validate([]validation.Validation{
920 {TargetValue: parameters,
921 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
922 return result, validation.NewError("network.WatchersClient", "GetTroubleshootingResult", err.Error())
923 }
924
925 req, err := client.GetTroubleshootingResultPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
926 if err != nil {
927 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request")
928 return
929 }
930
931 result, err = client.GetTroubleshootingResultSender(req)
932 if err != nil {
933 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", result.Response(), "Failure sending request")
934 return
935 }
936
937 return
938 }
939
940
941 func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (*http.Request, error) {
942 pathParameters := map[string]interface{}{
943 "networkWatcherName": autorest.Encode("path", networkWatcherName),
944 "resourceGroupName": autorest.Encode("path", resourceGroupName),
945 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
946 }
947
948 const APIVersion = "2022-05-01"
949 queryParameters := map[string]interface{}{
950 "api-version": APIVersion,
951 }
952
953 preparer := autorest.CreatePreparer(
954 autorest.AsContentType("application/json; charset=utf-8"),
955 autorest.AsPost(),
956 autorest.WithBaseURL(client.BaseURI),
957 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters),
958 autorest.WithJSON(parameters),
959 autorest.WithQueryParameters(queryParameters))
960 return preparer.Prepare((&http.Request{}).WithContext(ctx))
961 }
962
963
964
965 func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (future WatchersGetTroubleshootingResultFuture, err error) {
966 var resp *http.Response
967 future.FutureAPI = &azure.Future{}
968 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
969 if err != nil {
970 return
971 }
972 var azf azure.Future
973 azf, err = azure.NewFutureFromResponse(resp)
974 future.FutureAPI = &azf
975 future.Result = future.result
976 return
977 }
978
979
980
981 func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result TroubleshootingResult, err error) {
982 err = autorest.Respond(
983 resp,
984 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
985 autorest.ByUnmarshallingJSON(&result),
986 autorest.ByClosing())
987 result.Response = autorest.Response{Response: resp}
988 return
989 }
990
991
992
993
994
995
996 func (client WatchersClient) GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (result WatchersGetVMSecurityRulesFuture, err error) {
997 if tracing.IsEnabled() {
998 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetVMSecurityRules")
999 defer func() {
1000 sc := -1
1001 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1002 sc = result.FutureAPI.Response().StatusCode
1003 }
1004 tracing.EndSpan(ctx, sc, err)
1005 }()
1006 }
1007 if err := validation.Validate([]validation.Validation{
1008 {TargetValue: parameters,
1009 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1010 return result, validation.NewError("network.WatchersClient", "GetVMSecurityRules", err.Error())
1011 }
1012
1013 req, err := client.GetVMSecurityRulesPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
1014 if err != nil {
1015 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure preparing request")
1016 return
1017 }
1018
1019 result, err = client.GetVMSecurityRulesSender(req)
1020 if err != nil {
1021 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", result.Response(), "Failure sending request")
1022 return
1023 }
1024
1025 return
1026 }
1027
1028
1029 func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (*http.Request, error) {
1030 pathParameters := map[string]interface{}{
1031 "networkWatcherName": autorest.Encode("path", networkWatcherName),
1032 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1033 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1034 }
1035
1036 const APIVersion = "2022-05-01"
1037 queryParameters := map[string]interface{}{
1038 "api-version": APIVersion,
1039 }
1040
1041 preparer := autorest.CreatePreparer(
1042 autorest.AsContentType("application/json; charset=utf-8"),
1043 autorest.AsPost(),
1044 autorest.WithBaseURL(client.BaseURI),
1045 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters),
1046 autorest.WithJSON(parameters),
1047 autorest.WithQueryParameters(queryParameters))
1048 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1049 }
1050
1051
1052
1053 func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (future WatchersGetVMSecurityRulesFuture, err error) {
1054 var resp *http.Response
1055 future.FutureAPI = &azure.Future{}
1056 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1057 if err != nil {
1058 return
1059 }
1060 var azf azure.Future
1061 azf, err = azure.NewFutureFromResponse(resp)
1062 future.FutureAPI = &azf
1063 future.Result = future.result
1064 return
1065 }
1066
1067
1068
1069 func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result SecurityGroupViewResult, err error) {
1070 err = autorest.Respond(
1071 resp,
1072 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1073 autorest.ByUnmarshallingJSON(&result),
1074 autorest.ByClosing())
1075 result.Response = autorest.Response{Response: resp}
1076 return
1077 }
1078
1079
1080
1081
1082 func (client WatchersClient) List(ctx context.Context, resourceGroupName string) (result WatcherListResult, err error) {
1083 if tracing.IsEnabled() {
1084 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.List")
1085 defer func() {
1086 sc := -1
1087 if result.Response.Response != nil {
1088 sc = result.Response.Response.StatusCode
1089 }
1090 tracing.EndSpan(ctx, sc, err)
1091 }()
1092 }
1093 req, err := client.ListPreparer(ctx, resourceGroupName)
1094 if err != nil {
1095 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", nil, "Failure preparing request")
1096 return
1097 }
1098
1099 resp, err := client.ListSender(req)
1100 if err != nil {
1101 result.Response = autorest.Response{Response: resp}
1102 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure sending request")
1103 return
1104 }
1105
1106 result, err = client.ListResponder(resp)
1107 if err != nil {
1108 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure responding to request")
1109 return
1110 }
1111
1112 return
1113 }
1114
1115
1116 func (client WatchersClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
1117 pathParameters := map[string]interface{}{
1118 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1119 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1120 }
1121
1122 const APIVersion = "2022-05-01"
1123 queryParameters := map[string]interface{}{
1124 "api-version": APIVersion,
1125 }
1126
1127 preparer := autorest.CreatePreparer(
1128 autorest.AsGet(),
1129 autorest.WithBaseURL(client.BaseURI),
1130 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters),
1131 autorest.WithQueryParameters(queryParameters))
1132 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1133 }
1134
1135
1136
1137 func (client WatchersClient) ListSender(req *http.Request) (*http.Response, error) {
1138 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1139 }
1140
1141
1142
1143 func (client WatchersClient) ListResponder(resp *http.Response) (result WatcherListResult, err error) {
1144 err = autorest.Respond(
1145 resp,
1146 azure.WithErrorUnlessStatusCode(http.StatusOK),
1147 autorest.ByUnmarshallingJSON(&result),
1148 autorest.ByClosing())
1149 result.Response = autorest.Response{Response: resp}
1150 return
1151 }
1152
1153
1154 func (client WatchersClient) ListAll(ctx context.Context) (result WatcherListResult, err error) {
1155 if tracing.IsEnabled() {
1156 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAll")
1157 defer func() {
1158 sc := -1
1159 if result.Response.Response != nil {
1160 sc = result.Response.Response.StatusCode
1161 }
1162 tracing.EndSpan(ctx, sc, err)
1163 }()
1164 }
1165 req, err := client.ListAllPreparer(ctx)
1166 if err != nil {
1167 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", nil, "Failure preparing request")
1168 return
1169 }
1170
1171 resp, err := client.ListAllSender(req)
1172 if err != nil {
1173 result.Response = autorest.Response{Response: resp}
1174 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure sending request")
1175 return
1176 }
1177
1178 result, err = client.ListAllResponder(resp)
1179 if err != nil {
1180 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure responding to request")
1181 return
1182 }
1183
1184 return
1185 }
1186
1187
1188 func (client WatchersClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
1189 pathParameters := map[string]interface{}{
1190 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1191 }
1192
1193 const APIVersion = "2022-05-01"
1194 queryParameters := map[string]interface{}{
1195 "api-version": APIVersion,
1196 }
1197
1198 preparer := autorest.CreatePreparer(
1199 autorest.AsGet(),
1200 autorest.WithBaseURL(client.BaseURI),
1201 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters),
1202 autorest.WithQueryParameters(queryParameters))
1203 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1204 }
1205
1206
1207
1208 func (client WatchersClient) ListAllSender(req *http.Request) (*http.Response, error) {
1209 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1210 }
1211
1212
1213
1214 func (client WatchersClient) ListAllResponder(resp *http.Response) (result WatcherListResult, err error) {
1215 err = autorest.Respond(
1216 resp,
1217 azure.WithErrorUnlessStatusCode(http.StatusOK),
1218 autorest.ByUnmarshallingJSON(&result),
1219 autorest.ByClosing())
1220 result.Response = autorest.Response{Response: resp}
1221 return
1222 }
1223
1224
1225
1226
1227
1228
1229
1230 func (client WatchersClient) ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (result WatchersListAvailableProvidersFuture, err error) {
1231 if tracing.IsEnabled() {
1232 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAvailableProviders")
1233 defer func() {
1234 sc := -1
1235 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1236 sc = result.FutureAPI.Response().StatusCode
1237 }
1238 tracing.EndSpan(ctx, sc, err)
1239 }()
1240 }
1241 req, err := client.ListAvailableProvidersPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
1242 if err != nil {
1243 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", nil, "Failure preparing request")
1244 return
1245 }
1246
1247 result, err = client.ListAvailableProvidersSender(req)
1248 if err != nil {
1249 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", result.Response(), "Failure sending request")
1250 return
1251 }
1252
1253 return
1254 }
1255
1256
1257 func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (*http.Request, error) {
1258 pathParameters := map[string]interface{}{
1259 "networkWatcherName": autorest.Encode("path", networkWatcherName),
1260 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1261 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1262 }
1263
1264 const APIVersion = "2022-05-01"
1265 queryParameters := map[string]interface{}{
1266 "api-version": APIVersion,
1267 }
1268
1269 preparer := autorest.CreatePreparer(
1270 autorest.AsContentType("application/json; charset=utf-8"),
1271 autorest.AsPost(),
1272 autorest.WithBaseURL(client.BaseURI),
1273 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList", pathParameters),
1274 autorest.WithJSON(parameters),
1275 autorest.WithQueryParameters(queryParameters))
1276 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1277 }
1278
1279
1280
1281 func (client WatchersClient) ListAvailableProvidersSender(req *http.Request) (future WatchersListAvailableProvidersFuture, err error) {
1282 var resp *http.Response
1283 future.FutureAPI = &azure.Future{}
1284 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1285 if err != nil {
1286 return
1287 }
1288 var azf azure.Future
1289 azf, err = azure.NewFutureFromResponse(resp)
1290 future.FutureAPI = &azf
1291 future.Result = future.result
1292 return
1293 }
1294
1295
1296
1297 func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response) (result AvailableProvidersList, err error) {
1298 err = autorest.Respond(
1299 resp,
1300 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1301 autorest.ByUnmarshallingJSON(&result),
1302 autorest.ByClosing())
1303 result.Response = autorest.Response{Response: resp}
1304 return
1305 }
1306
1307
1308
1309
1310
1311
1312 func (client WatchersClient) SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (result WatchersSetFlowLogConfigurationFuture, err error) {
1313 if tracing.IsEnabled() {
1314 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.SetFlowLogConfiguration")
1315 defer func() {
1316 sc := -1
1317 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1318 sc = result.FutureAPI.Response().StatusCode
1319 }
1320 tracing.EndSpan(ctx, sc, err)
1321 }()
1322 }
1323 if err := validation.Validate([]validation.Validation{
1324 {TargetValue: parameters,
1325 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil},
1326 {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true,
1327 Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil},
1328 {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil},
1329 }}}}}); err != nil {
1330 return result, validation.NewError("network.WatchersClient", "SetFlowLogConfiguration", err.Error())
1331 }
1332
1333 req, err := client.SetFlowLogConfigurationPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
1334 if err != nil {
1335 err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request")
1336 return
1337 }
1338
1339 result, err = client.SetFlowLogConfigurationSender(req)
1340 if err != nil {
1341 err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", result.Response(), "Failure sending request")
1342 return
1343 }
1344
1345 return
1346 }
1347
1348
1349 func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (*http.Request, error) {
1350 pathParameters := map[string]interface{}{
1351 "networkWatcherName": autorest.Encode("path", networkWatcherName),
1352 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1353 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1354 }
1355
1356 const APIVersion = "2022-05-01"
1357 queryParameters := map[string]interface{}{
1358 "api-version": APIVersion,
1359 }
1360
1361 preparer := autorest.CreatePreparer(
1362 autorest.AsContentType("application/json; charset=utf-8"),
1363 autorest.AsPost(),
1364 autorest.WithBaseURL(client.BaseURI),
1365 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters),
1366 autorest.WithJSON(parameters),
1367 autorest.WithQueryParameters(queryParameters))
1368 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1369 }
1370
1371
1372
1373 func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (future WatchersSetFlowLogConfigurationFuture, err error) {
1374 var resp *http.Response
1375 future.FutureAPI = &azure.Future{}
1376 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1377 if err != nil {
1378 return
1379 }
1380 var azf azure.Future
1381 azf, err = azure.NewFutureFromResponse(resp)
1382 future.FutureAPI = &azf
1383 future.Result = future.result
1384 return
1385 }
1386
1387
1388
1389 func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result FlowLogInformation, err error) {
1390 err = autorest.Respond(
1391 resp,
1392 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1393 autorest.ByUnmarshallingJSON(&result),
1394 autorest.ByClosing())
1395 result.Response = autorest.Response{Response: resp}
1396 return
1397 }
1398
1399
1400
1401
1402
1403
1404 func (client WatchersClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (result Watcher, err error) {
1405 if tracing.IsEnabled() {
1406 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.UpdateTags")
1407 defer func() {
1408 sc := -1
1409 if result.Response.Response != nil {
1410 sc = result.Response.Response.StatusCode
1411 }
1412 tracing.EndSpan(ctx, sc, err)
1413 }()
1414 }
1415 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
1416 if err != nil {
1417 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", nil, "Failure preparing request")
1418 return
1419 }
1420
1421 resp, err := client.UpdateTagsSender(req)
1422 if err != nil {
1423 result.Response = autorest.Response{Response: resp}
1424 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure sending request")
1425 return
1426 }
1427
1428 result, err = client.UpdateTagsResponder(resp)
1429 if err != nil {
1430 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure responding to request")
1431 return
1432 }
1433
1434 return
1435 }
1436
1437
1438 func (client WatchersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (*http.Request, error) {
1439 pathParameters := map[string]interface{}{
1440 "networkWatcherName": autorest.Encode("path", networkWatcherName),
1441 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1442 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1443 }
1444
1445 const APIVersion = "2022-05-01"
1446 queryParameters := map[string]interface{}{
1447 "api-version": APIVersion,
1448 }
1449
1450 preparer := autorest.CreatePreparer(
1451 autorest.AsContentType("application/json; charset=utf-8"),
1452 autorest.AsPatch(),
1453 autorest.WithBaseURL(client.BaseURI),
1454 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
1455 autorest.WithJSON(parameters),
1456 autorest.WithQueryParameters(queryParameters))
1457 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1458 }
1459
1460
1461
1462 func (client WatchersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) {
1463 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1464 }
1465
1466
1467
1468 func (client WatchersClient) UpdateTagsResponder(resp *http.Response) (result Watcher, err error) {
1469 err = autorest.Respond(
1470 resp,
1471 azure.WithErrorUnlessStatusCode(http.StatusOK),
1472 autorest.ByUnmarshallingJSON(&result),
1473 autorest.ByClosing())
1474 result.Response = autorest.Response{Response: resp}
1475 return
1476 }
1477
1478
1479
1480
1481
1482
1483 func (client WatchersClient) VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (result WatchersVerifyIPFlowFuture, err error) {
1484 if tracing.IsEnabled() {
1485 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.VerifyIPFlow")
1486 defer func() {
1487 sc := -1
1488 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1489 sc = result.FutureAPI.Response().StatusCode
1490 }
1491 tracing.EndSpan(ctx, sc, err)
1492 }()
1493 }
1494 if err := validation.Validate([]validation.Validation{
1495 {TargetValue: parameters,
1496 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil},
1497 {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil},
1498 {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil},
1499 {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil},
1500 {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1501 return result, validation.NewError("network.WatchersClient", "VerifyIPFlow", err.Error())
1502 }
1503
1504 req, err := client.VerifyIPFlowPreparer(ctx, resourceGroupName, networkWatcherName, parameters)
1505 if err != nil {
1506 err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure preparing request")
1507 return
1508 }
1509
1510 result, err = client.VerifyIPFlowSender(req)
1511 if err != nil {
1512 err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", result.Response(), "Failure sending request")
1513 return
1514 }
1515
1516 return
1517 }
1518
1519
1520 func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (*http.Request, error) {
1521 pathParameters := map[string]interface{}{
1522 "networkWatcherName": autorest.Encode("path", networkWatcherName),
1523 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1524 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1525 }
1526
1527 const APIVersion = "2022-05-01"
1528 queryParameters := map[string]interface{}{
1529 "api-version": APIVersion,
1530 }
1531
1532 preparer := autorest.CreatePreparer(
1533 autorest.AsContentType("application/json; charset=utf-8"),
1534 autorest.AsPost(),
1535 autorest.WithBaseURL(client.BaseURI),
1536 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters),
1537 autorest.WithJSON(parameters),
1538 autorest.WithQueryParameters(queryParameters))
1539 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1540 }
1541
1542
1543
1544 func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (future WatchersVerifyIPFlowFuture, err error) {
1545 var resp *http.Response
1546 future.FutureAPI = &azure.Future{}
1547 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1548 if err != nil {
1549 return
1550 }
1551 var azf azure.Future
1552 azf, err = azure.NewFutureFromResponse(resp)
1553 future.FutureAPI = &azf
1554 future.Result = future.result
1555 return
1556 }
1557
1558
1559
1560 func (client WatchersClient) VerifyIPFlowResponder(resp *http.Response) (result VerificationIPFlowResult, err error) {
1561 err = autorest.Respond(
1562 resp,
1563 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1564 autorest.ByUnmarshallingJSON(&result),
1565 autorest.ByClosing())
1566 result.Response = autorest.Response{Response: resp}
1567 return
1568 }
1569
View as plain text