< Summary

Class:Azure.ResourceManager.Network.NetworkWatchersRestOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkWatchersRestOperations.cs
Covered lines:289
Uncovered lines:500
Coverable lines:789
Total lines:1648
Line coverage:36.6% (289 of 789)
Covered branches:72
Total branches:336
Branch coverage:21.4% (72 of 336)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-70.59%50%
CreateOrUpdate(...)-70.59%50%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-0%0%
CreateListRequest(...)-100%100%
ListAsync()-76.92%50%
List(...)-76.92%50%
CreateListAllRequest()-100%100%
ListAllAsync()-81.82%50%
ListAll(...)-81.82%50%
CreateGetTopologyRequest(...)-100%100%
GetTopologyAsync()-70.59%50%
GetTopology(...)-70.59%50%
CreateVerifyIPFlowRequest(...)-0%100%
VerifyIPFlowAsync()-0%0%
VerifyIPFlow(...)-0%0%
CreateGetNextHopRequest(...)-100%100%
GetNextHopAsync()-66.67%60%
GetNextHop(...)-66.67%60%
CreateGetVMSecurityRulesRequest(...)-0%100%
GetVMSecurityRulesAsync()-0%0%
GetVMSecurityRules(...)-0%0%
CreateGetTroubleshootingRequest(...)-0%100%
GetTroubleshootingAsync()-0%0%
GetTroubleshooting(...)-0%0%
CreateGetTroubleshootingResultRequest(...)-0%100%
GetTroubleshootingResultAsync()-0%0%
GetTroubleshootingResult(...)-0%0%
CreateSetFlowLogConfigurationRequest(...)-0%100%
SetFlowLogConfigurationAsync()-0%0%
SetFlowLogConfiguration(...)-0%0%
CreateGetFlowLogStatusRequest(...)-0%100%
GetFlowLogStatusAsync()-0%0%
GetFlowLogStatus(...)-0%0%
CreateCheckConnectivityRequest(...)-100%100%
CheckConnectivityAsync()-66.67%60%
CheckConnectivity(...)-66.67%60%
CreateGetAzureReachabilityReportRequest(...)-0%100%
GetAzureReachabilityReportAsync()-0%0%
GetAzureReachabilityReport(...)-0%0%
CreateListAvailableProvidersRequest(...)-0%100%
ListAvailableProvidersAsync()-0%0%
ListAvailableProviders(...)-0%0%
CreateGetNetworkConfigurationDiagnosticRequest(...)-0%100%
GetNetworkConfigurationDiagnosticAsync()-0%0%
GetNetworkConfigurationDiagnostic(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkWatchersRestOperations.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.Network.Models;
 16
 17namespace Azure.ResourceManager.Network
 18{
 19    internal partial class NetworkWatchersRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of NetworkWatchersRestOperations. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 4032        public NetworkWatchersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 33        {
 4034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 4038            endpoint ??= new Uri("https://management.azure.com");
 39
 4040            this.subscriptionId = subscriptionId;
 4041            this.endpoint = endpoint;
 4042            _clientDiagnostics = clientDiagnostics;
 4043            _pipeline = pipeline;
 4044        }
 45
 46        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string networkWatcherName, NetworkWat
 47        {
 448            var message = _pipeline.CreateMessage();
 449            var request = message.Request;
 450            request.Method = RequestMethod.Put;
 451            var uri = new RawRequestUriBuilder();
 452            uri.Reset(endpoint);
 453            uri.AppendPath("/subscriptions/", false);
 454            uri.AppendPath(subscriptionId, true);
 455            uri.AppendPath("/resourceGroups/", false);
 456            uri.AppendPath(resourceGroupName, true);
 457            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 458            uri.AppendPath(networkWatcherName, true);
 459            uri.AppendQuery("api-version", "2020-04-01", true);
 460            request.Uri = uri;
 461            request.Headers.Add("Content-Type", "application/json");
 462            var content = new Utf8JsonRequestContent();
 463            content.JsonWriter.WriteObjectValue(parameters);
 464            request.Content = content;
 465            return message;
 66        }
 67
 68        /// <summary> Creates or updates a network watcher in the specified resource group. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 71        /// <param name="parameters"> Parameters that define the network watcher resource. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response<NetworkWatcher>> CreateOrUpdateAsync(string resourceGroupName, string networkWatcherN
 74        {
 275            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 279            if (networkWatcherName == null)
 80            {
 081                throw new ArgumentNullException(nameof(networkWatcherName));
 82            }
 283            if (parameters == null)
 84            {
 085                throw new ArgumentNullException(nameof(parameters));
 86            }
 87
 288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkWatcherName, parameters);
 289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 290            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 94                    {
 295                        NetworkWatcher value = default;
 296                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 297                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 98                        {
 099                            value = null;
 100                        }
 101                        else
 102                        {
 2103                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 104                        }
 2105                        return Response.FromValue(value, message.Response);
 106                    }
 107                default:
 0108                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 109            }
 2110        }
 111
 112        /// <summary> Creates or updates a network watcher in the specified resource group. </summary>
 113        /// <param name="resourceGroupName"> The name of the resource group. </param>
 114        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 115        /// <param name="parameters"> Parameters that define the network watcher resource. </param>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public Response<NetworkWatcher> CreateOrUpdate(string resourceGroupName, string networkWatcherName, NetworkWatch
 118        {
 2119            if (resourceGroupName == null)
 120            {
 0121                throw new ArgumentNullException(nameof(resourceGroupName));
 122            }
 2123            if (networkWatcherName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(networkWatcherName));
 126            }
 2127            if (parameters == null)
 128            {
 0129                throw new ArgumentNullException(nameof(parameters));
 130            }
 131
 2132            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkWatcherName, parameters);
 2133            _pipeline.Send(message, cancellationToken);
 2134            switch (message.Response.Status)
 135            {
 136                case 200:
 137                case 201:
 138                    {
 2139                        NetworkWatcher value = default;
 2140                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2141                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 142                        {
 0143                            value = null;
 144                        }
 145                        else
 146                        {
 2147                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 148                        }
 2149                        return Response.FromValue(value, message.Response);
 150                    }
 151                default:
 0152                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 153            }
 2154        }
 155
 156        internal HttpMessage CreateGetRequest(string resourceGroupName, string networkWatcherName)
 157        {
 4158            var message = _pipeline.CreateMessage();
 4159            var request = message.Request;
 4160            request.Method = RequestMethod.Get;
 4161            var uri = new RawRequestUriBuilder();
 4162            uri.Reset(endpoint);
 4163            uri.AppendPath("/subscriptions/", false);
 4164            uri.AppendPath(subscriptionId, true);
 4165            uri.AppendPath("/resourceGroups/", false);
 4166            uri.AppendPath(resourceGroupName, true);
 4167            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 4168            uri.AppendPath(networkWatcherName, true);
 4169            uri.AppendQuery("api-version", "2020-04-01", true);
 4170            request.Uri = uri;
 4171            return message;
 172        }
 173
 174        /// <summary> Gets the specified network watcher by resource group. </summary>
 175        /// <param name="resourceGroupName"> The name of the resource group. </param>
 176        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 177        /// <param name="cancellationToken"> The cancellation token to use. </param>
 178        public async Task<Response<NetworkWatcher>> GetAsync(string resourceGroupName, string networkWatcherName, Cancel
 179        {
 2180            if (resourceGroupName == null)
 181            {
 0182                throw new ArgumentNullException(nameof(resourceGroupName));
 183            }
 2184            if (networkWatcherName == null)
 185            {
 0186                throw new ArgumentNullException(nameof(networkWatcherName));
 187            }
 188
 2189            using var message = CreateGetRequest(resourceGroupName, networkWatcherName);
 2190            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2191            switch (message.Response.Status)
 192            {
 193                case 200:
 194                    {
 2195                        NetworkWatcher value = default;
 2196                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2197                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 198                        {
 0199                            value = null;
 200                        }
 201                        else
 202                        {
 2203                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 204                        }
 2205                        return Response.FromValue(value, message.Response);
 206                    }
 207                default:
 0208                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 209            }
 2210        }
 211
 212        /// <summary> Gets the specified network watcher by resource group. </summary>
 213        /// <param name="resourceGroupName"> The name of the resource group. </param>
 214        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 215        /// <param name="cancellationToken"> The cancellation token to use. </param>
 216        public Response<NetworkWatcher> Get(string resourceGroupName, string networkWatcherName, CancellationToken cance
 217        {
 2218            if (resourceGroupName == null)
 219            {
 0220                throw new ArgumentNullException(nameof(resourceGroupName));
 221            }
 2222            if (networkWatcherName == null)
 223            {
 0224                throw new ArgumentNullException(nameof(networkWatcherName));
 225            }
 226
 2227            using var message = CreateGetRequest(resourceGroupName, networkWatcherName);
 2228            _pipeline.Send(message, cancellationToken);
 2229            switch (message.Response.Status)
 230            {
 231                case 200:
 232                    {
 2233                        NetworkWatcher value = default;
 2234                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2235                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 236                        {
 0237                            value = null;
 238                        }
 239                        else
 240                        {
 2241                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 242                        }
 2243                        return Response.FromValue(value, message.Response);
 244                    }
 245                default:
 0246                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 247            }
 2248        }
 249
 250        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string networkWatcherName)
 251        {
 8252            var message = _pipeline.CreateMessage();
 8253            var request = message.Request;
 8254            request.Method = RequestMethod.Delete;
 8255            var uri = new RawRequestUriBuilder();
 8256            uri.Reset(endpoint);
 8257            uri.AppendPath("/subscriptions/", false);
 8258            uri.AppendPath(subscriptionId, true);
 8259            uri.AppendPath("/resourceGroups/", false);
 8260            uri.AppendPath(resourceGroupName, true);
 8261            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 8262            uri.AppendPath(networkWatcherName, true);
 8263            uri.AppendQuery("api-version", "2020-04-01", true);
 8264            request.Uri = uri;
 8265            return message;
 266        }
 267
 268        /// <summary> Deletes the specified network watcher resource. </summary>
 269        /// <param name="resourceGroupName"> The name of the resource group. </param>
 270        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 271        /// <param name="cancellationToken"> The cancellation token to use. </param>
 272        public async Task<Response> DeleteAsync(string resourceGroupName, string networkWatcherName, CancellationToken c
 273        {
 2274            if (resourceGroupName == null)
 275            {
 0276                throw new ArgumentNullException(nameof(resourceGroupName));
 277            }
 2278            if (networkWatcherName == null)
 279            {
 0280                throw new ArgumentNullException(nameof(networkWatcherName));
 281            }
 282
 2283            using var message = CreateDeleteRequest(resourceGroupName, networkWatcherName);
 2284            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2285            switch (message.Response.Status)
 286            {
 287                case 202:
 288                case 204:
 2289                    return message.Response;
 290                default:
 0291                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 292            }
 2293        }
 294
 295        /// <summary> Deletes the specified network watcher resource. </summary>
 296        /// <param name="resourceGroupName"> The name of the resource group. </param>
 297        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 298        /// <param name="cancellationToken"> The cancellation token to use. </param>
 299        public Response Delete(string resourceGroupName, string networkWatcherName, CancellationToken cancellationToken 
 300        {
 2301            if (resourceGroupName == null)
 302            {
 0303                throw new ArgumentNullException(nameof(resourceGroupName));
 304            }
 2305            if (networkWatcherName == null)
 306            {
 0307                throw new ArgumentNullException(nameof(networkWatcherName));
 308            }
 309
 2310            using var message = CreateDeleteRequest(resourceGroupName, networkWatcherName);
 2311            _pipeline.Send(message, cancellationToken);
 2312            switch (message.Response.Status)
 313            {
 314                case 202:
 315                case 204:
 2316                    return message.Response;
 317                default:
 0318                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 319            }
 2320        }
 321
 322        internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string networkWatcherName, TagsObject par
 323        {
 0324            var message = _pipeline.CreateMessage();
 0325            var request = message.Request;
 0326            request.Method = RequestMethod.Patch;
 0327            var uri = new RawRequestUriBuilder();
 0328            uri.Reset(endpoint);
 0329            uri.AppendPath("/subscriptions/", false);
 0330            uri.AppendPath(subscriptionId, true);
 0331            uri.AppendPath("/resourceGroups/", false);
 0332            uri.AppendPath(resourceGroupName, true);
 0333            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 0334            uri.AppendPath(networkWatcherName, true);
 0335            uri.AppendQuery("api-version", "2020-04-01", true);
 0336            request.Uri = uri;
 0337            request.Headers.Add("Content-Type", "application/json");
 0338            var content = new Utf8JsonRequestContent();
 0339            content.JsonWriter.WriteObjectValue(parameters);
 0340            request.Content = content;
 0341            return message;
 342        }
 343
 344        /// <summary> Updates a network watcher tags. </summary>
 345        /// <param name="resourceGroupName"> The name of the resource group. </param>
 346        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 347        /// <param name="parameters"> Parameters supplied to update network watcher tags. </param>
 348        /// <param name="cancellationToken"> The cancellation token to use. </param>
 349        public async Task<Response<NetworkWatcher>> UpdateTagsAsync(string resourceGroupName, string networkWatcherName,
 350        {
 0351            if (resourceGroupName == null)
 352            {
 0353                throw new ArgumentNullException(nameof(resourceGroupName));
 354            }
 0355            if (networkWatcherName == null)
 356            {
 0357                throw new ArgumentNullException(nameof(networkWatcherName));
 358            }
 0359            if (parameters == null)
 360            {
 0361                throw new ArgumentNullException(nameof(parameters));
 362            }
 363
 0364            using var message = CreateUpdateTagsRequest(resourceGroupName, networkWatcherName, parameters);
 0365            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0366            switch (message.Response.Status)
 367            {
 368                case 200:
 369                    {
 0370                        NetworkWatcher value = default;
 0371                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0372                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 373                        {
 0374                            value = null;
 375                        }
 376                        else
 377                        {
 0378                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 379                        }
 0380                        return Response.FromValue(value, message.Response);
 381                    }
 382                default:
 0383                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 384            }
 0385        }
 386
 387        /// <summary> Updates a network watcher tags. </summary>
 388        /// <param name="resourceGroupName"> The name of the resource group. </param>
 389        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 390        /// <param name="parameters"> Parameters supplied to update network watcher tags. </param>
 391        /// <param name="cancellationToken"> The cancellation token to use. </param>
 392        public Response<NetworkWatcher> UpdateTags(string resourceGroupName, string networkWatcherName, TagsObject param
 393        {
 0394            if (resourceGroupName == null)
 395            {
 0396                throw new ArgumentNullException(nameof(resourceGroupName));
 397            }
 0398            if (networkWatcherName == null)
 399            {
 0400                throw new ArgumentNullException(nameof(networkWatcherName));
 401            }
 0402            if (parameters == null)
 403            {
 0404                throw new ArgumentNullException(nameof(parameters));
 405            }
 406
 0407            using var message = CreateUpdateTagsRequest(resourceGroupName, networkWatcherName, parameters);
 0408            _pipeline.Send(message, cancellationToken);
 0409            switch (message.Response.Status)
 410            {
 411                case 200:
 412                    {
 0413                        NetworkWatcher value = default;
 0414                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0415                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 416                        {
 0417                            value = null;
 418                        }
 419                        else
 420                        {
 0421                            value = NetworkWatcher.DeserializeNetworkWatcher(document.RootElement);
 422                        }
 0423                        return Response.FromValue(value, message.Response);
 424                    }
 425                default:
 0426                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 427            }
 0428        }
 429
 430        internal HttpMessage CreateListRequest(string resourceGroupName)
 431        {
 4432            var message = _pipeline.CreateMessage();
 4433            var request = message.Request;
 4434            request.Method = RequestMethod.Get;
 4435            var uri = new RawRequestUriBuilder();
 4436            uri.Reset(endpoint);
 4437            uri.AppendPath("/subscriptions/", false);
 4438            uri.AppendPath(subscriptionId, true);
 4439            uri.AppendPath("/resourceGroups/", false);
 4440            uri.AppendPath(resourceGroupName, true);
 4441            uri.AppendPath("/providers/Microsoft.Network/networkWatchers", false);
 4442            uri.AppendQuery("api-version", "2020-04-01", true);
 4443            request.Uri = uri;
 4444            return message;
 445        }
 446
 447        /// <summary> Gets all network watchers by resource group. </summary>
 448        /// <param name="resourceGroupName"> The name of the resource group. </param>
 449        /// <param name="cancellationToken"> The cancellation token to use. </param>
 450        public async Task<Response<NetworkWatcherListResult>> ListAsync(string resourceGroupName, CancellationToken canc
 451        {
 2452            if (resourceGroupName == null)
 453            {
 0454                throw new ArgumentNullException(nameof(resourceGroupName));
 455            }
 456
 2457            using var message = CreateListRequest(resourceGroupName);
 2458            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2459            switch (message.Response.Status)
 460            {
 461                case 200:
 462                    {
 2463                        NetworkWatcherListResult value = default;
 2464                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2465                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 466                        {
 0467                            value = null;
 468                        }
 469                        else
 470                        {
 2471                            value = NetworkWatcherListResult.DeserializeNetworkWatcherListResult(document.RootElement);
 472                        }
 2473                        return Response.FromValue(value, message.Response);
 474                    }
 475                default:
 0476                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 477            }
 2478        }
 479
 480        /// <summary> Gets all network watchers by resource group. </summary>
 481        /// <param name="resourceGroupName"> The name of the resource group. </param>
 482        /// <param name="cancellationToken"> The cancellation token to use. </param>
 483        public Response<NetworkWatcherListResult> List(string resourceGroupName, CancellationToken cancellationToken = d
 484        {
 2485            if (resourceGroupName == null)
 486            {
 0487                throw new ArgumentNullException(nameof(resourceGroupName));
 488            }
 489
 2490            using var message = CreateListRequest(resourceGroupName);
 2491            _pipeline.Send(message, cancellationToken);
 2492            switch (message.Response.Status)
 493            {
 494                case 200:
 495                    {
 2496                        NetworkWatcherListResult value = default;
 2497                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2498                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 499                        {
 0500                            value = null;
 501                        }
 502                        else
 503                        {
 2504                            value = NetworkWatcherListResult.DeserializeNetworkWatcherListResult(document.RootElement);
 505                        }
 2506                        return Response.FromValue(value, message.Response);
 507                    }
 508                default:
 0509                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 510            }
 2511        }
 512
 513        internal HttpMessage CreateListAllRequest()
 514        {
 8515            var message = _pipeline.CreateMessage();
 8516            var request = message.Request;
 8517            request.Method = RequestMethod.Get;
 8518            var uri = new RawRequestUriBuilder();
 8519            uri.Reset(endpoint);
 8520            uri.AppendPath("/subscriptions/", false);
 8521            uri.AppendPath(subscriptionId, true);
 8522            uri.AppendPath("/providers/Microsoft.Network/networkWatchers", false);
 8523            uri.AppendQuery("api-version", "2020-04-01", true);
 8524            request.Uri = uri;
 8525            return message;
 526        }
 527
 528        /// <summary> Gets all network watchers by subscription. </summary>
 529        /// <param name="cancellationToken"> The cancellation token to use. </param>
 530        public async Task<Response<NetworkWatcherListResult>> ListAllAsync(CancellationToken cancellationToken = default
 531        {
 4532            using var message = CreateListAllRequest();
 4533            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4534            switch (message.Response.Status)
 535            {
 536                case 200:
 537                    {
 4538                        NetworkWatcherListResult value = default;
 4539                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4540                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 541                        {
 0542                            value = null;
 543                        }
 544                        else
 545                        {
 4546                            value = NetworkWatcherListResult.DeserializeNetworkWatcherListResult(document.RootElement);
 547                        }
 4548                        return Response.FromValue(value, message.Response);
 549                    }
 550                default:
 0551                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 552            }
 4553        }
 554
 555        /// <summary> Gets all network watchers by subscription. </summary>
 556        /// <param name="cancellationToken"> The cancellation token to use. </param>
 557        public Response<NetworkWatcherListResult> ListAll(CancellationToken cancellationToken = default)
 558        {
 4559            using var message = CreateListAllRequest();
 4560            _pipeline.Send(message, cancellationToken);
 4561            switch (message.Response.Status)
 562            {
 563                case 200:
 564                    {
 4565                        NetworkWatcherListResult value = default;
 4566                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4567                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 568                        {
 0569                            value = null;
 570                        }
 571                        else
 572                        {
 4573                            value = NetworkWatcherListResult.DeserializeNetworkWatcherListResult(document.RootElement);
 574                        }
 4575                        return Response.FromValue(value, message.Response);
 576                    }
 577                default:
 0578                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 579            }
 4580        }
 581
 582        internal HttpMessage CreateGetTopologyRequest(string resourceGroupName, string networkWatcherName, TopologyParam
 583        {
 4584            var message = _pipeline.CreateMessage();
 4585            var request = message.Request;
 4586            request.Method = RequestMethod.Post;
 4587            var uri = new RawRequestUriBuilder();
 4588            uri.Reset(endpoint);
 4589            uri.AppendPath("/subscriptions/", false);
 4590            uri.AppendPath(subscriptionId, true);
 4591            uri.AppendPath("/resourceGroups/", false);
 4592            uri.AppendPath(resourceGroupName, true);
 4593            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 4594            uri.AppendPath(networkWatcherName, true);
 4595            uri.AppendPath("/topology", false);
 4596            uri.AppendQuery("api-version", "2020-04-01", true);
 4597            request.Uri = uri;
 4598            request.Headers.Add("Content-Type", "application/json");
 4599            var content = new Utf8JsonRequestContent();
 4600            content.JsonWriter.WriteObjectValue(parameters);
 4601            request.Content = content;
 4602            return message;
 603        }
 604
 605        /// <summary> Gets the current network topology by resource group. </summary>
 606        /// <param name="resourceGroupName"> The name of the resource group. </param>
 607        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 608        /// <param name="parameters"> Parameters that define the representation of topology. </param>
 609        /// <param name="cancellationToken"> The cancellation token to use. </param>
 610        public async Task<Response<Topology>> GetTopologyAsync(string resourceGroupName, string networkWatcherName, Topo
 611        {
 2612            if (resourceGroupName == null)
 613            {
 0614                throw new ArgumentNullException(nameof(resourceGroupName));
 615            }
 2616            if (networkWatcherName == null)
 617            {
 0618                throw new ArgumentNullException(nameof(networkWatcherName));
 619            }
 2620            if (parameters == null)
 621            {
 0622                throw new ArgumentNullException(nameof(parameters));
 623            }
 624
 2625            using var message = CreateGetTopologyRequest(resourceGroupName, networkWatcherName, parameters);
 2626            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2627            switch (message.Response.Status)
 628            {
 629                case 200:
 630                    {
 2631                        Topology value = default;
 2632                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2633                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 634                        {
 0635                            value = null;
 636                        }
 637                        else
 638                        {
 2639                            value = Topology.DeserializeTopology(document.RootElement);
 640                        }
 2641                        return Response.FromValue(value, message.Response);
 642                    }
 643                default:
 0644                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 645            }
 2646        }
 647
 648        /// <summary> Gets the current network topology by resource group. </summary>
 649        /// <param name="resourceGroupName"> The name of the resource group. </param>
 650        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 651        /// <param name="parameters"> Parameters that define the representation of topology. </param>
 652        /// <param name="cancellationToken"> The cancellation token to use. </param>
 653        public Response<Topology> GetTopology(string resourceGroupName, string networkWatcherName, TopologyParameters pa
 654        {
 2655            if (resourceGroupName == null)
 656            {
 0657                throw new ArgumentNullException(nameof(resourceGroupName));
 658            }
 2659            if (networkWatcherName == null)
 660            {
 0661                throw new ArgumentNullException(nameof(networkWatcherName));
 662            }
 2663            if (parameters == null)
 664            {
 0665                throw new ArgumentNullException(nameof(parameters));
 666            }
 667
 2668            using var message = CreateGetTopologyRequest(resourceGroupName, networkWatcherName, parameters);
 2669            _pipeline.Send(message, cancellationToken);
 2670            switch (message.Response.Status)
 671            {
 672                case 200:
 673                    {
 2674                        Topology value = default;
 2675                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2676                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 677                        {
 0678                            value = null;
 679                        }
 680                        else
 681                        {
 2682                            value = Topology.DeserializeTopology(document.RootElement);
 683                        }
 2684                        return Response.FromValue(value, message.Response);
 685                    }
 686                default:
 0687                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 688            }
 2689        }
 690
 691        internal HttpMessage CreateVerifyIPFlowRequest(string resourceGroupName, string networkWatcherName, Verification
 692        {
 0693            var message = _pipeline.CreateMessage();
 0694            var request = message.Request;
 0695            request.Method = RequestMethod.Post;
 0696            var uri = new RawRequestUriBuilder();
 0697            uri.Reset(endpoint);
 0698            uri.AppendPath("/subscriptions/", false);
 0699            uri.AppendPath(subscriptionId, true);
 0700            uri.AppendPath("/resourceGroups/", false);
 0701            uri.AppendPath(resourceGroupName, true);
 0702            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 0703            uri.AppendPath(networkWatcherName, true);
 0704            uri.AppendPath("/ipFlowVerify", false);
 0705            uri.AppendQuery("api-version", "2020-04-01", true);
 0706            request.Uri = uri;
 0707            request.Headers.Add("Content-Type", "application/json");
 0708            var content = new Utf8JsonRequestContent();
 0709            content.JsonWriter.WriteObjectValue(parameters);
 0710            request.Content = content;
 0711            return message;
 712        }
 713
 714        /// <summary> Verify IP flow from the specified VM to a location given the currently configured NSG rules. </sum
 715        /// <param name="resourceGroupName"> The name of the resource group. </param>
 716        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 717        /// <param name="parameters"> Parameters that define the IP flow to be verified. </param>
 718        /// <param name="cancellationToken"> The cancellation token to use. </param>
 719        public async Task<Response> VerifyIPFlowAsync(string resourceGroupName, string networkWatcherName, VerificationI
 720        {
 0721            if (resourceGroupName == null)
 722            {
 0723                throw new ArgumentNullException(nameof(resourceGroupName));
 724            }
 0725            if (networkWatcherName == null)
 726            {
 0727                throw new ArgumentNullException(nameof(networkWatcherName));
 728            }
 0729            if (parameters == null)
 730            {
 0731                throw new ArgumentNullException(nameof(parameters));
 732            }
 733
 0734            using var message = CreateVerifyIPFlowRequest(resourceGroupName, networkWatcherName, parameters);
 0735            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0736            switch (message.Response.Status)
 737            {
 738                case 200:
 739                case 202:
 0740                    return message.Response;
 741                default:
 0742                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 743            }
 0744        }
 745
 746        /// <summary> Verify IP flow from the specified VM to a location given the currently configured NSG rules. </sum
 747        /// <param name="resourceGroupName"> The name of the resource group. </param>
 748        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 749        /// <param name="parameters"> Parameters that define the IP flow to be verified. </param>
 750        /// <param name="cancellationToken"> The cancellation token to use. </param>
 751        public Response VerifyIPFlow(string resourceGroupName, string networkWatcherName, VerificationIPFlowParameters p
 752        {
 0753            if (resourceGroupName == null)
 754            {
 0755                throw new ArgumentNullException(nameof(resourceGroupName));
 756            }
 0757            if (networkWatcherName == null)
 758            {
 0759                throw new ArgumentNullException(nameof(networkWatcherName));
 760            }
 0761            if (parameters == null)
 762            {
 0763                throw new ArgumentNullException(nameof(parameters));
 764            }
 765
 0766            using var message = CreateVerifyIPFlowRequest(resourceGroupName, networkWatcherName, parameters);
 0767            _pipeline.Send(message, cancellationToken);
 0768            switch (message.Response.Status)
 769            {
 770                case 200:
 771                case 202:
 0772                    return message.Response;
 773                default:
 0774                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 775            }
 0776        }
 777
 778        internal HttpMessage CreateGetNextHopRequest(string resourceGroupName, string networkWatcherName, NextHopParamet
 779        {
 16780            var message = _pipeline.CreateMessage();
 16781            var request = message.Request;
 16782            request.Method = RequestMethod.Post;
 16783            var uri = new RawRequestUriBuilder();
 16784            uri.Reset(endpoint);
 16785            uri.AppendPath("/subscriptions/", false);
 16786            uri.AppendPath(subscriptionId, true);
 16787            uri.AppendPath("/resourceGroups/", false);
 16788            uri.AppendPath(resourceGroupName, true);
 16789            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 16790            uri.AppendPath(networkWatcherName, true);
 16791            uri.AppendPath("/nextHop", false);
 16792            uri.AppendQuery("api-version", "2020-04-01", true);
 16793            request.Uri = uri;
 16794            request.Headers.Add("Content-Type", "application/json");
 16795            var content = new Utf8JsonRequestContent();
 16796            content.JsonWriter.WriteObjectValue(parameters);
 16797            request.Content = content;
 16798            return message;
 799        }
 800
 801        /// <summary> Gets the next hop from the specified VM. </summary>
 802        /// <param name="resourceGroupName"> The name of the resource group. </param>
 803        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 804        /// <param name="parameters"> Parameters that define the source and destination endpoint. </param>
 805        /// <param name="cancellationToken"> The cancellation token to use. </param>
 806        public async Task<Response> GetNextHopAsync(string resourceGroupName, string networkWatcherName, NextHopParamete
 807        {
 4808            if (resourceGroupName == null)
 809            {
 0810                throw new ArgumentNullException(nameof(resourceGroupName));
 811            }
 4812            if (networkWatcherName == null)
 813            {
 0814                throw new ArgumentNullException(nameof(networkWatcherName));
 815            }
 4816            if (parameters == null)
 817            {
 0818                throw new ArgumentNullException(nameof(parameters));
 819            }
 820
 4821            using var message = CreateGetNextHopRequest(resourceGroupName, networkWatcherName, parameters);
 4822            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4823            switch (message.Response.Status)
 824            {
 825                case 200:
 826                case 202:
 4827                    return message.Response;
 828                default:
 0829                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 830            }
 4831        }
 832
 833        /// <summary> Gets the next hop from the specified VM. </summary>
 834        /// <param name="resourceGroupName"> The name of the resource group. </param>
 835        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 836        /// <param name="parameters"> Parameters that define the source and destination endpoint. </param>
 837        /// <param name="cancellationToken"> The cancellation token to use. </param>
 838        public Response GetNextHop(string resourceGroupName, string networkWatcherName, NextHopParameters parameters, Ca
 839        {
 4840            if (resourceGroupName == null)
 841            {
 0842                throw new ArgumentNullException(nameof(resourceGroupName));
 843            }
 4844            if (networkWatcherName == null)
 845            {
 0846                throw new ArgumentNullException(nameof(networkWatcherName));
 847            }
 4848            if (parameters == null)
 849            {
 0850                throw new ArgumentNullException(nameof(parameters));
 851            }
 852
 4853            using var message = CreateGetNextHopRequest(resourceGroupName, networkWatcherName, parameters);
 4854            _pipeline.Send(message, cancellationToken);
 4855            switch (message.Response.Status)
 856            {
 857                case 200:
 858                case 202:
 4859                    return message.Response;
 860                default:
 0861                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 862            }
 4863        }
 864
 865        internal HttpMessage CreateGetVMSecurityRulesRequest(string resourceGroupName, string networkWatcherName, Securi
 866        {
 0867            var message = _pipeline.CreateMessage();
 0868            var request = message.Request;
 0869            request.Method = RequestMethod.Post;
 0870            var uri = new RawRequestUriBuilder();
 0871            uri.Reset(endpoint);
 0872            uri.AppendPath("/subscriptions/", false);
 0873            uri.AppendPath(subscriptionId, true);
 0874            uri.AppendPath("/resourceGroups/", false);
 0875            uri.AppendPath(resourceGroupName, true);
 0876            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 0877            uri.AppendPath(networkWatcherName, true);
 0878            uri.AppendPath("/securityGroupView", false);
 0879            uri.AppendQuery("api-version", "2020-04-01", true);
 0880            request.Uri = uri;
 0881            request.Headers.Add("Content-Type", "application/json");
 0882            var content = new Utf8JsonRequestContent();
 0883            content.JsonWriter.WriteObjectValue(parameters);
 0884            request.Content = content;
 0885            return message;
 886        }
 887
 888        /// <summary> Gets the configured and effective security group rules on the specified VM. </summary>
 889        /// <param name="resourceGroupName"> The name of the resource group. </param>
 890        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 891        /// <param name="parameters"> Parameters that define the VM to check security groups for. </param>
 892        /// <param name="cancellationToken"> The cancellation token to use. </param>
 893        public async Task<Response> GetVMSecurityRulesAsync(string resourceGroupName, string networkWatcherName, Securit
 894        {
 0895            if (resourceGroupName == null)
 896            {
 0897                throw new ArgumentNullException(nameof(resourceGroupName));
 898            }
 0899            if (networkWatcherName == null)
 900            {
 0901                throw new ArgumentNullException(nameof(networkWatcherName));
 902            }
 0903            if (parameters == null)
 904            {
 0905                throw new ArgumentNullException(nameof(parameters));
 906            }
 907
 0908            using var message = CreateGetVMSecurityRulesRequest(resourceGroupName, networkWatcherName, parameters);
 0909            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0910            switch (message.Response.Status)
 911            {
 912                case 200:
 913                case 202:
 0914                    return message.Response;
 915                default:
 0916                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 917            }
 0918        }
 919
 920        /// <summary> Gets the configured and effective security group rules on the specified VM. </summary>
 921        /// <param name="resourceGroupName"> The name of the resource group. </param>
 922        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 923        /// <param name="parameters"> Parameters that define the VM to check security groups for. </param>
 924        /// <param name="cancellationToken"> The cancellation token to use. </param>
 925        public Response GetVMSecurityRules(string resourceGroupName, string networkWatcherName, SecurityGroupViewParamet
 926        {
 0927            if (resourceGroupName == null)
 928            {
 0929                throw new ArgumentNullException(nameof(resourceGroupName));
 930            }
 0931            if (networkWatcherName == null)
 932            {
 0933                throw new ArgumentNullException(nameof(networkWatcherName));
 934            }
 0935            if (parameters == null)
 936            {
 0937                throw new ArgumentNullException(nameof(parameters));
 938            }
 939
 0940            using var message = CreateGetVMSecurityRulesRequest(resourceGroupName, networkWatcherName, parameters);
 0941            _pipeline.Send(message, cancellationToken);
 0942            switch (message.Response.Status)
 943            {
 944                case 200:
 945                case 202:
 0946                    return message.Response;
 947                default:
 0948                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 949            }
 0950        }
 951
 952        internal HttpMessage CreateGetTroubleshootingRequest(string resourceGroupName, string networkWatcherName, Troubl
 953        {
 0954            var message = _pipeline.CreateMessage();
 0955            var request = message.Request;
 0956            request.Method = RequestMethod.Post;
 0957            var uri = new RawRequestUriBuilder();
 0958            uri.Reset(endpoint);
 0959            uri.AppendPath("/subscriptions/", false);
 0960            uri.AppendPath(subscriptionId, true);
 0961            uri.AppendPath("/resourceGroups/", false);
 0962            uri.AppendPath(resourceGroupName, true);
 0963            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 0964            uri.AppendPath(networkWatcherName, true);
 0965            uri.AppendPath("/troubleshoot", false);
 0966            uri.AppendQuery("api-version", "2020-04-01", true);
 0967            request.Uri = uri;
 0968            request.Headers.Add("Content-Type", "application/json");
 0969            var content = new Utf8JsonRequestContent();
 0970            content.JsonWriter.WriteObjectValue(parameters);
 0971            request.Content = content;
 0972            return message;
 973        }
 974
 975        /// <summary> Initiate troubleshooting on a specified resource. </summary>
 976        /// <param name="resourceGroupName"> The name of the resource group. </param>
 977        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 978        /// <param name="parameters"> Parameters that define the resource to troubleshoot. </param>
 979        /// <param name="cancellationToken"> The cancellation token to use. </param>
 980        public async Task<Response> GetTroubleshootingAsync(string resourceGroupName, string networkWatcherName, Trouble
 981        {
 0982            if (resourceGroupName == null)
 983            {
 0984                throw new ArgumentNullException(nameof(resourceGroupName));
 985            }
 0986            if (networkWatcherName == null)
 987            {
 0988                throw new ArgumentNullException(nameof(networkWatcherName));
 989            }
 0990            if (parameters == null)
 991            {
 0992                throw new ArgumentNullException(nameof(parameters));
 993            }
 994
 0995            using var message = CreateGetTroubleshootingRequest(resourceGroupName, networkWatcherName, parameters);
 0996            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0997            switch (message.Response.Status)
 998            {
 999                case 200:
 1000                case 202:
 01001                    return message.Response;
 1002                default:
 01003                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1004            }
 01005        }
 1006
 1007        /// <summary> Initiate troubleshooting on a specified resource. </summary>
 1008        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1009        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1010        /// <param name="parameters"> Parameters that define the resource to troubleshoot. </param>
 1011        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1012        public Response GetTroubleshooting(string resourceGroupName, string networkWatcherName, TroubleshootingParameter
 1013        {
 01014            if (resourceGroupName == null)
 1015            {
 01016                throw new ArgumentNullException(nameof(resourceGroupName));
 1017            }
 01018            if (networkWatcherName == null)
 1019            {
 01020                throw new ArgumentNullException(nameof(networkWatcherName));
 1021            }
 01022            if (parameters == null)
 1023            {
 01024                throw new ArgumentNullException(nameof(parameters));
 1025            }
 1026
 01027            using var message = CreateGetTroubleshootingRequest(resourceGroupName, networkWatcherName, parameters);
 01028            _pipeline.Send(message, cancellationToken);
 01029            switch (message.Response.Status)
 1030            {
 1031                case 200:
 1032                case 202:
 01033                    return message.Response;
 1034                default:
 01035                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1036            }
 01037        }
 1038
 1039        internal HttpMessage CreateGetTroubleshootingResultRequest(string resourceGroupName, string networkWatcherName, 
 1040        {
 01041            var message = _pipeline.CreateMessage();
 01042            var request = message.Request;
 01043            request.Method = RequestMethod.Post;
 01044            var uri = new RawRequestUriBuilder();
 01045            uri.Reset(endpoint);
 01046            uri.AppendPath("/subscriptions/", false);
 01047            uri.AppendPath(subscriptionId, true);
 01048            uri.AppendPath("/resourceGroups/", false);
 01049            uri.AppendPath(resourceGroupName, true);
 01050            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01051            uri.AppendPath(networkWatcherName, true);
 01052            uri.AppendPath("/queryTroubleshootResult", false);
 01053            uri.AppendQuery("api-version", "2020-04-01", true);
 01054            request.Uri = uri;
 01055            request.Headers.Add("Content-Type", "application/json");
 01056            var content = new Utf8JsonRequestContent();
 01057            content.JsonWriter.WriteObjectValue(parameters);
 01058            request.Content = content;
 01059            return message;
 1060        }
 1061
 1062        /// <summary> Get the last completed troubleshooting result on a specified resource. </summary>
 1063        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1064        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1065        /// <param name="parameters"> Parameters that define the resource to query the troubleshooting result. </param>
 1066        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1067        public async Task<Response> GetTroubleshootingResultAsync(string resourceGroupName, string networkWatcherName, Q
 1068        {
 01069            if (resourceGroupName == null)
 1070            {
 01071                throw new ArgumentNullException(nameof(resourceGroupName));
 1072            }
 01073            if (networkWatcherName == null)
 1074            {
 01075                throw new ArgumentNullException(nameof(networkWatcherName));
 1076            }
 01077            if (parameters == null)
 1078            {
 01079                throw new ArgumentNullException(nameof(parameters));
 1080            }
 1081
 01082            using var message = CreateGetTroubleshootingResultRequest(resourceGroupName, networkWatcherName, parameters)
 01083            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01084            switch (message.Response.Status)
 1085            {
 1086                case 200:
 1087                case 202:
 01088                    return message.Response;
 1089                default:
 01090                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1091            }
 01092        }
 1093
 1094        /// <summary> Get the last completed troubleshooting result on a specified resource. </summary>
 1095        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1096        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1097        /// <param name="parameters"> Parameters that define the resource to query the troubleshooting result. </param>
 1098        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1099        public Response GetTroubleshootingResult(string resourceGroupName, string networkWatcherName, QueryTroubleshooti
 1100        {
 01101            if (resourceGroupName == null)
 1102            {
 01103                throw new ArgumentNullException(nameof(resourceGroupName));
 1104            }
 01105            if (networkWatcherName == null)
 1106            {
 01107                throw new ArgumentNullException(nameof(networkWatcherName));
 1108            }
 01109            if (parameters == null)
 1110            {
 01111                throw new ArgumentNullException(nameof(parameters));
 1112            }
 1113
 01114            using var message = CreateGetTroubleshootingResultRequest(resourceGroupName, networkWatcherName, parameters)
 01115            _pipeline.Send(message, cancellationToken);
 01116            switch (message.Response.Status)
 1117            {
 1118                case 200:
 1119                case 202:
 01120                    return message.Response;
 1121                default:
 01122                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1123            }
 01124        }
 1125
 1126        internal HttpMessage CreateSetFlowLogConfigurationRequest(string resourceGroupName, string networkWatcherName, F
 1127        {
 01128            var message = _pipeline.CreateMessage();
 01129            var request = message.Request;
 01130            request.Method = RequestMethod.Post;
 01131            var uri = new RawRequestUriBuilder();
 01132            uri.Reset(endpoint);
 01133            uri.AppendPath("/subscriptions/", false);
 01134            uri.AppendPath(subscriptionId, true);
 01135            uri.AppendPath("/resourceGroups/", false);
 01136            uri.AppendPath(resourceGroupName, true);
 01137            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01138            uri.AppendPath(networkWatcherName, true);
 01139            uri.AppendPath("/configureFlowLog", false);
 01140            uri.AppendQuery("api-version", "2020-04-01", true);
 01141            request.Uri = uri;
 01142            request.Headers.Add("Content-Type", "application/json");
 01143            var content = new Utf8JsonRequestContent();
 01144            content.JsonWriter.WriteObjectValue(parameters);
 01145            request.Content = content;
 01146            return message;
 1147        }
 1148
 1149        /// <summary> Configures flow log and traffic analytics (optional) on a specified resource. </summary>
 1150        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1151        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1152        /// <param name="parameters"> Parameters that define the configuration of flow log. </param>
 1153        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1154        public async Task<Response> SetFlowLogConfigurationAsync(string resourceGroupName, string networkWatcherName, Fl
 1155        {
 01156            if (resourceGroupName == null)
 1157            {
 01158                throw new ArgumentNullException(nameof(resourceGroupName));
 1159            }
 01160            if (networkWatcherName == null)
 1161            {
 01162                throw new ArgumentNullException(nameof(networkWatcherName));
 1163            }
 01164            if (parameters == null)
 1165            {
 01166                throw new ArgumentNullException(nameof(parameters));
 1167            }
 1168
 01169            using var message = CreateSetFlowLogConfigurationRequest(resourceGroupName, networkWatcherName, parameters);
 01170            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01171            switch (message.Response.Status)
 1172            {
 1173                case 200:
 1174                case 202:
 01175                    return message.Response;
 1176                default:
 01177                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1178            }
 01179        }
 1180
 1181        /// <summary> Configures flow log and traffic analytics (optional) on a specified resource. </summary>
 1182        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1183        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1184        /// <param name="parameters"> Parameters that define the configuration of flow log. </param>
 1185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1186        public Response SetFlowLogConfiguration(string resourceGroupName, string networkWatcherName, FlowLogInformation 
 1187        {
 01188            if (resourceGroupName == null)
 1189            {
 01190                throw new ArgumentNullException(nameof(resourceGroupName));
 1191            }
 01192            if (networkWatcherName == null)
 1193            {
 01194                throw new ArgumentNullException(nameof(networkWatcherName));
 1195            }
 01196            if (parameters == null)
 1197            {
 01198                throw new ArgumentNullException(nameof(parameters));
 1199            }
 1200
 01201            using var message = CreateSetFlowLogConfigurationRequest(resourceGroupName, networkWatcherName, parameters);
 01202            _pipeline.Send(message, cancellationToken);
 01203            switch (message.Response.Status)
 1204            {
 1205                case 200:
 1206                case 202:
 01207                    return message.Response;
 1208                default:
 01209                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1210            }
 01211        }
 1212
 1213        internal HttpMessage CreateGetFlowLogStatusRequest(string resourceGroupName, string networkWatcherName, FlowLogS
 1214        {
 01215            var message = _pipeline.CreateMessage();
 01216            var request = message.Request;
 01217            request.Method = RequestMethod.Post;
 01218            var uri = new RawRequestUriBuilder();
 01219            uri.Reset(endpoint);
 01220            uri.AppendPath("/subscriptions/", false);
 01221            uri.AppendPath(subscriptionId, true);
 01222            uri.AppendPath("/resourceGroups/", false);
 01223            uri.AppendPath(resourceGroupName, true);
 01224            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01225            uri.AppendPath(networkWatcherName, true);
 01226            uri.AppendPath("/queryFlowLogStatus", false);
 01227            uri.AppendQuery("api-version", "2020-04-01", true);
 01228            request.Uri = uri;
 01229            request.Headers.Add("Content-Type", "application/json");
 01230            var content = new Utf8JsonRequestContent();
 01231            content.JsonWriter.WriteObjectValue(parameters);
 01232            request.Content = content;
 01233            return message;
 1234        }
 1235
 1236        /// <summary> Queries status of flow log and traffic analytics (optional) on a specified resource. </summary>
 1237        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1238        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1239        /// <param name="parameters"> Parameters that define a resource to query flow log and traffic analytics (optiona
 1240        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1241        public async Task<Response> GetFlowLogStatusAsync(string resourceGroupName, string networkWatcherName, FlowLogSt
 1242        {
 01243            if (resourceGroupName == null)
 1244            {
 01245                throw new ArgumentNullException(nameof(resourceGroupName));
 1246            }
 01247            if (networkWatcherName == null)
 1248            {
 01249                throw new ArgumentNullException(nameof(networkWatcherName));
 1250            }
 01251            if (parameters == null)
 1252            {
 01253                throw new ArgumentNullException(nameof(parameters));
 1254            }
 1255
 01256            using var message = CreateGetFlowLogStatusRequest(resourceGroupName, networkWatcherName, parameters);
 01257            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01258            switch (message.Response.Status)
 1259            {
 1260                case 200:
 1261                case 202:
 01262                    return message.Response;
 1263                default:
 01264                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1265            }
 01266        }
 1267
 1268        /// <summary> Queries status of flow log and traffic analytics (optional) on a specified resource. </summary>
 1269        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1270        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1271        /// <param name="parameters"> Parameters that define a resource to query flow log and traffic analytics (optiona
 1272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1273        public Response GetFlowLogStatus(string resourceGroupName, string networkWatcherName, FlowLogStatusParameters pa
 1274        {
 01275            if (resourceGroupName == null)
 1276            {
 01277                throw new ArgumentNullException(nameof(resourceGroupName));
 1278            }
 01279            if (networkWatcherName == null)
 1280            {
 01281                throw new ArgumentNullException(nameof(networkWatcherName));
 1282            }
 01283            if (parameters == null)
 1284            {
 01285                throw new ArgumentNullException(nameof(parameters));
 1286            }
 1287
 01288            using var message = CreateGetFlowLogStatusRequest(resourceGroupName, networkWatcherName, parameters);
 01289            _pipeline.Send(message, cancellationToken);
 01290            switch (message.Response.Status)
 1291            {
 1292                case 200:
 1293                case 202:
 01294                    return message.Response;
 1295                default:
 01296                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1297            }
 01298        }
 1299
 1300        internal HttpMessage CreateCheckConnectivityRequest(string resourceGroupName, string networkWatcherName, Connect
 1301        {
 81302            var message = _pipeline.CreateMessage();
 81303            var request = message.Request;
 81304            request.Method = RequestMethod.Post;
 81305            var uri = new RawRequestUriBuilder();
 81306            uri.Reset(endpoint);
 81307            uri.AppendPath("/subscriptions/", false);
 81308            uri.AppendPath(subscriptionId, true);
 81309            uri.AppendPath("/resourceGroups/", false);
 81310            uri.AppendPath(resourceGroupName, true);
 81311            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 81312            uri.AppendPath(networkWatcherName, true);
 81313            uri.AppendPath("/connectivityCheck", false);
 81314            uri.AppendQuery("api-version", "2020-04-01", true);
 81315            request.Uri = uri;
 81316            request.Headers.Add("Content-Type", "application/json");
 81317            var content = new Utf8JsonRequestContent();
 81318            content.JsonWriter.WriteObjectValue(parameters);
 81319            request.Content = content;
 81320            return message;
 1321        }
 1322
 1323        /// <summary> Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given
 1324        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1325        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1326        /// <param name="parameters"> Parameters that determine how the connectivity check will be performed. </param>
 1327        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1328        public async Task<Response> CheckConnectivityAsync(string resourceGroupName, string networkWatcherName, Connecti
 1329        {
 21330            if (resourceGroupName == null)
 1331            {
 01332                throw new ArgumentNullException(nameof(resourceGroupName));
 1333            }
 21334            if (networkWatcherName == null)
 1335            {
 01336                throw new ArgumentNullException(nameof(networkWatcherName));
 1337            }
 21338            if (parameters == null)
 1339            {
 01340                throw new ArgumentNullException(nameof(parameters));
 1341            }
 1342
 21343            using var message = CreateCheckConnectivityRequest(resourceGroupName, networkWatcherName, parameters);
 21344            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 21345            switch (message.Response.Status)
 1346            {
 1347                case 200:
 1348                case 202:
 21349                    return message.Response;
 1350                default:
 01351                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1352            }
 21353        }
 1354
 1355        /// <summary> Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given
 1356        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1357        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1358        /// <param name="parameters"> Parameters that determine how the connectivity check will be performed. </param>
 1359        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1360        public Response CheckConnectivity(string resourceGroupName, string networkWatcherName, ConnectivityParameters pa
 1361        {
 21362            if (resourceGroupName == null)
 1363            {
 01364                throw new ArgumentNullException(nameof(resourceGroupName));
 1365            }
 21366            if (networkWatcherName == null)
 1367            {
 01368                throw new ArgumentNullException(nameof(networkWatcherName));
 1369            }
 21370            if (parameters == null)
 1371            {
 01372                throw new ArgumentNullException(nameof(parameters));
 1373            }
 1374
 21375            using var message = CreateCheckConnectivityRequest(resourceGroupName, networkWatcherName, parameters);
 21376            _pipeline.Send(message, cancellationToken);
 21377            switch (message.Response.Status)
 1378            {
 1379                case 200:
 1380                case 202:
 21381                    return message.Response;
 1382                default:
 01383                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1384            }
 21385        }
 1386
 1387        internal HttpMessage CreateGetAzureReachabilityReportRequest(string resourceGroupName, string networkWatcherName
 1388        {
 01389            var message = _pipeline.CreateMessage();
 01390            var request = message.Request;
 01391            request.Method = RequestMethod.Post;
 01392            var uri = new RawRequestUriBuilder();
 01393            uri.Reset(endpoint);
 01394            uri.AppendPath("/subscriptions/", false);
 01395            uri.AppendPath(subscriptionId, true);
 01396            uri.AppendPath("/resourceGroups/", false);
 01397            uri.AppendPath(resourceGroupName, true);
 01398            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01399            uri.AppendPath(networkWatcherName, true);
 01400            uri.AppendPath("/azureReachabilityReport", false);
 01401            uri.AppendQuery("api-version", "2020-04-01", true);
 01402            request.Uri = uri;
 01403            request.Headers.Add("Content-Type", "application/json");
 01404            var content = new Utf8JsonRequestContent();
 01405            content.JsonWriter.WriteObjectValue(parameters);
 01406            request.Content = content;
 01407            return message;
 1408        }
 1409
 1410        /// <summary> NOTE: This feature is currently in preview and still being tested for stability. Gets the relative
 1411        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1412        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1413        /// <param name="parameters"> Parameters that determine Azure reachability report configuration. </param>
 1414        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1415        public async Task<Response> GetAzureReachabilityReportAsync(string resourceGroupName, string networkWatcherName,
 1416        {
 01417            if (resourceGroupName == null)
 1418            {
 01419                throw new ArgumentNullException(nameof(resourceGroupName));
 1420            }
 01421            if (networkWatcherName == null)
 1422            {
 01423                throw new ArgumentNullException(nameof(networkWatcherName));
 1424            }
 01425            if (parameters == null)
 1426            {
 01427                throw new ArgumentNullException(nameof(parameters));
 1428            }
 1429
 01430            using var message = CreateGetAzureReachabilityReportRequest(resourceGroupName, networkWatcherName, parameter
 01431            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01432            switch (message.Response.Status)
 1433            {
 1434                case 200:
 1435                case 202:
 01436                    return message.Response;
 1437                default:
 01438                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1439            }
 01440        }
 1441
 1442        /// <summary> NOTE: This feature is currently in preview and still being tested for stability. Gets the relative
 1443        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1444        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1445        /// <param name="parameters"> Parameters that determine Azure reachability report configuration. </param>
 1446        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1447        public Response GetAzureReachabilityReport(string resourceGroupName, string networkWatcherName, AzureReachabilit
 1448        {
 01449            if (resourceGroupName == null)
 1450            {
 01451                throw new ArgumentNullException(nameof(resourceGroupName));
 1452            }
 01453            if (networkWatcherName == null)
 1454            {
 01455                throw new ArgumentNullException(nameof(networkWatcherName));
 1456            }
 01457            if (parameters == null)
 1458            {
 01459                throw new ArgumentNullException(nameof(parameters));
 1460            }
 1461
 01462            using var message = CreateGetAzureReachabilityReportRequest(resourceGroupName, networkWatcherName, parameter
 01463            _pipeline.Send(message, cancellationToken);
 01464            switch (message.Response.Status)
 1465            {
 1466                case 200:
 1467                case 202:
 01468                    return message.Response;
 1469                default:
 01470                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1471            }
 01472        }
 1473
 1474        internal HttpMessage CreateListAvailableProvidersRequest(string resourceGroupName, string networkWatcherName, Av
 1475        {
 01476            var message = _pipeline.CreateMessage();
 01477            var request = message.Request;
 01478            request.Method = RequestMethod.Post;
 01479            var uri = new RawRequestUriBuilder();
 01480            uri.Reset(endpoint);
 01481            uri.AppendPath("/subscriptions/", false);
 01482            uri.AppendPath(subscriptionId, true);
 01483            uri.AppendPath("/resourceGroups/", false);
 01484            uri.AppendPath(resourceGroupName, true);
 01485            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01486            uri.AppendPath(networkWatcherName, true);
 01487            uri.AppendPath("/availableProvidersList", false);
 01488            uri.AppendQuery("api-version", "2020-04-01", true);
 01489            request.Uri = uri;
 01490            request.Headers.Add("Content-Type", "application/json");
 01491            var content = new Utf8JsonRequestContent();
 01492            content.JsonWriter.WriteObjectValue(parameters);
 01493            request.Content = content;
 01494            return message;
 1495        }
 1496
 1497        /// <summary> NOTE: This feature is currently in preview and still being tested for stability. Lists all availab
 1498        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1499        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1500        /// <param name="parameters"> Parameters that scope the list of available providers. </param>
 1501        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1502        public async Task<Response> ListAvailableProvidersAsync(string resourceGroupName, string networkWatcherName, Ava
 1503        {
 01504            if (resourceGroupName == null)
 1505            {
 01506                throw new ArgumentNullException(nameof(resourceGroupName));
 1507            }
 01508            if (networkWatcherName == null)
 1509            {
 01510                throw new ArgumentNullException(nameof(networkWatcherName));
 1511            }
 01512            if (parameters == null)
 1513            {
 01514                throw new ArgumentNullException(nameof(parameters));
 1515            }
 1516
 01517            using var message = CreateListAvailableProvidersRequest(resourceGroupName, networkWatcherName, parameters);
 01518            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01519            switch (message.Response.Status)
 1520            {
 1521                case 200:
 1522                case 202:
 01523                    return message.Response;
 1524                default:
 01525                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1526            }
 01527        }
 1528
 1529        /// <summary> NOTE: This feature is currently in preview and still being tested for stability. Lists all availab
 1530        /// <param name="resourceGroupName"> The name of the network watcher resource group. </param>
 1531        /// <param name="networkWatcherName"> The name of the network watcher resource. </param>
 1532        /// <param name="parameters"> Parameters that scope the list of available providers. </param>
 1533        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1534        public Response ListAvailableProviders(string resourceGroupName, string networkWatcherName, AvailableProvidersLi
 1535        {
 01536            if (resourceGroupName == null)
 1537            {
 01538                throw new ArgumentNullException(nameof(resourceGroupName));
 1539            }
 01540            if (networkWatcherName == null)
 1541            {
 01542                throw new ArgumentNullException(nameof(networkWatcherName));
 1543            }
 01544            if (parameters == null)
 1545            {
 01546                throw new ArgumentNullException(nameof(parameters));
 1547            }
 1548
 01549            using var message = CreateListAvailableProvidersRequest(resourceGroupName, networkWatcherName, parameters);
 01550            _pipeline.Send(message, cancellationToken);
 01551            switch (message.Response.Status)
 1552            {
 1553                case 200:
 1554                case 202:
 01555                    return message.Response;
 1556                default:
 01557                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1558            }
 01559        }
 1560
 1561        internal HttpMessage CreateGetNetworkConfigurationDiagnosticRequest(string resourceGroupName, string networkWatc
 1562        {
 01563            var message = _pipeline.CreateMessage();
 01564            var request = message.Request;
 01565            request.Method = RequestMethod.Post;
 01566            var uri = new RawRequestUriBuilder();
 01567            uri.Reset(endpoint);
 01568            uri.AppendPath("/subscriptions/", false);
 01569            uri.AppendPath(subscriptionId, true);
 01570            uri.AppendPath("/resourceGroups/", false);
 01571            uri.AppendPath(resourceGroupName, true);
 01572            uri.AppendPath("/providers/Microsoft.Network/networkWatchers/", false);
 01573            uri.AppendPath(networkWatcherName, true);
 01574            uri.AppendPath("/networkConfigurationDiagnostic", false);
 01575            uri.AppendQuery("api-version", "2020-04-01", true);
 01576            request.Uri = uri;
 01577            request.Headers.Add("Content-Type", "application/json");
 01578            var content = new Utf8JsonRequestContent();
 01579            content.JsonWriter.WriteObjectValue(parameters);
 01580            request.Content = content;
 01581            return message;
 1582        }
 1583
 1584        /// <summary> Gets Network Configuration Diagnostic data to help customers understand and debug network behavior
 1585        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1586        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 1587        /// <param name="parameters"> Parameters to get network configuration diagnostic. </param>
 1588        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1589        public async Task<Response> GetNetworkConfigurationDiagnosticAsync(string resourceGroupName, string networkWatch
 1590        {
 01591            if (resourceGroupName == null)
 1592            {
 01593                throw new ArgumentNullException(nameof(resourceGroupName));
 1594            }
 01595            if (networkWatcherName == null)
 1596            {
 01597                throw new ArgumentNullException(nameof(networkWatcherName));
 1598            }
 01599            if (parameters == null)
 1600            {
 01601                throw new ArgumentNullException(nameof(parameters));
 1602            }
 1603
 01604            using var message = CreateGetNetworkConfigurationDiagnosticRequest(resourceGroupName, networkWatcherName, pa
 01605            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01606            switch (message.Response.Status)
 1607            {
 1608                case 200:
 1609                case 202:
 01610                    return message.Response;
 1611                default:
 01612                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1613            }
 01614        }
 1615
 1616        /// <summary> Gets Network Configuration Diagnostic data to help customers understand and debug network behavior
 1617        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1618        /// <param name="networkWatcherName"> The name of the network watcher. </param>
 1619        /// <param name="parameters"> Parameters to get network configuration diagnostic. </param>
 1620        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1621        public Response GetNetworkConfigurationDiagnostic(string resourceGroupName, string networkWatcherName, NetworkCo
 1622        {
 01623            if (resourceGroupName == null)
 1624            {
 01625                throw new ArgumentNullException(nameof(resourceGroupName));
 1626            }
 01627            if (networkWatcherName == null)
 1628            {
 01629                throw new ArgumentNullException(nameof(networkWatcherName));
 1630            }
 01631            if (parameters == null)
 1632            {
 01633                throw new ArgumentNullException(nameof(parameters));
 1634            }
 1635
 01636            using var message = CreateGetNetworkConfigurationDiagnosticRequest(resourceGroupName, networkWatcherName, pa
 01637            _pipeline.Send(message, cancellationToken);
 01638            switch (message.Response.Status)
 1639            {
 1640                case 200:
 1641                case 202:
 01642                    return message.Response;
 1643                default:
 01644                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1645            }
 01646        }
 1647    }
 1648}