< Summary

Class:Azure.ResourceManager.Compute.SshPublicKeysRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\SshPublicKeysRestOperations.cs
Covered lines:0
Uncovered lines:380
Coverable lines:380
Total lines:843
Line coverage:0% (0 of 380)
Covered branches:0
Total branches:140
Branch coverage:0% (0 of 140)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListBySubscriptionRequest()-0%100%
ListBySubscriptionAsync()-0%0%
ListBySubscription(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateCreateRequest(...)-0%100%
CreateAsync()-0%0%
Create(...)-0%0%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateGenerateKeyPairRequest(...)-0%100%
GenerateKeyPairAsync()-0%0%
GenerateKeyPair(...)-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\SshPublicKeysRestOperations.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 SshPublicKeysRestOperations
 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 SshPublicKeysRestOperations. </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
 032        public SshPublicKeysRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal HttpMessage CreateListBySubscriptionRequest()
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Get;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys", false);
 056            uri.AppendQuery("api-version", "2019-12-01", true);
 057            request.Uri = uri;
 058            return message;
 59        }
 60
 61        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public async Task<Response<SshPublicKeysGroupListResult>> ListBySubscriptionAsync(CancellationToken cancellation
 64        {
 065            using var message = CreateListBySubscriptionRequest();
 066            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 067            switch (message.Response.Status)
 68            {
 69                case 200:
 70                    {
 071                        SshPublicKeysGroupListResult value = default;
 072                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 073                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 74                        {
 075                            value = null;
 76                        }
 77                        else
 78                        {
 079                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 80                        }
 081                        return Response.FromValue(value, message.Response);
 82                    }
 83                default:
 084                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 85            }
 086        }
 87
 88        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 89        /// <param name="cancellationToken"> The cancellation token to use. </param>
 90        public Response<SshPublicKeysGroupListResult> ListBySubscription(CancellationToken cancellationToken = default)
 91        {
 092            using var message = CreateListBySubscriptionRequest();
 093            _pipeline.Send(message, cancellationToken);
 094            switch (message.Response.Status)
 95            {
 96                case 200:
 97                    {
 098                        SshPublicKeysGroupListResult value = default;
 099                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0100                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 101                        {
 0102                            value = null;
 103                        }
 104                        else
 105                        {
 0106                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 107                        }
 0108                        return Response.FromValue(value, message.Response);
 109                    }
 110                default:
 0111                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 112            }
 0113        }
 114
 115        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 116        {
 0117            var message = _pipeline.CreateMessage();
 0118            var request = message.Request;
 0119            request.Method = RequestMethod.Get;
 0120            var uri = new RawRequestUriBuilder();
 0121            uri.Reset(endpoint);
 0122            uri.AppendPath("/subscriptions/", false);
 0123            uri.AppendPath(subscriptionId, true);
 0124            uri.AppendPath("/resourceGroups/", false);
 0125            uri.AppendPath(resourceGroupName, true);
 0126            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys", false);
 0127            uri.AppendQuery("api-version", "2019-12-01", true);
 0128            request.Uri = uri;
 0129            return message;
 130        }
 131
 132        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 133        /// <param name="resourceGroupName"> The name of the resource group. </param>
 134        /// <param name="cancellationToken"> The cancellation token to use. </param>
 135        public async Task<Response<SshPublicKeysGroupListResult>> ListByResourceGroupAsync(string resourceGroupName, Can
 136        {
 0137            if (resourceGroupName == null)
 138            {
 0139                throw new ArgumentNullException(nameof(resourceGroupName));
 140            }
 141
 0142            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0143            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0144            switch (message.Response.Status)
 145            {
 146                case 200:
 147                    {
 0148                        SshPublicKeysGroupListResult value = default;
 0149                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0150                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 151                        {
 0152                            value = null;
 153                        }
 154                        else
 155                        {
 0156                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 157                        }
 0158                        return Response.FromValue(value, message.Response);
 159                    }
 160                default:
 0161                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 162            }
 0163        }
 164
 165        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 166        /// <param name="resourceGroupName"> The name of the resource group. </param>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        public Response<SshPublicKeysGroupListResult> ListByResourceGroup(string resourceGroupName, CancellationToken ca
 169        {
 0170            if (resourceGroupName == null)
 171            {
 0172                throw new ArgumentNullException(nameof(resourceGroupName));
 173            }
 174
 0175            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0176            _pipeline.Send(message, cancellationToken);
 0177            switch (message.Response.Status)
 178            {
 179                case 200:
 180                    {
 0181                        SshPublicKeysGroupListResult value = default;
 0182                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0183                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 184                        {
 0185                            value = null;
 186                        }
 187                        else
 188                        {
 0189                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 190                        }
 0191                        return Response.FromValue(value, message.Response);
 192                    }
 193                default:
 0194                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 195            }
 0196        }
 197
 198        internal HttpMessage CreateCreateRequest(string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource
 199        {
 0200            var message = _pipeline.CreateMessage();
 0201            var request = message.Request;
 0202            request.Method = RequestMethod.Put;
 0203            var uri = new RawRequestUriBuilder();
 0204            uri.Reset(endpoint);
 0205            uri.AppendPath("/subscriptions/", false);
 0206            uri.AppendPath(subscriptionId, true);
 0207            uri.AppendPath("/resourceGroups/", false);
 0208            uri.AppendPath(resourceGroupName, true);
 0209            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys/", false);
 0210            uri.AppendPath(sshPublicKeyName, true);
 0211            uri.AppendQuery("api-version", "2019-12-01", true);
 0212            request.Uri = uri;
 0213            request.Headers.Add("Content-Type", "application/json");
 0214            var content = new Utf8JsonRequestContent();
 0215            content.JsonWriter.WriteObjectValue(parameters);
 0216            request.Content = content;
 0217            return message;
 218        }
 219
 220        /// <summary> Creates a new SSH public key resource. </summary>
 221        /// <param name="resourceGroupName"> The name of the resource group. </param>
 222        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 223        /// <param name="parameters"> Parameters supplied to create the SSH public key. </param>
 224        /// <param name="cancellationToken"> The cancellation token to use. </param>
 225        public async Task<Response<SshPublicKeyResource>> CreateAsync(string resourceGroupName, string sshPublicKeyName,
 226        {
 0227            if (resourceGroupName == null)
 228            {
 0229                throw new ArgumentNullException(nameof(resourceGroupName));
 230            }
 0231            if (sshPublicKeyName == null)
 232            {
 0233                throw new ArgumentNullException(nameof(sshPublicKeyName));
 234            }
 0235            if (parameters == null)
 236            {
 0237                throw new ArgumentNullException(nameof(parameters));
 238            }
 239
 0240            using var message = CreateCreateRequest(resourceGroupName, sshPublicKeyName, parameters);
 0241            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0242            switch (message.Response.Status)
 243            {
 244                case 200:
 245                case 201:
 246                    {
 0247                        SshPublicKeyResource value = default;
 0248                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0249                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 250                        {
 0251                            value = null;
 252                        }
 253                        else
 254                        {
 0255                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 256                        }
 0257                        return Response.FromValue(value, message.Response);
 258                    }
 259                default:
 0260                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 261            }
 0262        }
 263
 264        /// <summary> Creates a new SSH public key resource. </summary>
 265        /// <param name="resourceGroupName"> The name of the resource group. </param>
 266        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 267        /// <param name="parameters"> Parameters supplied to create the SSH public key. </param>
 268        /// <param name="cancellationToken"> The cancellation token to use. </param>
 269        public Response<SshPublicKeyResource> Create(string resourceGroupName, string sshPublicKeyName, SshPublicKeyReso
 270        {
 0271            if (resourceGroupName == null)
 272            {
 0273                throw new ArgumentNullException(nameof(resourceGroupName));
 274            }
 0275            if (sshPublicKeyName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(sshPublicKeyName));
 278            }
 0279            if (parameters == null)
 280            {
 0281                throw new ArgumentNullException(nameof(parameters));
 282            }
 283
 0284            using var message = CreateCreateRequest(resourceGroupName, sshPublicKeyName, parameters);
 0285            _pipeline.Send(message, cancellationToken);
 0286            switch (message.Response.Status)
 287            {
 288                case 200:
 289                case 201:
 290                    {
 0291                        SshPublicKeyResource value = default;
 0292                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0293                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 294                        {
 0295                            value = null;
 296                        }
 297                        else
 298                        {
 0299                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 300                        }
 0301                        return Response.FromValue(value, message.Response);
 302                    }
 303                default:
 0304                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 305            }
 0306        }
 307
 308        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateRe
 309        {
 0310            var message = _pipeline.CreateMessage();
 0311            var request = message.Request;
 0312            request.Method = RequestMethod.Patch;
 0313            var uri = new RawRequestUriBuilder();
 0314            uri.Reset(endpoint);
 0315            uri.AppendPath("/subscriptions/", false);
 0316            uri.AppendPath(subscriptionId, true);
 0317            uri.AppendPath("/resourceGroups/", false);
 0318            uri.AppendPath(resourceGroupName, true);
 0319            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys/", false);
 0320            uri.AppendPath(sshPublicKeyName, true);
 0321            uri.AppendQuery("api-version", "2019-12-01", true);
 0322            request.Uri = uri;
 0323            request.Headers.Add("Content-Type", "application/json");
 0324            var content = new Utf8JsonRequestContent();
 0325            content.JsonWriter.WriteObjectValue(parameters);
 0326            request.Content = content;
 0327            return message;
 328        }
 329
 330        /// <summary> Updates a new SSH public key resource. </summary>
 331        /// <param name="resourceGroupName"> The name of the resource group. </param>
 332        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 333        /// <param name="parameters"> Parameters supplied to update the SSH public key. </param>
 334        /// <param name="cancellationToken"> The cancellation token to use. </param>
 335        public async Task<Response<SshPublicKeyResource>> UpdateAsync(string resourceGroupName, string sshPublicKeyName,
 336        {
 0337            if (resourceGroupName == null)
 338            {
 0339                throw new ArgumentNullException(nameof(resourceGroupName));
 340            }
 0341            if (sshPublicKeyName == null)
 342            {
 0343                throw new ArgumentNullException(nameof(sshPublicKeyName));
 344            }
 0345            if (parameters == null)
 346            {
 0347                throw new ArgumentNullException(nameof(parameters));
 348            }
 349
 0350            using var message = CreateUpdateRequest(resourceGroupName, sshPublicKeyName, parameters);
 0351            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0352            switch (message.Response.Status)
 353            {
 354                case 200:
 355                    {
 0356                        SshPublicKeyResource value = default;
 0357                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0358                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 359                        {
 0360                            value = null;
 361                        }
 362                        else
 363                        {
 0364                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 365                        }
 0366                        return Response.FromValue(value, message.Response);
 367                    }
 368                default:
 0369                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 370            }
 0371        }
 372
 373        /// <summary> Updates a new SSH public key resource. </summary>
 374        /// <param name="resourceGroupName"> The name of the resource group. </param>
 375        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 376        /// <param name="parameters"> Parameters supplied to update the SSH public key. </param>
 377        /// <param name="cancellationToken"> The cancellation token to use. </param>
 378        public Response<SshPublicKeyResource> Update(string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpda
 379        {
 0380            if (resourceGroupName == null)
 381            {
 0382                throw new ArgumentNullException(nameof(resourceGroupName));
 383            }
 0384            if (sshPublicKeyName == null)
 385            {
 0386                throw new ArgumentNullException(nameof(sshPublicKeyName));
 387            }
 0388            if (parameters == null)
 389            {
 0390                throw new ArgumentNullException(nameof(parameters));
 391            }
 392
 0393            using var message = CreateUpdateRequest(resourceGroupName, sshPublicKeyName, parameters);
 0394            _pipeline.Send(message, cancellationToken);
 0395            switch (message.Response.Status)
 396            {
 397                case 200:
 398                    {
 0399                        SshPublicKeyResource value = default;
 0400                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0401                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 402                        {
 0403                            value = null;
 404                        }
 405                        else
 406                        {
 0407                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 408                        }
 0409                        return Response.FromValue(value, message.Response);
 410                    }
 411                default:
 0412                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 413            }
 0414        }
 415
 416        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string sshPublicKeyName)
 417        {
 0418            var message = _pipeline.CreateMessage();
 0419            var request = message.Request;
 0420            request.Method = RequestMethod.Delete;
 0421            var uri = new RawRequestUriBuilder();
 0422            uri.Reset(endpoint);
 0423            uri.AppendPath("/subscriptions/", false);
 0424            uri.AppendPath(subscriptionId, true);
 0425            uri.AppendPath("/resourceGroups/", false);
 0426            uri.AppendPath(resourceGroupName, true);
 0427            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys/", false);
 0428            uri.AppendPath(sshPublicKeyName, true);
 0429            uri.AppendQuery("api-version", "2019-12-01", true);
 0430            request.Uri = uri;
 0431            return message;
 432        }
 433
 434        /// <summary> Delete an SSH public key. </summary>
 435        /// <param name="resourceGroupName"> The name of the resource group. </param>
 436        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 437        /// <param name="cancellationToken"> The cancellation token to use. </param>
 438        public async Task<Response> DeleteAsync(string resourceGroupName, string sshPublicKeyName, CancellationToken can
 439        {
 0440            if (resourceGroupName == null)
 441            {
 0442                throw new ArgumentNullException(nameof(resourceGroupName));
 443            }
 0444            if (sshPublicKeyName == null)
 445            {
 0446                throw new ArgumentNullException(nameof(sshPublicKeyName));
 447            }
 448
 0449            using var message = CreateDeleteRequest(resourceGroupName, sshPublicKeyName);
 0450            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0451            switch (message.Response.Status)
 452            {
 453                case 200:
 454                case 204:
 0455                    return message.Response;
 456                default:
 0457                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 458            }
 0459        }
 460
 461        /// <summary> Delete an SSH public key. </summary>
 462        /// <param name="resourceGroupName"> The name of the resource group. </param>
 463        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 464        /// <param name="cancellationToken"> The cancellation token to use. </param>
 465        public Response Delete(string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = 
 466        {
 0467            if (resourceGroupName == null)
 468            {
 0469                throw new ArgumentNullException(nameof(resourceGroupName));
 470            }
 0471            if (sshPublicKeyName == null)
 472            {
 0473                throw new ArgumentNullException(nameof(sshPublicKeyName));
 474            }
 475
 0476            using var message = CreateDeleteRequest(resourceGroupName, sshPublicKeyName);
 0477            _pipeline.Send(message, cancellationToken);
 0478            switch (message.Response.Status)
 479            {
 480                case 200:
 481                case 204:
 0482                    return message.Response;
 483                default:
 0484                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 485            }
 0486        }
 487
 488        internal HttpMessage CreateGetRequest(string resourceGroupName, string sshPublicKeyName)
 489        {
 0490            var message = _pipeline.CreateMessage();
 0491            var request = message.Request;
 0492            request.Method = RequestMethod.Get;
 0493            var uri = new RawRequestUriBuilder();
 0494            uri.Reset(endpoint);
 0495            uri.AppendPath("/subscriptions/", false);
 0496            uri.AppendPath(subscriptionId, true);
 0497            uri.AppendPath("/resourceGroups/", false);
 0498            uri.AppendPath(resourceGroupName, true);
 0499            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys/", false);
 0500            uri.AppendPath(sshPublicKeyName, true);
 0501            uri.AppendQuery("api-version", "2019-12-01", true);
 0502            request.Uri = uri;
 0503            return message;
 504        }
 505
 506        /// <summary> Retrieves information about an SSH public key. </summary>
 507        /// <param name="resourceGroupName"> The name of the resource group. </param>
 508        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 509        /// <param name="cancellationToken"> The cancellation token to use. </param>
 510        public async Task<Response<SshPublicKeyResource>> GetAsync(string resourceGroupName, string sshPublicKeyName, Ca
 511        {
 0512            if (resourceGroupName == null)
 513            {
 0514                throw new ArgumentNullException(nameof(resourceGroupName));
 515            }
 0516            if (sshPublicKeyName == null)
 517            {
 0518                throw new ArgumentNullException(nameof(sshPublicKeyName));
 519            }
 520
 0521            using var message = CreateGetRequest(resourceGroupName, sshPublicKeyName);
 0522            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0523            switch (message.Response.Status)
 524            {
 525                case 200:
 526                    {
 0527                        SshPublicKeyResource value = default;
 0528                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0529                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 530                        {
 0531                            value = null;
 532                        }
 533                        else
 534                        {
 0535                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 536                        }
 0537                        return Response.FromValue(value, message.Response);
 538                    }
 539                default:
 0540                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 541            }
 0542        }
 543
 544        /// <summary> Retrieves information about an SSH public key. </summary>
 545        /// <param name="resourceGroupName"> The name of the resource group. </param>
 546        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 547        /// <param name="cancellationToken"> The cancellation token to use. </param>
 548        public Response<SshPublicKeyResource> Get(string resourceGroupName, string sshPublicKeyName, CancellationToken c
 549        {
 0550            if (resourceGroupName == null)
 551            {
 0552                throw new ArgumentNullException(nameof(resourceGroupName));
 553            }
 0554            if (sshPublicKeyName == null)
 555            {
 0556                throw new ArgumentNullException(nameof(sshPublicKeyName));
 557            }
 558
 0559            using var message = CreateGetRequest(resourceGroupName, sshPublicKeyName);
 0560            _pipeline.Send(message, cancellationToken);
 0561            switch (message.Response.Status)
 562            {
 563                case 200:
 564                    {
 0565                        SshPublicKeyResource value = default;
 0566                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0567                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 568                        {
 0569                            value = null;
 570                        }
 571                        else
 572                        {
 0573                            value = SshPublicKeyResource.DeserializeSshPublicKeyResource(document.RootElement);
 574                        }
 0575                        return Response.FromValue(value, message.Response);
 576                    }
 577                default:
 0578                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 579            }
 0580        }
 581
 582        internal HttpMessage CreateGenerateKeyPairRequest(string resourceGroupName, string sshPublicKeyName)
 583        {
 0584            var message = _pipeline.CreateMessage();
 0585            var request = message.Request;
 0586            request.Method = RequestMethod.Post;
 0587            var uri = new RawRequestUriBuilder();
 0588            uri.Reset(endpoint);
 0589            uri.AppendPath("/subscriptions/", false);
 0590            uri.AppendPath(subscriptionId, true);
 0591            uri.AppendPath("/resourceGroups/", false);
 0592            uri.AppendPath(resourceGroupName, true);
 0593            uri.AppendPath("/providers/Microsoft.Compute/sshPublicKeys/", false);
 0594            uri.AppendPath(sshPublicKeyName, true);
 0595            uri.AppendPath("/generateKeyPair", false);
 0596            uri.AppendQuery("api-version", "2019-12-01", true);
 0597            request.Uri = uri;
 0598            return message;
 599        }
 600
 601        /// <summary> Generates and returns a public/private key pair and populates the SSH public key resource with the
 602        /// <param name="resourceGroupName"> The name of the resource group. </param>
 603        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 604        /// <param name="cancellationToken"> The cancellation token to use. </param>
 605        public async Task<Response<SshPublicKeyGenerateKeyPairResult>> GenerateKeyPairAsync(string resourceGroupName, st
 606        {
 0607            if (resourceGroupName == null)
 608            {
 0609                throw new ArgumentNullException(nameof(resourceGroupName));
 610            }
 0611            if (sshPublicKeyName == null)
 612            {
 0613                throw new ArgumentNullException(nameof(sshPublicKeyName));
 614            }
 615
 0616            using var message = CreateGenerateKeyPairRequest(resourceGroupName, sshPublicKeyName);
 0617            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0618            switch (message.Response.Status)
 619            {
 620                case 200:
 621                    {
 0622                        SshPublicKeyGenerateKeyPairResult value = default;
 0623                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0624                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 625                        {
 0626                            value = null;
 627                        }
 628                        else
 629                        {
 0630                            value = SshPublicKeyGenerateKeyPairResult.DeserializeSshPublicKeyGenerateKeyPairResult(docum
 631                        }
 0632                        return Response.FromValue(value, message.Response);
 633                    }
 634                default:
 0635                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 636            }
 0637        }
 638
 639        /// <summary> Generates and returns a public/private key pair and populates the SSH public key resource with the
 640        /// <param name="resourceGroupName"> The name of the resource group. </param>
 641        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 642        /// <param name="cancellationToken"> The cancellation token to use. </param>
 643        public Response<SshPublicKeyGenerateKeyPairResult> GenerateKeyPair(string resourceGroupName, string sshPublicKey
 644        {
 0645            if (resourceGroupName == null)
 646            {
 0647                throw new ArgumentNullException(nameof(resourceGroupName));
 648            }
 0649            if (sshPublicKeyName == null)
 650            {
 0651                throw new ArgumentNullException(nameof(sshPublicKeyName));
 652            }
 653
 0654            using var message = CreateGenerateKeyPairRequest(resourceGroupName, sshPublicKeyName);
 0655            _pipeline.Send(message, cancellationToken);
 0656            switch (message.Response.Status)
 657            {
 658                case 200:
 659                    {
 0660                        SshPublicKeyGenerateKeyPairResult value = default;
 0661                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0662                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 663                        {
 0664                            value = null;
 665                        }
 666                        else
 667                        {
 0668                            value = SshPublicKeyGenerateKeyPairResult.DeserializeSshPublicKeyGenerateKeyPairResult(docum
 669                        }
 0670                        return Response.FromValue(value, message.Response);
 671                    }
 672                default:
 0673                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 674            }
 0675        }
 676
 677        internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
 678        {
 0679            var message = _pipeline.CreateMessage();
 0680            var request = message.Request;
 0681            request.Method = RequestMethod.Get;
 0682            var uri = new RawRequestUriBuilder();
 0683            uri.Reset(endpoint);
 0684            uri.AppendRawNextLink(nextLink, false);
 0685            request.Uri = uri;
 0686            return message;
 687        }
 688
 689        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 690        /// <param name="nextLink"> The URL to the next page of results. </param>
 691        /// <param name="cancellationToken"> The cancellation token to use. </param>
 692        public async Task<Response<SshPublicKeysGroupListResult>> ListBySubscriptionNextPageAsync(string nextLink, Cance
 693        {
 0694            if (nextLink == null)
 695            {
 0696                throw new ArgumentNullException(nameof(nextLink));
 697            }
 698
 0699            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0700            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0701            switch (message.Response.Status)
 702            {
 703                case 200:
 704                    {
 0705                        SshPublicKeysGroupListResult value = default;
 0706                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0707                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 708                        {
 0709                            value = null;
 710                        }
 711                        else
 712                        {
 0713                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 714                        }
 0715                        return Response.FromValue(value, message.Response);
 716                    }
 717                default:
 0718                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 719            }
 0720        }
 721
 722        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 723        /// <param name="nextLink"> The URL to the next page of results. </param>
 724        /// <param name="cancellationToken"> The cancellation token to use. </param>
 725        public Response<SshPublicKeysGroupListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken canc
 726        {
 0727            if (nextLink == null)
 728            {
 0729                throw new ArgumentNullException(nameof(nextLink));
 730            }
 731
 0732            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0733            _pipeline.Send(message, cancellationToken);
 0734            switch (message.Response.Status)
 735            {
 736                case 200:
 737                    {
 0738                        SshPublicKeysGroupListResult value = default;
 0739                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0740                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 741                        {
 0742                            value = null;
 743                        }
 744                        else
 745                        {
 0746                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 747                        }
 0748                        return Response.FromValue(value, message.Response);
 749                    }
 750                default:
 0751                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 752            }
 0753        }
 754
 755        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 756        {
 0757            var message = _pipeline.CreateMessage();
 0758            var request = message.Request;
 0759            request.Method = RequestMethod.Get;
 0760            var uri = new RawRequestUriBuilder();
 0761            uri.Reset(endpoint);
 0762            uri.AppendRawNextLink(nextLink, false);
 0763            request.Uri = uri;
 0764            return message;
 765        }
 766
 767        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 768        /// <param name="nextLink"> The URL to the next page of results. </param>
 769        /// <param name="resourceGroupName"> The name of the resource group. </param>
 770        /// <param name="cancellationToken"> The cancellation token to use. </param>
 771        public async Task<Response<SshPublicKeysGroupListResult>> ListByResourceGroupNextPageAsync(string nextLink, stri
 772        {
 0773            if (nextLink == null)
 774            {
 0775                throw new ArgumentNullException(nameof(nextLink));
 776            }
 0777            if (resourceGroupName == null)
 778            {
 0779                throw new ArgumentNullException(nameof(resourceGroupName));
 780            }
 781
 0782            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0783            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0784            switch (message.Response.Status)
 785            {
 786                case 200:
 787                    {
 0788                        SshPublicKeysGroupListResult value = default;
 0789                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0790                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 791                        {
 0792                            value = null;
 793                        }
 794                        else
 795                        {
 0796                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 797                        }
 0798                        return Response.FromValue(value, message.Response);
 799                    }
 800                default:
 0801                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 802            }
 0803        }
 804
 805        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 806        /// <param name="nextLink"> The URL to the next page of results. </param>
 807        /// <param name="resourceGroupName"> The name of the resource group. </param>
 808        /// <param name="cancellationToken"> The cancellation token to use. </param>
 809        public Response<SshPublicKeysGroupListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupN
 810        {
 0811            if (nextLink == null)
 812            {
 0813                throw new ArgumentNullException(nameof(nextLink));
 814            }
 0815            if (resourceGroupName == null)
 816            {
 0817                throw new ArgumentNullException(nameof(resourceGroupName));
 818            }
 819
 0820            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0821            _pipeline.Send(message, cancellationToken);
 0822            switch (message.Response.Status)
 823            {
 824                case 200:
 825                    {
 0826                        SshPublicKeysGroupListResult value = default;
 0827                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0828                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 829                        {
 0830                            value = null;
 831                        }
 832                        else
 833                        {
 0834                            value = SshPublicKeysGroupListResult.DeserializeSshPublicKeysGroupListResult(document.RootEl
 835                        }
 0836                        return Response.FromValue(value, message.Response);
 837                    }
 838                default:
 0839                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 840            }
 0841        }
 842    }
 843}