< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
CreateAsync()-0%100%
Create(...)-0%100%
UpdateAsync()-0%100%
Update(...)-0%100%
DeleteAsync()-0%100%
Delete(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
GenerateKeyPairAsync()-0%100%
GenerateKeyPair(...)-0%100%
<ListBySubscriptionAsync()-0%100%
<ListBySubscriptionAsync()-0%100%
ListBySubscriptionAsync(...)-0%100%
ListBySubscription(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\SshPublicKeysOperations.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Compute.Models;
 15
 16namespace Azure.ResourceManager.Compute
 17{
 18    /// <summary> The SshPublicKeys service client. </summary>
 19    public partial class SshPublicKeysOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal SshPublicKeysRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of SshPublicKeysOperations for mocking. </summary>
 025        protected SshPublicKeysOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of SshPublicKeysOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 32        /// <param name="endpoint"> server parameter. </param>
 033        internal SshPublicKeysOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscription
 34        {
 035            RestClient = new SshPublicKeysRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Creates a new SSH public key resource. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 43        /// <param name="parameters"> Parameters supplied to create the SSH public key. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<SshPublicKeyResource>> CreateAsync(string resourceGroupName, string sshPublic
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Create");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.CreateAsync(resourceGroupName, sshPublicKeyName, parameters, cancellationToken).
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Creates a new SSH public key resource. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 63        /// <param name="parameters"> Parameters supplied to create the SSH public key. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<SshPublicKeyResource> Create(string resourceGroupName, string sshPublicKeyName, SshPubli
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Create");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Create(resourceGroupName, sshPublicKeyName, parameters, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Updates a new SSH public key resource. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 83        /// <param name="parameters"> Parameters supplied to update the SSH public key. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<SshPublicKeyResource>> UpdateAsync(string resourceGroupName, string sshPublic
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Update");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateAsync(resourceGroupName, sshPublicKeyName, parameters, cancellationToken).
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Updates a new SSH public key resource. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 103        /// <param name="parameters"> Parameters supplied to update the SSH public key. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<SshPublicKeyResource> Update(string resourceGroupName, string sshPublicKeyName, SshPubli
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Update");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.Update(resourceGroupName, sshPublicKeyName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Delete an SSH public key. </summary>
 121        /// <param name="resourceGroupName"> The name of the resource group. </param>
 122        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 123        /// <param name="cancellationToken"> The cancellation token to use. </param>
 124        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string sshPublicKeyName, CancellationT
 125        {
 0126            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Delete");
 0127            scope.Start();
 128            try
 129            {
 0130                return await RestClient.DeleteAsync(resourceGroupName, sshPublicKeyName, cancellationToken).ConfigureAwa
 131            }
 0132            catch (Exception e)
 133            {
 0134                scope.Failed(e);
 0135                throw;
 136            }
 0137        }
 138
 139        /// <summary> Delete an SSH public key. </summary>
 140        /// <param name="resourceGroupName"> The name of the resource group. </param>
 141        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 142        /// <param name="cancellationToken"> The cancellation token to use. </param>
 143        public virtual Response Delete(string resourceGroupName, string sshPublicKeyName, CancellationToken cancellation
 144        {
 0145            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Delete");
 0146            scope.Start();
 147            try
 148            {
 0149                return RestClient.Delete(resourceGroupName, sshPublicKeyName, cancellationToken);
 150            }
 0151            catch (Exception e)
 152            {
 0153                scope.Failed(e);
 0154                throw;
 155            }
 0156        }
 157
 158        /// <summary> Retrieves information about an SSH public key. </summary>
 159        /// <param name="resourceGroupName"> The name of the resource group. </param>
 160        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 161        /// <param name="cancellationToken"> The cancellation token to use. </param>
 162        public virtual async Task<Response<SshPublicKeyResource>> GetAsync(string resourceGroupName, string sshPublicKey
 163        {
 0164            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Get");
 0165            scope.Start();
 166            try
 167            {
 0168                return await RestClient.GetAsync(resourceGroupName, sshPublicKeyName, cancellationToken).ConfigureAwait(
 169            }
 0170            catch (Exception e)
 171            {
 0172                scope.Failed(e);
 0173                throw;
 174            }
 0175        }
 176
 177        /// <summary> Retrieves information about an SSH public key. </summary>
 178        /// <param name="resourceGroupName"> The name of the resource group. </param>
 179        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 180        /// <param name="cancellationToken"> The cancellation token to use. </param>
 181        public virtual Response<SshPublicKeyResource> Get(string resourceGroupName, string sshPublicKeyName, Cancellatio
 182        {
 0183            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.Get");
 0184            scope.Start();
 185            try
 186            {
 0187                return RestClient.Get(resourceGroupName, sshPublicKeyName, cancellationToken);
 188            }
 0189            catch (Exception e)
 190            {
 0191                scope.Failed(e);
 0192                throw;
 193            }
 0194        }
 195
 196        /// <summary> Generates and returns a public/private key pair and populates the SSH public key resource with the
 197        /// <param name="resourceGroupName"> The name of the resource group. </param>
 198        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 199        /// <param name="cancellationToken"> The cancellation token to use. </param>
 200        public virtual async Task<Response<SshPublicKeyGenerateKeyPairResult>> GenerateKeyPairAsync(string resourceGroup
 201        {
 0202            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.GenerateKeyPair");
 0203            scope.Start();
 204            try
 205            {
 0206                return await RestClient.GenerateKeyPairAsync(resourceGroupName, sshPublicKeyName, cancellationToken).Con
 207            }
 0208            catch (Exception e)
 209            {
 0210                scope.Failed(e);
 0211                throw;
 212            }
 0213        }
 214
 215        /// <summary> Generates and returns a public/private key pair and populates the SSH public key resource with the
 216        /// <param name="resourceGroupName"> The name of the resource group. </param>
 217        /// <param name="sshPublicKeyName"> The name of the SSH public key. </param>
 218        /// <param name="cancellationToken"> The cancellation token to use. </param>
 219        public virtual Response<SshPublicKeyGenerateKeyPairResult> GenerateKeyPair(string resourceGroupName, string sshP
 220        {
 0221            using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.GenerateKeyPair");
 0222            scope.Start();
 223            try
 224            {
 0225                return RestClient.GenerateKeyPair(resourceGroupName, sshPublicKeyName, cancellationToken);
 226            }
 0227            catch (Exception e)
 228            {
 0229                scope.Failed(e);
 0230                throw;
 231            }
 0232        }
 233
 234        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 235        /// <param name="cancellationToken"> The cancellation token to use. </param>
 236        public virtual AsyncPageable<SshPublicKeyResource> ListBySubscriptionAsync(CancellationToken cancellationToken =
 237        {
 238            async Task<Page<SshPublicKeyResource>> FirstPageFunc(int? pageSizeHint)
 239            {
 0240                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListBySubscription");
 0241                scope.Start();
 242                try
 243                {
 0244                    var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
 0245                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 246                }
 0247                catch (Exception e)
 248                {
 0249                    scope.Failed(e);
 0250                    throw;
 251                }
 0252            }
 253            async Task<Page<SshPublicKeyResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 254            {
 0255                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListBySubscription");
 0256                scope.Start();
 257                try
 258                {
 0259                    var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).Configu
 0260                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 261                }
 0262                catch (Exception e)
 263                {
 0264                    scope.Failed(e);
 0265                    throw;
 266                }
 0267            }
 0268            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 269        }
 270
 271        /// <summary> Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public virtual Pageable<SshPublicKeyResource> ListBySubscription(CancellationToken cancellationToken = default)
 274        {
 275            Page<SshPublicKeyResource> FirstPageFunc(int? pageSizeHint)
 276            {
 0277                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListBySubscription");
 0278                scope.Start();
 279                try
 280                {
 0281                    var response = RestClient.ListBySubscription(cancellationToken);
 0282                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 283                }
 0284                catch (Exception e)
 285                {
 0286                    scope.Failed(e);
 0287                    throw;
 288                }
 0289            }
 290            Page<SshPublicKeyResource> NextPageFunc(string nextLink, int? pageSizeHint)
 291            {
 0292                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListBySubscription");
 0293                scope.Start();
 294                try
 295                {
 0296                    var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken);
 0297                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 298                }
 0299                catch (Exception e)
 300                {
 0301                    scope.Failed(e);
 0302                    throw;
 303                }
 0304            }
 0305            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 306        }
 307
 308        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 309        /// <param name="resourceGroupName"> The name of the resource group. </param>
 310        /// <param name="cancellationToken"> The cancellation token to use. </param>
 311        public virtual AsyncPageable<SshPublicKeyResource> ListByResourceGroupAsync(string resourceGroupName, Cancellati
 312        {
 0313            if (resourceGroupName == null)
 314            {
 0315                throw new ArgumentNullException(nameof(resourceGroupName));
 316            }
 317
 318            async Task<Page<SshPublicKeyResource>> FirstPageFunc(int? pageSizeHint)
 319            {
 0320                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListByResourceGroup");
 0321                scope.Start();
 322                try
 323                {
 0324                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0325                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 326                }
 0327                catch (Exception e)
 328                {
 0329                    scope.Failed(e);
 0330                    throw;
 331                }
 0332            }
 333            async Task<Page<SshPublicKeyResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 334            {
 0335                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListByResourceGroup");
 0336                scope.Start();
 337                try
 338                {
 0339                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0340                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 341                }
 0342                catch (Exception e)
 343                {
 0344                    scope.Failed(e);
 0345                    throw;
 346                }
 0347            }
 0348            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 349        }
 350
 351        /// <summary> Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the
 352        /// <param name="resourceGroupName"> The name of the resource group. </param>
 353        /// <param name="cancellationToken"> The cancellation token to use. </param>
 354        public virtual Pageable<SshPublicKeyResource> ListByResourceGroup(string resourceGroupName, CancellationToken ca
 355        {
 0356            if (resourceGroupName == null)
 357            {
 0358                throw new ArgumentNullException(nameof(resourceGroupName));
 359            }
 360
 361            Page<SshPublicKeyResource> FirstPageFunc(int? pageSizeHint)
 362            {
 0363                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListByResourceGroup");
 0364                scope.Start();
 365                try
 366                {
 0367                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0368                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 369                }
 0370                catch (Exception e)
 371                {
 0372                    scope.Failed(e);
 0373                    throw;
 374                }
 0375            }
 376            Page<SshPublicKeyResource> NextPageFunc(string nextLink, int? pageSizeHint)
 377            {
 0378                using var scope = _clientDiagnostics.CreateScope("SshPublicKeysOperations.ListByResourceGroup");
 0379                scope.Start();
 380                try
 381                {
 0382                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0383                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 384                }
 0385                catch (Exception e)
 386                {
 0387                    scope.Failed(e);
 0388                    throw;
 389                }
 0390            }
 0391            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 392        }
 393    }
 394}