< Summary

Class:Azure.ResourceManager.Compute.DedicatedHostGroupsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DedicatedHostGroupsRestOperations.cs
Covered lines:218
Uncovered lines:117
Coverable lines:335
Total lines:748
Line coverage:65% (218 of 335)
Covered branches:48
Total branches:124
Branch coverage:38.7% (48 of 124)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-70.59%50%
CreateOrUpdate(...)-70.59%50%
CreateUpdateRequest(...)-100%100%
UpdateAsync()-70.59%50%
Update(...)-70.59%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-76.92%50%
ListByResourceGroup(...)-76.92%50%
CreateListBySubscriptionRequest()-100%100%
ListBySubscriptionAsync()-81.82%50%
ListBySubscription(...)-81.82%50%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%
CreateListBySubscriptionNextPageRequest(...)-0%100%
ListBySubscriptionNextPageAsync()-0%0%
ListBySubscriptionNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DedicatedHostGroupsRestOperations.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.Compute.Models;
 16
 17namespace Azure.ResourceManager.Compute
 18{
 19    internal partial class DedicatedHostGroupsRestOperations
 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 DedicatedHostGroupsRestOperations. </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"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 39632        public DedicatedHostGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subs
 33        {
 39634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 39638            endpoint ??= new Uri("https://management.azure.com");
 39
 39640            this.subscriptionId = subscriptionId;
 39641            this.endpoint = endpoint;
 39642            _clientDiagnostics = clientDiagnostics;
 39643            _pipeline = pipeline;
 39644        }
 45
 46        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string hostGroupName, DedicatedHostGr
 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.Compute/hostGroups/", false);
 458            uri.AppendPath(hostGroupName, true);
 459            uri.AppendQuery("api-version", "2019-12-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> Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups p
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 71        /// <param name="parameters"> Parameters supplied to the Create Dedicated Host Group. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response<DedicatedHostGroup>> CreateOrUpdateAsync(string resourceGroupName, string hostGroupNa
 74        {
 275            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 279            if (hostGroupName == null)
 80            {
 081                throw new ArgumentNullException(nameof(hostGroupName));
 82            }
 283            if (parameters == null)
 84            {
 085                throw new ArgumentNullException(nameof(parameters));
 86            }
 87
 288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, hostGroupName, parameters);
 289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 290            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 94                    {
 295                        DedicatedHostGroup 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 = DedicatedHostGroup.DeserializeDedicatedHostGroup(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> Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups p
 113        /// <param name="resourceGroupName"> The name of the resource group. </param>
 114        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 115        /// <param name="parameters"> Parameters supplied to the Create Dedicated Host Group. </param>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public Response<DedicatedHostGroup> CreateOrUpdate(string resourceGroupName, string hostGroupName, DedicatedHost
 118        {
 2119            if (resourceGroupName == null)
 120            {
 0121                throw new ArgumentNullException(nameof(resourceGroupName));
 122            }
 2123            if (hostGroupName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(hostGroupName));
 126            }
 2127            if (parameters == null)
 128            {
 0129                throw new ArgumentNullException(nameof(parameters));
 130            }
 131
 2132            using var message = CreateCreateOrUpdateRequest(resourceGroupName, hostGroupName, parameters);
 2133            _pipeline.Send(message, cancellationToken);
 2134            switch (message.Response.Status)
 135            {
 136                case 200:
 137                case 201:
 138                    {
 2139                        DedicatedHostGroup 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 = DedicatedHostGroup.DeserializeDedicatedHostGroup(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 CreateUpdateRequest(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdat
 157        {
 4158            var message = _pipeline.CreateMessage();
 4159            var request = message.Request;
 4160            request.Method = RequestMethod.Patch;
 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.Compute/hostGroups/", false);
 4168            uri.AppendPath(hostGroupName, true);
 4169            uri.AppendQuery("api-version", "2019-12-01", true);
 4170            request.Uri = uri;
 4171            request.Headers.Add("Content-Type", "application/json");
 4172            var content = new Utf8JsonRequestContent();
 4173            content.JsonWriter.WriteObjectValue(parameters);
 4174            request.Content = content;
 4175            return message;
 176        }
 177
 178        /// <summary> Update an dedicated host group. </summary>
 179        /// <param name="resourceGroupName"> The name of the resource group. </param>
 180        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 181        /// <param name="parameters"> Parameters supplied to the Update Dedicated Host Group operation. </param>
 182        /// <param name="cancellationToken"> The cancellation token to use. </param>
 183        public async Task<Response<DedicatedHostGroup>> UpdateAsync(string resourceGroupName, string hostGroupName, Dedi
 184        {
 2185            if (resourceGroupName == null)
 186            {
 0187                throw new ArgumentNullException(nameof(resourceGroupName));
 188            }
 2189            if (hostGroupName == null)
 190            {
 0191                throw new ArgumentNullException(nameof(hostGroupName));
 192            }
 2193            if (parameters == null)
 194            {
 0195                throw new ArgumentNullException(nameof(parameters));
 196            }
 197
 2198            using var message = CreateUpdateRequest(resourceGroupName, hostGroupName, parameters);
 2199            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2200            switch (message.Response.Status)
 201            {
 202                case 200:
 203                    {
 2204                        DedicatedHostGroup value = default;
 2205                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2206                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 207                        {
 0208                            value = null;
 209                        }
 210                        else
 211                        {
 2212                            value = DedicatedHostGroup.DeserializeDedicatedHostGroup(document.RootElement);
 213                        }
 2214                        return Response.FromValue(value, message.Response);
 215                    }
 216                default:
 0217                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 218            }
 2219        }
 220
 221        /// <summary> Update an dedicated host group. </summary>
 222        /// <param name="resourceGroupName"> The name of the resource group. </param>
 223        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 224        /// <param name="parameters"> Parameters supplied to the Update Dedicated Host Group operation. </param>
 225        /// <param name="cancellationToken"> The cancellation token to use. </param>
 226        public Response<DedicatedHostGroup> Update(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpd
 227        {
 2228            if (resourceGroupName == null)
 229            {
 0230                throw new ArgumentNullException(nameof(resourceGroupName));
 231            }
 2232            if (hostGroupName == null)
 233            {
 0234                throw new ArgumentNullException(nameof(hostGroupName));
 235            }
 2236            if (parameters == null)
 237            {
 0238                throw new ArgumentNullException(nameof(parameters));
 239            }
 240
 2241            using var message = CreateUpdateRequest(resourceGroupName, hostGroupName, parameters);
 2242            _pipeline.Send(message, cancellationToken);
 2243            switch (message.Response.Status)
 244            {
 245                case 200:
 246                    {
 2247                        DedicatedHostGroup value = default;
 2248                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2249                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 250                        {
 0251                            value = null;
 252                        }
 253                        else
 254                        {
 2255                            value = DedicatedHostGroup.DeserializeDedicatedHostGroup(document.RootElement);
 256                        }
 2257                        return Response.FromValue(value, message.Response);
 258                    }
 259                default:
 0260                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 261            }
 2262        }
 263
 264        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string hostGroupName)
 265        {
 4266            var message = _pipeline.CreateMessage();
 4267            var request = message.Request;
 4268            request.Method = RequestMethod.Delete;
 4269            var uri = new RawRequestUriBuilder();
 4270            uri.Reset(endpoint);
 4271            uri.AppendPath("/subscriptions/", false);
 4272            uri.AppendPath(subscriptionId, true);
 4273            uri.AppendPath("/resourceGroups/", false);
 4274            uri.AppendPath(resourceGroupName, true);
 4275            uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false);
 4276            uri.AppendPath(hostGroupName, true);
 4277            uri.AppendQuery("api-version", "2019-12-01", true);
 4278            request.Uri = uri;
 4279            return message;
 280        }
 281
 282        /// <summary> Delete a dedicated host group. </summary>
 283        /// <param name="resourceGroupName"> The name of the resource group. </param>
 284        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 285        /// <param name="cancellationToken"> The cancellation token to use. </param>
 286        public async Task<Response> DeleteAsync(string resourceGroupName, string hostGroupName, CancellationToken cancel
 287        {
 2288            if (resourceGroupName == null)
 289            {
 0290                throw new ArgumentNullException(nameof(resourceGroupName));
 291            }
 2292            if (hostGroupName == null)
 293            {
 0294                throw new ArgumentNullException(nameof(hostGroupName));
 295            }
 296
 2297            using var message = CreateDeleteRequest(resourceGroupName, hostGroupName);
 2298            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2299            switch (message.Response.Status)
 300            {
 301                case 200:
 302                case 204:
 2303                    return message.Response;
 304                default:
 0305                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 306            }
 2307        }
 308
 309        /// <summary> Delete a dedicated host group. </summary>
 310        /// <param name="resourceGroupName"> The name of the resource group. </param>
 311        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public Response Delete(string resourceGroupName, string hostGroupName, CancellationToken cancellationToken = def
 314        {
 2315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 2319            if (hostGroupName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(hostGroupName));
 322            }
 323
 2324            using var message = CreateDeleteRequest(resourceGroupName, hostGroupName);
 2325            _pipeline.Send(message, cancellationToken);
 2326            switch (message.Response.Status)
 327            {
 328                case 200:
 329                case 204:
 2330                    return message.Response;
 331                default:
 0332                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 333            }
 2334        }
 335
 336        internal HttpMessage CreateGetRequest(string resourceGroupName, string hostGroupName)
 337        {
 8338            var message = _pipeline.CreateMessage();
 8339            var request = message.Request;
 8340            request.Method = RequestMethod.Get;
 8341            var uri = new RawRequestUriBuilder();
 8342            uri.Reset(endpoint);
 8343            uri.AppendPath("/subscriptions/", false);
 8344            uri.AppendPath(subscriptionId, true);
 8345            uri.AppendPath("/resourceGroups/", false);
 8346            uri.AppendPath(resourceGroupName, true);
 8347            uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false);
 8348            uri.AppendPath(hostGroupName, true);
 8349            uri.AppendQuery("api-version", "2019-12-01", true);
 8350            request.Uri = uri;
 8351            return message;
 352        }
 353
 354        /// <summary> Retrieves information about a dedicated host group. </summary>
 355        /// <param name="resourceGroupName"> The name of the resource group. </param>
 356        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 357        /// <param name="cancellationToken"> The cancellation token to use. </param>
 358        public async Task<Response<DedicatedHostGroup>> GetAsync(string resourceGroupName, string hostGroupName, Cancell
 359        {
 4360            if (resourceGroupName == null)
 361            {
 0362                throw new ArgumentNullException(nameof(resourceGroupName));
 363            }
 4364            if (hostGroupName == null)
 365            {
 0366                throw new ArgumentNullException(nameof(hostGroupName));
 367            }
 368
 4369            using var message = CreateGetRequest(resourceGroupName, hostGroupName);
 4370            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4371            switch (message.Response.Status)
 372            {
 373                case 200:
 374                    {
 4375                        DedicatedHostGroup value = default;
 4376                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4377                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 378                        {
 0379                            value = null;
 380                        }
 381                        else
 382                        {
 4383                            value = DedicatedHostGroup.DeserializeDedicatedHostGroup(document.RootElement);
 384                        }
 4385                        return Response.FromValue(value, message.Response);
 386                    }
 387                default:
 0388                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 389            }
 4390        }
 391
 392        /// <summary> Retrieves information about a dedicated host group. </summary>
 393        /// <param name="resourceGroupName"> The name of the resource group. </param>
 394        /// <param name="hostGroupName"> The name of the dedicated host group. </param>
 395        /// <param name="cancellationToken"> The cancellation token to use. </param>
 396        public Response<DedicatedHostGroup> Get(string resourceGroupName, string hostGroupName, CancellationToken cancel
 397        {
 4398            if (resourceGroupName == null)
 399            {
 0400                throw new ArgumentNullException(nameof(resourceGroupName));
 401            }
 4402            if (hostGroupName == null)
 403            {
 0404                throw new ArgumentNullException(nameof(hostGroupName));
 405            }
 406
 4407            using var message = CreateGetRequest(resourceGroupName, hostGroupName);
 4408            _pipeline.Send(message, cancellationToken);
 4409            switch (message.Response.Status)
 410            {
 411                case 200:
 412                    {
 4413                        DedicatedHostGroup value = default;
 4414                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4415                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 416                        {
 0417                            value = null;
 418                        }
 419                        else
 420                        {
 4421                            value = DedicatedHostGroup.DeserializeDedicatedHostGroup(document.RootElement);
 422                        }
 4423                        return Response.FromValue(value, message.Response);
 424                    }
 425                default:
 0426                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 427            }
 4428        }
 429
 430        internal HttpMessage CreateListByResourceGroupRequest(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.Compute/hostGroups", false);
 4442            uri.AppendQuery("api-version", "2019-12-01", true);
 4443            request.Uri = uri;
 4444            return message;
 445        }
 446
 447        /// <summary> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property 
 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<DedicatedHostGroupListResult>> ListByResourceGroupAsync(string resourceGroupName, Can
 451        {
 2452            if (resourceGroupName == null)
 453            {
 0454                throw new ArgumentNullException(nameof(resourceGroupName));
 455            }
 456
 2457            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 2458            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2459            switch (message.Response.Status)
 460            {
 461                case 200:
 462                    {
 2463                        DedicatedHostGroupListResult 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 = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 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> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property 
 481        /// <param name="resourceGroupName"> The name of the resource group. </param>
 482        /// <param name="cancellationToken"> The cancellation token to use. </param>
 483        public Response<DedicatedHostGroupListResult> ListByResourceGroup(string resourceGroupName, CancellationToken ca
 484        {
 2485            if (resourceGroupName == null)
 486            {
 0487                throw new ArgumentNullException(nameof(resourceGroupName));
 488            }
 489
 2490            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 2491            _pipeline.Send(message, cancellationToken);
 2492            switch (message.Response.Status)
 493            {
 494                case 200:
 495                    {
 2496                        DedicatedHostGroupListResult 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 = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 505                        }
 2506                        return Response.FromValue(value, message.Response);
 507                    }
 508                default:
 0509                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 510            }
 2511        }
 512
 513        internal HttpMessage CreateListBySubscriptionRequest()
 514        {
 4515            var message = _pipeline.CreateMessage();
 4516            var request = message.Request;
 4517            request.Method = RequestMethod.Get;
 4518            var uri = new RawRequestUriBuilder();
 4519            uri.Reset(endpoint);
 4520            uri.AppendPath("/subscriptions/", false);
 4521            uri.AppendPath(subscriptionId, true);
 4522            uri.AppendPath("/providers/Microsoft.Compute/hostGroups", false);
 4523            uri.AppendQuery("api-version", "2019-12-01", true);
 4524            request.Uri = uri;
 4525            return message;
 526        }
 527
 528        /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo
 529        /// <param name="cancellationToken"> The cancellation token to use. </param>
 530        public async Task<Response<DedicatedHostGroupListResult>> ListBySubscriptionAsync(CancellationToken cancellation
 531        {
 2532            using var message = CreateListBySubscriptionRequest();
 2533            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2534            switch (message.Response.Status)
 535            {
 536                case 200:
 537                    {
 2538                        DedicatedHostGroupListResult value = default;
 2539                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2540                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 541                        {
 0542                            value = null;
 543                        }
 544                        else
 545                        {
 2546                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 547                        }
 2548                        return Response.FromValue(value, message.Response);
 549                    }
 550                default:
 0551                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 552            }
 2553        }
 554
 555        /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo
 556        /// <param name="cancellationToken"> The cancellation token to use. </param>
 557        public Response<DedicatedHostGroupListResult> ListBySubscription(CancellationToken cancellationToken = default)
 558        {
 2559            using var message = CreateListBySubscriptionRequest();
 2560            _pipeline.Send(message, cancellationToken);
 2561            switch (message.Response.Status)
 562            {
 563                case 200:
 564                    {
 2565                        DedicatedHostGroupListResult value = default;
 2566                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2567                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 568                        {
 0569                            value = null;
 570                        }
 571                        else
 572                        {
 2573                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 574                        }
 2575                        return Response.FromValue(value, message.Response);
 576                    }
 577                default:
 0578                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 579            }
 2580        }
 581
 582        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 583        {
 0584            var message = _pipeline.CreateMessage();
 0585            var request = message.Request;
 0586            request.Method = RequestMethod.Get;
 0587            var uri = new RawRequestUriBuilder();
 0588            uri.Reset(endpoint);
 0589            uri.AppendRawNextLink(nextLink, false);
 0590            request.Uri = uri;
 0591            return message;
 592        }
 593
 594        /// <summary> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property 
 595        /// <param name="nextLink"> The URL to the next page of results. </param>
 596        /// <param name="resourceGroupName"> The name of the resource group. </param>
 597        /// <param name="cancellationToken"> The cancellation token to use. </param>
 598        public async Task<Response<DedicatedHostGroupListResult>> ListByResourceGroupNextPageAsync(string nextLink, stri
 599        {
 0600            if (nextLink == null)
 601            {
 0602                throw new ArgumentNullException(nameof(nextLink));
 603            }
 0604            if (resourceGroupName == null)
 605            {
 0606                throw new ArgumentNullException(nameof(resourceGroupName));
 607            }
 608
 0609            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0610            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0611            switch (message.Response.Status)
 612            {
 613                case 200:
 614                    {
 0615                        DedicatedHostGroupListResult value = default;
 0616                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0617                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 618                        {
 0619                            value = null;
 620                        }
 621                        else
 622                        {
 0623                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 624                        }
 0625                        return Response.FromValue(value, message.Response);
 626                    }
 627                default:
 0628                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 629            }
 0630        }
 631
 632        /// <summary> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property 
 633        /// <param name="nextLink"> The URL to the next page of results. </param>
 634        /// <param name="resourceGroupName"> The name of the resource group. </param>
 635        /// <param name="cancellationToken"> The cancellation token to use. </param>
 636        public Response<DedicatedHostGroupListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupN
 637        {
 0638            if (nextLink == null)
 639            {
 0640                throw new ArgumentNullException(nameof(nextLink));
 641            }
 0642            if (resourceGroupName == null)
 643            {
 0644                throw new ArgumentNullException(nameof(resourceGroupName));
 645            }
 646
 0647            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0648            _pipeline.Send(message, cancellationToken);
 0649            switch (message.Response.Status)
 650            {
 651                case 200:
 652                    {
 0653                        DedicatedHostGroupListResult value = default;
 0654                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0655                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 656                        {
 0657                            value = null;
 658                        }
 659                        else
 660                        {
 0661                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 662                        }
 0663                        return Response.FromValue(value, message.Response);
 664                    }
 665                default:
 0666                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 667            }
 0668        }
 669
 670        internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
 671        {
 0672            var message = _pipeline.CreateMessage();
 0673            var request = message.Request;
 0674            request.Method = RequestMethod.Get;
 0675            var uri = new RawRequestUriBuilder();
 0676            uri.Reset(endpoint);
 0677            uri.AppendRawNextLink(nextLink, false);
 0678            request.Uri = uri;
 0679            return message;
 680        }
 681
 682        /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo
 683        /// <param name="nextLink"> The URL to the next page of results. </param>
 684        /// <param name="cancellationToken"> The cancellation token to use. </param>
 685        public async Task<Response<DedicatedHostGroupListResult>> ListBySubscriptionNextPageAsync(string nextLink, Cance
 686        {
 0687            if (nextLink == null)
 688            {
 0689                throw new ArgumentNullException(nameof(nextLink));
 690            }
 691
 0692            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0693            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0694            switch (message.Response.Status)
 695            {
 696                case 200:
 697                    {
 0698                        DedicatedHostGroupListResult value = default;
 0699                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0700                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 701                        {
 0702                            value = null;
 703                        }
 704                        else
 705                        {
 0706                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 707                        }
 0708                        return Response.FromValue(value, message.Response);
 709                    }
 710                default:
 0711                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 712            }
 0713        }
 714
 715        /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo
 716        /// <param name="nextLink"> The URL to the next page of results. </param>
 717        /// <param name="cancellationToken"> The cancellation token to use. </param>
 718        public Response<DedicatedHostGroupListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken canc
 719        {
 0720            if (nextLink == null)
 721            {
 0722                throw new ArgumentNullException(nameof(nextLink));
 723            }
 724
 0725            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0726            _pipeline.Send(message, cancellationToken);
 0727            switch (message.Response.Status)
 728            {
 729                case 200:
 730                    {
 0731                        DedicatedHostGroupListResult value = default;
 0732                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0733                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 734                        {
 0735                            value = null;
 736                        }
 737                        else
 738                        {
 0739                            value = DedicatedHostGroupListResult.DeserializeDedicatedHostGroupListResult(document.RootEl
 740                        }
 0741                        return Response.FromValue(value, message.Response);
 742                    }
 743                default:
 0744                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 745            }
 0746        }
 747    }
 748}