< Summary

Class:Azure.ResourceManager.Compute.ProximityPlacementGroupsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ProximityPlacementGroupsRestOperations.cs
Covered lines:87
Uncovered lines:250
Coverable lines:337
Total lines:752
Line coverage:25.8% (87 of 337)
Covered branches:21
Total branches:122
Branch coverage:17.2% (21 of 122)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ProximityPlacementGroupsRestOperations.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 ProximityPlacementGroupsRestOperations
 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 ProximityPlacementGroupsRestOperations. </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 ProximityPlacementGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string
 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 proximityPlacementGroupName, P
 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/proximityPlacementGroups/", false);
 458            uri.AppendPath(proximityPlacementGroupName, 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 proximity placement group. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 71        /// <param name="parameters"> Parameters supplied to the Create Proximity Placement Group operation. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response<ProximityPlacementGroup>> CreateOrUpdateAsync(string resourceGroupName, string proxim
 74        {
 275            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 279            if (proximityPlacementGroupName == null)
 80            {
 081                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 82            }
 283            if (parameters == null)
 84            {
 085                throw new ArgumentNullException(nameof(parameters));
 86            }
 87
 288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, proximityPlacementGroupName, parameters);
 289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 290            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 94                    {
 295                        ProximityPlacementGroup 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 = ProximityPlacementGroup.DeserializeProximityPlacementGroup(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 proximity placement group. </summary>
 113        /// <param name="resourceGroupName"> The name of the resource group. </param>
 114        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 115        /// <param name="parameters"> Parameters supplied to the Create Proximity Placement Group operation. </param>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public Response<ProximityPlacementGroup> CreateOrUpdate(string resourceGroupName, string proximityPlacementGroup
 118        {
 2119            if (resourceGroupName == null)
 120            {
 0121                throw new ArgumentNullException(nameof(resourceGroupName));
 122            }
 2123            if (proximityPlacementGroupName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 126            }
 2127            if (parameters == null)
 128            {
 0129                throw new ArgumentNullException(nameof(parameters));
 130            }
 131
 2132            using var message = CreateCreateOrUpdateRequest(resourceGroupName, proximityPlacementGroupName, parameters);
 2133            _pipeline.Send(message, cancellationToken);
 2134            switch (message.Response.Status)
 135            {
 136                case 200:
 137                case 201:
 138                    {
 2139                        ProximityPlacementGroup 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 = ProximityPlacementGroup.DeserializeProximityPlacementGroup(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 proximityPlacementGroupName, UpdateRes
 157        {
 0158            var message = _pipeline.CreateMessage();
 0159            var request = message.Request;
 0160            request.Method = RequestMethod.Patch;
 0161            var uri = new RawRequestUriBuilder();
 0162            uri.Reset(endpoint);
 0163            uri.AppendPath("/subscriptions/", false);
 0164            uri.AppendPath(subscriptionId, true);
 0165            uri.AppendPath("/resourceGroups/", false);
 0166            uri.AppendPath(resourceGroupName, true);
 0167            uri.AppendPath("/providers/Microsoft.Compute/proximityPlacementGroups/", false);
 0168            uri.AppendPath(proximityPlacementGroupName, true);
 0169            uri.AppendQuery("api-version", "2019-12-01", true);
 0170            request.Uri = uri;
 0171            request.Headers.Add("Content-Type", "application/json");
 0172            var content = new Utf8JsonRequestContent();
 0173            content.JsonWriter.WriteObjectValue(parameters);
 0174            request.Content = content;
 0175            return message;
 176        }
 177
 178        /// <summary> Update a proximity placement group. </summary>
 179        /// <param name="resourceGroupName"> The name of the resource group. </param>
 180        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 181        /// <param name="parameters"> Parameters supplied to the Update Proximity Placement Group operation. </param>
 182        /// <param name="cancellationToken"> The cancellation token to use. </param>
 183        public async Task<Response<ProximityPlacementGroup>> UpdateAsync(string resourceGroupName, string proximityPlace
 184        {
 0185            if (resourceGroupName == null)
 186            {
 0187                throw new ArgumentNullException(nameof(resourceGroupName));
 188            }
 0189            if (proximityPlacementGroupName == null)
 190            {
 0191                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 192            }
 0193            if (parameters == null)
 194            {
 0195                throw new ArgumentNullException(nameof(parameters));
 196            }
 197
 0198            using var message = CreateUpdateRequest(resourceGroupName, proximityPlacementGroupName, parameters);
 0199            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0200            switch (message.Response.Status)
 201            {
 202                case 200:
 203                    {
 0204                        ProximityPlacementGroup value = default;
 0205                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0206                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 207                        {
 0208                            value = null;
 209                        }
 210                        else
 211                        {
 0212                            value = ProximityPlacementGroup.DeserializeProximityPlacementGroup(document.RootElement);
 213                        }
 0214                        return Response.FromValue(value, message.Response);
 215                    }
 216                default:
 0217                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 218            }
 0219        }
 220
 221        /// <summary> Update a proximity placement group. </summary>
 222        /// <param name="resourceGroupName"> The name of the resource group. </param>
 223        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 224        /// <param name="parameters"> Parameters supplied to the Update Proximity Placement Group operation. </param>
 225        /// <param name="cancellationToken"> The cancellation token to use. </param>
 226        public Response<ProximityPlacementGroup> Update(string resourceGroupName, string proximityPlacementGroupName, Up
 227        {
 0228            if (resourceGroupName == null)
 229            {
 0230                throw new ArgumentNullException(nameof(resourceGroupName));
 231            }
 0232            if (proximityPlacementGroupName == null)
 233            {
 0234                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 235            }
 0236            if (parameters == null)
 237            {
 0238                throw new ArgumentNullException(nameof(parameters));
 239            }
 240
 0241            using var message = CreateUpdateRequest(resourceGroupName, proximityPlacementGroupName, parameters);
 0242            _pipeline.Send(message, cancellationToken);
 0243            switch (message.Response.Status)
 244            {
 245                case 200:
 246                    {
 0247                        ProximityPlacementGroup value = default;
 0248                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0249                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 250                        {
 0251                            value = null;
 252                        }
 253                        else
 254                        {
 0255                            value = ProximityPlacementGroup.DeserializeProximityPlacementGroup(document.RootElement);
 256                        }
 0257                        return Response.FromValue(value, message.Response);
 258                    }
 259                default:
 0260                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 261            }
 0262        }
 263
 264        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string proximityPlacementGroupName)
 265        {
 0266            var message = _pipeline.CreateMessage();
 0267            var request = message.Request;
 0268            request.Method = RequestMethod.Delete;
 0269            var uri = new RawRequestUriBuilder();
 0270            uri.Reset(endpoint);
 0271            uri.AppendPath("/subscriptions/", false);
 0272            uri.AppendPath(subscriptionId, true);
 0273            uri.AppendPath("/resourceGroups/", false);
 0274            uri.AppendPath(resourceGroupName, true);
 0275            uri.AppendPath("/providers/Microsoft.Compute/proximityPlacementGroups/", false);
 0276            uri.AppendPath(proximityPlacementGroupName, true);
 0277            uri.AppendQuery("api-version", "2019-12-01", true);
 0278            request.Uri = uri;
 0279            return message;
 280        }
 281
 282        /// <summary> Delete a proximity placement group. </summary>
 283        /// <param name="resourceGroupName"> The name of the resource group. </param>
 284        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 285        /// <param name="cancellationToken"> The cancellation token to use. </param>
 286        public async Task<Response> DeleteAsync(string resourceGroupName, string proximityPlacementGroupName, Cancellati
 287        {
 0288            if (resourceGroupName == null)
 289            {
 0290                throw new ArgumentNullException(nameof(resourceGroupName));
 291            }
 0292            if (proximityPlacementGroupName == null)
 293            {
 0294                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 295            }
 296
 0297            using var message = CreateDeleteRequest(resourceGroupName, proximityPlacementGroupName);
 0298            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0299            switch (message.Response.Status)
 300            {
 301                case 200:
 0302                    return message.Response;
 303                default:
 0304                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 305            }
 0306        }
 307
 308        /// <summary> Delete a proximity placement group. </summary>
 309        /// <param name="resourceGroupName"> The name of the resource group. </param>
 310        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 311        /// <param name="cancellationToken"> The cancellation token to use. </param>
 312        public Response Delete(string resourceGroupName, string proximityPlacementGroupName, CancellationToken cancellat
 313        {
 0314            if (resourceGroupName == null)
 315            {
 0316                throw new ArgumentNullException(nameof(resourceGroupName));
 317            }
 0318            if (proximityPlacementGroupName == null)
 319            {
 0320                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 321            }
 322
 0323            using var message = CreateDeleteRequest(resourceGroupName, proximityPlacementGroupName);
 0324            _pipeline.Send(message, cancellationToken);
 0325            switch (message.Response.Status)
 326            {
 327                case 200:
 0328                    return message.Response;
 329                default:
 0330                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 331            }
 0332        }
 333
 334        internal HttpMessage CreateGetRequest(string resourceGroupName, string proximityPlacementGroupName, string inclu
 335        {
 4336            var message = _pipeline.CreateMessage();
 4337            var request = message.Request;
 4338            request.Method = RequestMethod.Get;
 4339            var uri = new RawRequestUriBuilder();
 4340            uri.Reset(endpoint);
 4341            uri.AppendPath("/subscriptions/", false);
 4342            uri.AppendPath(subscriptionId, true);
 4343            uri.AppendPath("/resourceGroups/", false);
 4344            uri.AppendPath(resourceGroupName, true);
 4345            uri.AppendPath("/providers/Microsoft.Compute/proximityPlacementGroups/", false);
 4346            uri.AppendPath(proximityPlacementGroupName, true);
 4347            if (includeColocationStatus != null)
 348            {
 0349                uri.AppendQuery("includeColocationStatus", includeColocationStatus, true);
 350            }
 4351            uri.AppendQuery("api-version", "2019-12-01", true);
 4352            request.Uri = uri;
 4353            return message;
 354        }
 355
 356        /// <summary> Retrieves information about a proximity placement group . </summary>
 357        /// <param name="resourceGroupName"> The name of the resource group. </param>
 358        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 359        /// <param name="includeColocationStatus"> includeColocationStatus=true enables fetching the colocation status o
 360        /// <param name="cancellationToken"> The cancellation token to use. </param>
 361        public async Task<Response<ProximityPlacementGroup>> GetAsync(string resourceGroupName, string proximityPlacemen
 362        {
 2363            if (resourceGroupName == null)
 364            {
 0365                throw new ArgumentNullException(nameof(resourceGroupName));
 366            }
 2367            if (proximityPlacementGroupName == null)
 368            {
 0369                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 370            }
 371
 2372            using var message = CreateGetRequest(resourceGroupName, proximityPlacementGroupName, includeColocationStatus
 2373            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2374            switch (message.Response.Status)
 375            {
 376                case 200:
 377                    {
 2378                        ProximityPlacementGroup value = default;
 2379                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2380                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 381                        {
 0382                            value = null;
 383                        }
 384                        else
 385                        {
 2386                            value = ProximityPlacementGroup.DeserializeProximityPlacementGroup(document.RootElement);
 387                        }
 2388                        return Response.FromValue(value, message.Response);
 389                    }
 390                default:
 0391                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 392            }
 2393        }
 394
 395        /// <summary> Retrieves information about a proximity placement group . </summary>
 396        /// <param name="resourceGroupName"> The name of the resource group. </param>
 397        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 398        /// <param name="includeColocationStatus"> includeColocationStatus=true enables fetching the colocation status o
 399        /// <param name="cancellationToken"> The cancellation token to use. </param>
 400        public Response<ProximityPlacementGroup> Get(string resourceGroupName, string proximityPlacementGroupName, strin
 401        {
 2402            if (resourceGroupName == null)
 403            {
 0404                throw new ArgumentNullException(nameof(resourceGroupName));
 405            }
 2406            if (proximityPlacementGroupName == null)
 407            {
 0408                throw new ArgumentNullException(nameof(proximityPlacementGroupName));
 409            }
 410
 2411            using var message = CreateGetRequest(resourceGroupName, proximityPlacementGroupName, includeColocationStatus
 2412            _pipeline.Send(message, cancellationToken);
 2413            switch (message.Response.Status)
 414            {
 415                case 200:
 416                    {
 2417                        ProximityPlacementGroup value = default;
 2418                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2419                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 420                        {
 0421                            value = null;
 422                        }
 423                        else
 424                        {
 2425                            value = ProximityPlacementGroup.DeserializeProximityPlacementGroup(document.RootElement);
 426                        }
 2427                        return Response.FromValue(value, message.Response);
 428                    }
 429                default:
 0430                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 431            }
 2432        }
 433
 434        internal HttpMessage CreateListBySubscriptionRequest()
 435        {
 0436            var message = _pipeline.CreateMessage();
 0437            var request = message.Request;
 0438            request.Method = RequestMethod.Get;
 0439            var uri = new RawRequestUriBuilder();
 0440            uri.Reset(endpoint);
 0441            uri.AppendPath("/subscriptions/", false);
 0442            uri.AppendPath(subscriptionId, true);
 0443            uri.AppendPath("/providers/Microsoft.Compute/proximityPlacementGroups", false);
 0444            uri.AppendQuery("api-version", "2019-12-01", true);
 0445            request.Uri = uri;
 0446            return message;
 447        }
 448
 449        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 450        /// <param name="cancellationToken"> The cancellation token to use. </param>
 451        public async Task<Response<ProximityPlacementGroupListResult>> ListBySubscriptionAsync(CancellationToken cancell
 452        {
 0453            using var message = CreateListBySubscriptionRequest();
 0454            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0455            switch (message.Response.Status)
 456            {
 457                case 200:
 458                    {
 0459                        ProximityPlacementGroupListResult value = default;
 0460                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0461                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 462                        {
 0463                            value = null;
 464                        }
 465                        else
 466                        {
 0467                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 468                        }
 0469                        return Response.FromValue(value, message.Response);
 470                    }
 471                default:
 0472                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 473            }
 0474        }
 475
 476        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 477        /// <param name="cancellationToken"> The cancellation token to use. </param>
 478        public Response<ProximityPlacementGroupListResult> ListBySubscription(CancellationToken cancellationToken = defa
 479        {
 0480            using var message = CreateListBySubscriptionRequest();
 0481            _pipeline.Send(message, cancellationToken);
 0482            switch (message.Response.Status)
 483            {
 484                case 200:
 485                    {
 0486                        ProximityPlacementGroupListResult value = default;
 0487                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0488                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 489                        {
 0490                            value = null;
 491                        }
 492                        else
 493                        {
 0494                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 495                        }
 0496                        return Response.FromValue(value, message.Response);
 497                    }
 498                default:
 0499                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 500            }
 0501        }
 502
 503        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 504        {
 0505            var message = _pipeline.CreateMessage();
 0506            var request = message.Request;
 0507            request.Method = RequestMethod.Get;
 0508            var uri = new RawRequestUriBuilder();
 0509            uri.Reset(endpoint);
 0510            uri.AppendPath("/subscriptions/", false);
 0511            uri.AppendPath(subscriptionId, true);
 0512            uri.AppendPath("/resourceGroups/", false);
 0513            uri.AppendPath(resourceGroupName, true);
 0514            uri.AppendPath("/providers/Microsoft.Compute/proximityPlacementGroups", false);
 0515            uri.AppendQuery("api-version", "2019-12-01", true);
 0516            request.Uri = uri;
 0517            return message;
 518        }
 519
 520        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 521        /// <param name="resourceGroupName"> The name of the resource group. </param>
 522        /// <param name="cancellationToken"> The cancellation token to use. </param>
 523        public async Task<Response<ProximityPlacementGroupListResult>> ListByResourceGroupAsync(string resourceGroupName
 524        {
 0525            if (resourceGroupName == null)
 526            {
 0527                throw new ArgumentNullException(nameof(resourceGroupName));
 528            }
 529
 0530            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0531            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0532            switch (message.Response.Status)
 533            {
 534                case 200:
 535                    {
 0536                        ProximityPlacementGroupListResult value = default;
 0537                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0538                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 539                        {
 0540                            value = null;
 541                        }
 542                        else
 543                        {
 0544                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 545                        }
 0546                        return Response.FromValue(value, message.Response);
 547                    }
 548                default:
 0549                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 550            }
 0551        }
 552
 553        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 554        /// <param name="resourceGroupName"> The name of the resource group. </param>
 555        /// <param name="cancellationToken"> The cancellation token to use. </param>
 556        public Response<ProximityPlacementGroupListResult> ListByResourceGroup(string resourceGroupName, CancellationTok
 557        {
 0558            if (resourceGroupName == null)
 559            {
 0560                throw new ArgumentNullException(nameof(resourceGroupName));
 561            }
 562
 0563            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0564            _pipeline.Send(message, cancellationToken);
 0565            switch (message.Response.Status)
 566            {
 567                case 200:
 568                    {
 0569                        ProximityPlacementGroupListResult value = default;
 0570                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0571                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 572                        {
 0573                            value = null;
 574                        }
 575                        else
 576                        {
 0577                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 578                        }
 0579                        return Response.FromValue(value, message.Response);
 580                    }
 581                default:
 0582                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 583            }
 0584        }
 585
 586        internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
 587        {
 0588            var message = _pipeline.CreateMessage();
 0589            var request = message.Request;
 0590            request.Method = RequestMethod.Get;
 0591            var uri = new RawRequestUriBuilder();
 0592            uri.Reset(endpoint);
 0593            uri.AppendRawNextLink(nextLink, false);
 0594            request.Uri = uri;
 0595            return message;
 596        }
 597
 598        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 599        /// <param name="nextLink"> The URL to the next page of results. </param>
 600        /// <param name="cancellationToken"> The cancellation token to use. </param>
 601        public async Task<Response<ProximityPlacementGroupListResult>> ListBySubscriptionNextPageAsync(string nextLink, 
 602        {
 0603            if (nextLink == null)
 604            {
 0605                throw new ArgumentNullException(nameof(nextLink));
 606            }
 607
 0608            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0609            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0610            switch (message.Response.Status)
 611            {
 612                case 200:
 613                    {
 0614                        ProximityPlacementGroupListResult value = default;
 0615                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0616                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 617                        {
 0618                            value = null;
 619                        }
 620                        else
 621                        {
 0622                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 623                        }
 0624                        return Response.FromValue(value, message.Response);
 625                    }
 626                default:
 0627                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 628            }
 0629        }
 630
 631        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 632        /// <param name="nextLink"> The URL to the next page of results. </param>
 633        /// <param name="cancellationToken"> The cancellation token to use. </param>
 634        public Response<ProximityPlacementGroupListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken
 635        {
 0636            if (nextLink == null)
 637            {
 0638                throw new ArgumentNullException(nameof(nextLink));
 639            }
 640
 0641            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0642            _pipeline.Send(message, cancellationToken);
 0643            switch (message.Response.Status)
 644            {
 645                case 200:
 646                    {
 0647                        ProximityPlacementGroupListResult value = default;
 0648                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0649                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 650                        {
 0651                            value = null;
 652                        }
 653                        else
 654                        {
 0655                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 656                        }
 0657                        return Response.FromValue(value, message.Response);
 658                    }
 659                default:
 0660                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 661            }
 0662        }
 663
 664        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 665        {
 0666            var message = _pipeline.CreateMessage();
 0667            var request = message.Request;
 0668            request.Method = RequestMethod.Get;
 0669            var uri = new RawRequestUriBuilder();
 0670            uri.Reset(endpoint);
 0671            uri.AppendRawNextLink(nextLink, false);
 0672            request.Uri = uri;
 0673            return message;
 674        }
 675
 676        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 677        /// <param name="nextLink"> The URL to the next page of results. </param>
 678        /// <param name="resourceGroupName"> The name of the resource group. </param>
 679        /// <param name="cancellationToken"> The cancellation token to use. </param>
 680        public async Task<Response<ProximityPlacementGroupListResult>> ListByResourceGroupNextPageAsync(string nextLink,
 681        {
 0682            if (nextLink == null)
 683            {
 0684                throw new ArgumentNullException(nameof(nextLink));
 685            }
 0686            if (resourceGroupName == null)
 687            {
 0688                throw new ArgumentNullException(nameof(resourceGroupName));
 689            }
 690
 0691            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0692            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0693            switch (message.Response.Status)
 694            {
 695                case 200:
 696                    {
 0697                        ProximityPlacementGroupListResult value = default;
 0698                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0699                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 700                        {
 0701                            value = null;
 702                        }
 703                        else
 704                        {
 0705                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 706                        }
 0707                        return Response.FromValue(value, message.Response);
 708                    }
 709                default:
 0710                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 711            }
 0712        }
 713
 714        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 715        /// <param name="nextLink"> The URL to the next page of results. </param>
 716        /// <param name="resourceGroupName"> The name of the resource group. </param>
 717        /// <param name="cancellationToken"> The cancellation token to use. </param>
 718        public Response<ProximityPlacementGroupListResult> ListByResourceGroupNextPage(string nextLink, string resourceG
 719        {
 0720            if (nextLink == null)
 721            {
 0722                throw new ArgumentNullException(nameof(nextLink));
 723            }
 0724            if (resourceGroupName == null)
 725            {
 0726                throw new ArgumentNullException(nameof(resourceGroupName));
 727            }
 728
 0729            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0730            _pipeline.Send(message, cancellationToken);
 0731            switch (message.Response.Status)
 732            {
 733                case 200:
 734                    {
 0735                        ProximityPlacementGroupListResult value = default;
 0736                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0737                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 738                        {
 0739                            value = null;
 740                        }
 741                        else
 742                        {
 0743                            value = ProximityPlacementGroupListResult.DeserializeProximityPlacementGroupListResult(docum
 744                        }
 0745                        return Response.FromValue(value, message.Response);
 746                    }
 747                default:
 0748                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 749            }
 0750        }
 751    }
 752}