< Summary

Class:Azure.Security.KeyVault.Certificates.CertificateClient
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateClient.cs
Covered lines:315
Uncovered lines:202
Coverable lines:517
Total lines:1596
Line coverage:60.9% (315 of 517)
Covered branches:23
Total branches:26
Branch coverage:88.4% (23 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
.ctor(...)-100%50%
get_VaultUri()-100%100%
StartCreateCertificate(...)-100%100%
StartCreateCertificateAsync()-100%100%
GetCertificate(...)-100%100%
GetCertificateAsync()-100%100%
GetCertificateVersion(...)-66.67%100%
GetCertificateVersionAsync()-70%100%
UpdateCertificateProperties(...)-70%100%
UpdateCertificatePropertiesAsync()-70%100%
StartDeleteCertificate(...)-70%100%
StartDeleteCertificateAsync()-70%100%
GetDeletedCertificate(...)-0%100%
GetDeletedCertificateAsync()-0%100%
StartRecoverDeletedCertificate(...)-70%100%
StartRecoverDeletedCertificateAsync()-70%100%
PurgeDeletedCertificate(...)-66.67%100%
PurgeDeletedCertificateAsync()-66.67%100%
BackupCertificate(...)-0%100%
BackupCertificateAsync()-0%100%
RestoreCertificateBackup(...)-0%100%
RestoreCertificateBackupAsync()-0%100%
ImportCertificate(...)-70%100%
ImportCertificateAsync()-70%100%
GetPropertiesOfCertificates(...)-0%100%
GetPropertiesOfCertificatesAsync(...)-0%100%
GetPropertiesOfCertificateVersions(...)-0%100%
GetPropertiesOfCertificateVersionsAsync(...)-0%100%
GetDeletedCertificates(...)-0%100%
GetDeletedCertificatesAsync(...)-0%100%
GetCertificatePolicy(...)-66.67%100%
GetCertificatePolicyAsync()-66.67%100%
UpdateCertificatePolicy(...)-66.67%100%
UpdateCertificatePolicyAsync()-66.67%100%
CreateIssuer(...)-76.92%100%
CreateIssuerAsync()-76.92%100%
GetIssuer(...)-66.67%100%
GetIssuerAsync()-66.67%100%
UpdateIssuer(...)-72.73%100%
UpdateIssuerAsync()-72.73%100%
DeleteIssuer(...)-66.67%100%
DeleteIssuerAsync()-66.67%100%
GetPropertiesOfIssuers(...)-100%100%
GetPropertiesOfIssuersAsync(...)-100%100%
GetCertificateOperation(...)-70%100%
GetCertificateOperationAsync()-70%100%
SetContacts(...)-66.67%100%
SetContactsAsync()-66.67%100%
GetContacts(...)-62.5%100%
GetContactsAsync()-62.5%100%
DeleteContacts(...)-0%100%
DeleteContactsAsync()-0%100%
MergeCertificate(...)-70%100%
MergeCertificateAsync()-70%100%
GetPendingCertificate(...)-69.23%83.33%
GetPendingCertificateAsync()-69.23%83.33%
CancelCertificateOperation(...)-70%100%
CancelCertificateOperationAsync()-70%100%
DeleteCertificateOperation(...)-66.67%100%
DeleteCertificateOperationAsync()-66.67%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Globalization;
 7using System.Threading;
 8using System.Threading.Tasks;
 9using Azure.Core;
 10using Azure.Core.Pipeline;
 11
 12namespace Azure.Security.KeyVault.Certificates
 13{
 14    /// <summary>
 15    /// The CertificateClient provides synchronous and asynchronous methods to manage <see cref="KeyVaultCertificate"/>s
 16    /// supports creating, retrieving, updating, deleting, purging, backing up, restoring, and listing the <see cref="Ke
 17    /// certificate <see cref="CertificateIssuer"/>s and <see cref="CertificateContact"/>s. The client also supports lis
 18    /// enabled key vault.
 19    /// </summary>
 20    public class CertificateClient
 21    {
 22        internal const string CertificatesPath = "/certificates/";
 23        internal const string DeletedCertificatesPath = "/deletedcertificates/";
 24        private const string IssuersPath = "/certificates/issuers/";
 25        private const string ContactsPath = "/certificates/contacts/";
 26
 27        private readonly KeyVaultPipeline _pipeline;
 28
 29        /// <summary>
 30        /// Initializes a new instance of the <see cref="CertificateClient"/> class for mocking.
 31        /// </summary>
 17232        protected CertificateClient()
 33        {
 17234        }
 35
 36        /// <summary>
 37        /// Initializes a new instance of the <see cref="CertificateClient"/> class for the specified vault.
 38        /// </summary>
 39        /// <param name="vaultUri">A <see cref="Uri"/> to the vault on which the client operates. Appears as "DNS Name" 
 40        /// <param name="credential">A <see cref="TokenCredential"/> used to authenticate requests to the vault, such as
 41        /// <exception cref="ArgumentNullException"><paramref name="vaultUri"/> or <paramref name="credential"/> is null
 42        public CertificateClient(Uri vaultUri, TokenCredential credential)
 043            : this(vaultUri, credential, null)
 44        {
 045        }
 46
 47        /// <summary>
 48        /// Initializes a new instance of the <see cref="CertificateClient"/> class for the specified vault.
 49        /// </summary>
 50        /// <param name="vaultUri">A <see cref="Uri"/> to the vault on which the client operates. Appears as "DNS Name" 
 51        /// <param name="credential">A <see cref="TokenCredential"/> used to authenticate requests to the vault, such as
 52        /// <param name="options"><see cref="CertificateClientOptions"/> that allow to configure the management of the r
 53        /// <exception cref="ArgumentNullException"><paramref name="vaultUri"/> or <paramref name="credential"/> is null
 17254        public CertificateClient(Uri vaultUri, TokenCredential credential, CertificateClientOptions options)
 55        {
 17256            Argument.AssertNotNull(vaultUri, nameof(vaultUri));
 17257            Argument.AssertNotNull(credential, nameof(credential));
 58
 17259            options ??= new CertificateClientOptions();
 60
 17261            HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new ChallengeBasedAuthenticationPolicy(credential
 62
 17263            _pipeline = new KeyVaultPipeline(vaultUri, options.GetVersionString(), pipeline, new ClientDiagnostics(optio
 17264        }
 65
 66        /// <summary>
 67        /// Gets the <see cref="Uri"/> of the vault used to create this instance of the <see cref="CertificateClient"/>.
 68        /// </summary>
 469        public virtual Uri VaultUri => _pipeline.VaultUri;
 70
 71        /// <summary>
 72        /// Starts a long running operation to create a <see cref="KeyVaultCertificate"/> in the vault with the specifie
 73        /// </summary>
 74        /// <remarks>
 75        /// If no certificate with the specified name exists it will be created; otherwise, a new version of the existin
 76        /// This operation requires the certificates/create permission.
 77        /// </remarks>
 78        /// <param name="certificateName">The name of the certificate to create.</param>
 79        /// <param name="policy">The <see cref="CertificatePolicy"/> which governs the properties and lifecycle of the c
 80        /// <param name="enabled">Specifies whether the certificate should be created in an enabled state. If null, the 
 81        /// <param name="tags">Tags to be applied to the created certificate.</param>
 82        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 83        /// <returns>A <see cref="CertificateOperation"/> which contains details on the create operation, and can be use
 84        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 85        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> or <paramref name="policy"/> is n
 86        public virtual CertificateOperation StartCreateCertificate(string certificateName, CertificatePolicy policy, boo
 87        {
 3088            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 3089            Argument.AssertNotNull(policy, nameof(policy));
 90
 3091            var parameters = new CertificateCreateParameters(policy, enabled, tags);
 92
 3093            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartCreateCertifi
 3094            scope.AddAttribute("certificate", certificateName);
 3095            scope.Start();
 96
 97            try
 98            {
 5899                Response<CertificateOperationProperties> response = _pipeline.SendRequest(RequestMethod.Post, parameters
 100
 28101                return new CertificateOperation(response, this);
 102            }
 2103            catch (Exception e)
 104            {
 2105                scope.Failed(e);
 2106                throw;
 107            }
 28108        }
 109
 110        /// <summary>
 111        /// Starts a long running operation to create a <see cref="KeyVaultCertificate"/> in the vault with the specifie
 112        /// </summary>
 113        /// <remarks>
 114        /// If no certificate with the specified name exists it will be created; otherwise, a new version of the existin
 115        /// This operation requires the certificates/create permission.
 116        /// </remarks>
 117        /// <param name="certificateName">The name of the certificate to create.</param>
 118        /// <param name="policy">The <see cref="CertificatePolicy"/> which governs the properties and lifecycle of the c
 119        /// <param name="enabled">Specifies whether the certificate should be created in an enabled state. If null, the 
 120        /// <param name="tags">Tags to be applied to the created certificate.</param>
 121        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 122        /// <returns>A <see cref="CertificateOperation"/> which contains details on the create operation, and can be use
 123        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 124        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> or <paramref name="policy"/> is n
 125        public virtual async Task<CertificateOperation> StartCreateCertificateAsync(string certificateName, CertificateP
 126        {
 30127            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 30128            Argument.AssertNotNull(policy, nameof(policy));
 129
 30130            var parameters = new CertificateCreateParameters(policy, enabled, tags);
 131
 30132            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartCreateCertifi
 30133            scope.AddAttribute("certificate", certificateName);
 30134            scope.Start();
 135
 136            try
 137            {
 58138                Response<CertificateOperationProperties> response = await _pipeline.SendRequestAsync(RequestMethod.Post,
 139
 28140                return new CertificateOperation(response, this);
 141            }
 2142            catch (Exception e)
 143            {
 2144                scope.Failed(e);
 2145                throw;
 146            }
 28147        }
 148
 149        /// <summary>
 150        /// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with its <see cref="CertificatePol
 151        /// </summary>
 152        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 153        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 154        /// <returns>A response containing the certificate and policy as a <see cref="KeyVaultCertificateWithPolicy"/> i
 155        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 156        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 157        public virtual Response<KeyVaultCertificateWithPolicy> GetCertificate(string certificateName, CancellationToken 
 158        {
 20159            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 160
 20161            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificate)}")
 20162            scope.AddAttribute("certificate", certificateName);
 20163            scope.Start();
 164
 165            try
 166            {
 38167                return _pipeline.SendRequest(RequestMethod.Get, () => new KeyVaultCertificateWithPolicy(), cancellationT
 168            }
 2169            catch (Exception e)
 170            {
 2171                scope.Failed(e);
 2172                throw;
 173            }
 18174        }
 175
 176        /// <summary>
 177        /// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with its <see cref="CertificatePol
 178        /// </summary>
 179        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 180        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 181        /// <returns>A response containing the certificate and policy as a <see cref="KeyVaultCertificateWithPolicy"/> i
 182        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 183        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 184        public virtual async Task<Response<KeyVaultCertificateWithPolicy>> GetCertificateAsync(string certificateName, C
 185        {
 20186            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 187
 20188            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificate)}")
 20189            scope.AddAttribute("certificate", certificateName);
 20190            scope.Start();
 191
 192            try
 193            {
 38194                return await _pipeline.SendRequestAsync(RequestMethod.Get, () => new KeyVaultCertificateWithPolicy(), ca
 195            }
 2196            catch (Exception e)
 197            {
 2198                scope.Failed(e);
 2199                throw;
 200            }
 18201        }
 202
 203        /// <summary>
 204        /// Gets a specific version of the <see cref="KeyVaultCertificate"/>. This operation requires the certificates/g
 205        /// </summary>
 206        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 207        /// <param name="version">The version of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 208        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 209        /// <returns>The requested <see cref="KeyVaultCertificate"/>.</returns>
 210        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 211        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 212        public virtual Response<KeyVaultCertificate> GetCertificateVersion(string certificateName, string version, Cance
 213        {
 4214            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 215
 4216            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificateVers
 4217            scope.AddAttribute("certificate", certificateName);
 4218            scope.Start();
 219
 220            try
 221            {
 8222                return _pipeline.SendRequest(RequestMethod.Get, () => new KeyVaultCertificate(), cancellationToken, Cert
 223            }
 0224            catch (Exception e)
 225            {
 0226                scope.Failed(e);
 0227                throw;
 228            }
 4229        }
 230
 231        /// <summary>
 232        /// Gets a specific version of the <see cref="KeyVaultCertificate"/>. This operation requires the certificates/g
 233        /// </summary>
 234        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 235        /// <param name="version">The version of the <see cref="KeyVaultCertificate"/> to retrieve.</param>
 236        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 237        /// <returns>The requested <see cref="KeyVaultCertificate"/>.</returns>
 238        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 239        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 240        public virtual async Task<Response<KeyVaultCertificate>> GetCertificateVersionAsync(string certificateName, stri
 241        {
 4242            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 4243            Argument.AssertNotNullOrEmpty(version, nameof(version));
 244
 4245            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificateVers
 4246            scope.AddAttribute("certificate", certificateName);
 4247            scope.Start();
 248
 249            try
 250            {
 8251                return await _pipeline.SendRequestAsync(RequestMethod.Get, () => new KeyVaultCertificate(), cancellation
 252            }
 0253            catch (Exception e)
 254            {
 0255                scope.Failed(e);
 0256                throw;
 257            }
 4258        }
 259
 260        /// <summary>
 261        /// Updates the specified <see cref="KeyVaultCertificate"/> with the specified values for its mutable properties
 262        /// </summary>
 263        /// <param name="properties">The <see cref="CertificateProperties"/> object with updated properties.</param>
 264        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 265        /// <returns>The updated <see cref="KeyVaultCertificate"/>.</returns>
 266        /// <exception cref="ArgumentNullException"><paramref name="properties"/> is null.</exception>
 267        public virtual Response<KeyVaultCertificate> UpdateCertificateProperties(CertificateProperties properties, Cance
 268        {
 4269            Argument.AssertNotNull(properties, nameof(properties));
 270
 4271            var parameters = new CertificateUpdateParameters(properties);
 272
 4273            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateCertificateP
 4274            scope.AddAttribute("certificate", properties.Name);
 4275            scope.Start();
 276
 277            try
 278            {
 8279                return _pipeline.SendRequest(RequestMethod.Patch, parameters, () => new KeyVaultCertificate(), cancellat
 280            }
 0281            catch (Exception e)
 282            {
 0283                scope.Failed(e);
 0284                throw;
 285            }
 4286        }
 287
 288        /// <summary>
 289        /// Updates the specified <see cref="KeyVaultCertificate"/> with the specified values for its mutable properties
 290        /// </summary>
 291        /// <param name="properties">The <see cref="CertificateProperties"/> object with updated properties.</param>
 292        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 293        /// <returns>The updated <see cref="KeyVaultCertificate"/>.</returns>
 294        /// <exception cref="ArgumentNullException"><paramref name="properties"/> is null.</exception>
 295        public virtual async Task<Response<KeyVaultCertificate>> UpdateCertificatePropertiesAsync(CertificateProperties 
 296        {
 4297            Argument.AssertNotNull(properties, nameof(properties));
 298
 4299            var parameters = new CertificateUpdateParameters(properties);
 300
 4301            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateCertificateP
 4302            scope.AddAttribute("certificate", properties.Name);
 4303            scope.Start();
 304
 305            try
 306            {
 8307                return await _pipeline.SendRequestAsync(RequestMethod.Patch, parameters, () => new KeyVaultCertificate()
 308            }
 0309            catch (Exception e)
 310            {
 0311                scope.Failed(e);
 0312                throw;
 313            }
 4314        }
 315
 316        /// <summary>
 317        /// Deletes all versions of the specified <see cref="KeyVaultCertificate"/>. If the vault is soft delete-enabled
 318        /// and can be recovered with <see cref="StartRecoverDeletedCertificate"/>, or purged with <see cref="PurgeDelet
 319        /// </summary>
 320        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to delete.</param>
 321        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 322        /// <returns>
 323        /// A <see cref="Certificates.DeleteCertificateOperation"/> to wait on this long-running operation.
 324        /// If the Key Vault is soft delete-enabled, you only need to wait for the operation to complete if you need to 
 325        /// otherwise, the certificate is deleted automatically on the <see cref="DeletedCertificate.ScheduledPurgeDate"
 326        /// </returns>
 327        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 328        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 329        public virtual DeleteCertificateOperation StartDeleteCertificate(string certificateName, CancellationToken cance
 330        {
 4331            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 332
 4333            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartDeleteCertifi
 4334            scope.AddAttribute("certificate", certificateName);
 4335            scope.Start();
 336
 337            try
 338            {
 8339                Response<DeletedCertificate> response = _pipeline.SendRequest(RequestMethod.Delete, () => new DeletedCer
 4340                return new DeleteCertificateOperation(_pipeline, response);
 341            }
 0342            catch (Exception e)
 343            {
 0344                scope.Failed(e);
 0345                throw;
 346            }
 4347        }
 348
 349        /// <summary>
 350        /// Deletes all versions of the specified <see cref="KeyVaultCertificate"/>. If the vault is soft delete-enabled
 351        /// and can be recovered with <see cref="StartRecoverDeletedCertificate"/>, or purged with <see cref="PurgeDelet
 352        /// </summary>
 353        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to delete.</param>
 354        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 355        /// <returns>
 356        /// A <see cref="Certificates.DeleteCertificateOperation"/> to wait on this long-running operation.
 357        /// If the Key Vault is soft delete-enabled, you only need to wait for the operation to complete if you need to 
 358        /// otherwise, the certificate is deleted automatically on the <see cref="DeletedCertificate.ScheduledPurgeDate"
 359        /// </returns>
 360        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 361        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 362        public virtual async Task<DeleteCertificateOperation> StartDeleteCertificateAsync(string certificateName, Cancel
 363        {
 4364            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 365
 4366            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartDeleteCertifi
 4367            scope.AddAttribute("certificate", certificateName);
 4368            scope.Start();
 369
 370            try
 371            {
 8372                Response<DeletedCertificate> response = await _pipeline.SendRequestAsync(RequestMethod.Delete, () => new
 4373                return new DeleteCertificateOperation(_pipeline, response);
 374            }
 0375            catch (Exception e)
 376            {
 0377                scope.Failed(e);
 0378                throw;
 379            }
 4380        }
 381
 382        /// <summary>
 383        /// Retrieves information about the specified deleted <see cref="KeyVaultCertificate"/>. This operation is only 
 384        /// requires the certificates/get permission.
 385        /// </summary>
 386        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/>.</param>
 387        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 388        /// <returns>The details of the <see cref="DeletedCertificate"/>.</returns>
 389        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 390        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 391        public virtual Response<DeletedCertificate> GetDeletedCertificate(string certificateName, CancellationToken canc
 392        {
 0393            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 394
 0395            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetDeletedCertific
 0396            scope.AddAttribute("certificate", certificateName);
 0397            scope.Start();
 398
 399            try
 400            {
 0401                return _pipeline.SendRequest(RequestMethod.Get, () => new DeletedCertificate(), cancellationToken, Delet
 402            }
 0403            catch (Exception e)
 404            {
 0405                scope.Failed(e);
 0406                throw;
 407            }
 0408        }
 409
 410        /// <summary>
 411        /// Retrieves information about the specified deleted <see cref="KeyVaultCertificate"/>. This operation is only 
 412        /// requires the certificates/get permission.
 413        /// </summary>
 414        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/>.</param>
 415        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 416        /// <returns>The details of the <see cref="DeletedCertificate"/>.</returns>
 417        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 418        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 419        public virtual async Task<Response<DeletedCertificate>> GetDeletedCertificateAsync(string certificateName, Cance
 420        {
 0421            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 422
 0423            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetDeletedCertific
 0424            scope.AddAttribute("certificate", certificateName);
 0425            scope.Start();
 426
 427            try
 428            {
 0429                return await _pipeline.SendRequestAsync(RequestMethod.Get, () => new DeletedCertificate(), cancellationT
 430            }
 0431            catch (Exception e)
 432            {
 0433                scope.Failed(e);
 0434                throw;
 435            }
 0436        }
 437
 438        /// <summary>
 439        /// Recovers the <see cref="DeletedCertificate"/> to its pre-deleted state. This operation is only applicable in
 440        /// requires the certificates/recover permission.
 441        /// </summary>
 442        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/>.</param>
 443        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 444        /// <returns>A <see cref="RecoverDeletedCertificateOperation"/> to wait on this long-running operation.</returns
 445        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 446        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 447        public virtual RecoverDeletedCertificateOperation StartRecoverDeletedCertificate(string certificateName, Cancell
 448        {
 2449            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 450
 2451            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartRecoverDelete
 2452            scope.AddAttribute("certificate", certificateName);
 2453            scope.Start();
 454
 455            try
 456            {
 4457                Response<KeyVaultCertificateWithPolicy> response = _pipeline.SendRequest(RequestMethod.Post, () => new K
 2458                return new RecoverDeletedCertificateOperation(_pipeline, response);
 459            }
 0460            catch (Exception e)
 461            {
 0462                scope.Failed(e);
 0463                throw;
 464            }
 2465        }
 466
 467        /// <summary>
 468        /// Recovers the <see cref="DeletedCertificate"/> to its pre-deleted state. This operation is only applicable in
 469        /// requires the certificates/recover permission.
 470        /// </summary>
 471        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/>.</param>
 472        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 473        /// <returns>A <see cref="RecoverDeletedCertificateOperation"/> to wait on this long-running operation.</returns
 474        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 475        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 476        public virtual async Task<RecoverDeletedCertificateOperation> StartRecoverDeletedCertificateAsync(string certifi
 477        {
 2478            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 479
 2480            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(StartRecoverDelete
 2481            scope.AddAttribute("certificate", certificateName);
 2482            scope.Start();
 483
 484            try
 485            {
 4486                Response<KeyVaultCertificateWithPolicy> response = await _pipeline.SendRequestAsync(RequestMethod.Post, 
 2487                return new RecoverDeletedCertificateOperation(_pipeline, response);
 488            }
 0489            catch (Exception e)
 490            {
 0491                scope.Failed(e);
 0492                throw;
 493            }
 2494        }
 495
 496        /// <summary>
 497        /// Permanently and irreversibly deletes the specified deleted certificate, without the possibility of recovery.
 498        /// requires the certificates/purge permission. The operation is not available if the DeletedCertificate.Recover
 499        /// </summary>
 500        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/> to permanently delete.</param
 501        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 502        /// <returns>The HTTP response from the service.</returns>
 503        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 504        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 505        public virtual Response PurgeDeletedCertificate(string certificateName, CancellationToken cancellationToken = de
 506        {
 2507            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 508
 2509            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(PurgeDeletedCertif
 2510            scope.AddAttribute("certificate", certificateName);
 2511            scope.Start();
 512
 513            try
 514            {
 2515                return _pipeline.SendRequest(RequestMethod.Delete, cancellationToken, DeletedCertificatesPath, certifica
 516            }
 0517            catch (Exception e)
 518            {
 0519                scope.Failed(e);
 0520                throw;
 521            }
 2522        }
 523
 524        /// <summary>
 525        /// Permanently and irreversibly deletes the specified deleted certificate, without the possibility of recovery.
 526        /// requires the certificates/purge permission. The operation is not available if the DeletedCertificate.Recover
 527        /// </summary>
 528        /// <param name="certificateName">The name of the <see cref="DeletedCertificate"/> to permanently delete.</param
 529        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 530        /// <returns>The HTTP response from the service.</returns>
 531        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 532        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 533        public virtual async Task<Response> PurgeDeletedCertificateAsync(string certificateName, CancellationToken cance
 534        {
 2535            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 536
 2537            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(PurgeDeletedCertif
 2538            scope.AddAttribute("certificate", certificateName);
 2539            scope.Start();
 540
 541            try
 542            {
 2543                return await _pipeline.SendRequestAsync(RequestMethod.Delete, cancellationToken, DeletedCertificatesPath
 544            }
 0545            catch (Exception e)
 546            {
 0547                scope.Failed(e);
 0548                throw;
 549            }
 2550        }
 551
 552        /// <summary>
 553        /// Creates a backup of the certificate, including all versions, which can be used to restore the certificate to
 554        /// restore the certificate to a different vault in the same region as the original value. This operation requir
 555        /// </summary>
 556        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to backup.</param>
 557        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 558        /// <returns>The certificate backup.</returns>
 559        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 560        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 561        public virtual Response<byte[]> BackupCertificate(string certificateName, CancellationToken cancellationToken = 
 562        {
 0563            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 564
 0565            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(BackupCertificate)
 0566            scope.AddAttribute("certificate", certificateName);
 0567            scope.Start();
 568
 569            try
 570            {
 0571                Response<CertificateBackup> backup = _pipeline.SendRequest(RequestMethod.Post, () => new CertificateBack
 572
 0573                return Response.FromValue(backup.Value.Value, backup.GetRawResponse());
 574            }
 0575            catch (Exception e)
 576            {
 0577                scope.Failed(e);
 0578                throw;
 579            }
 0580        }
 581
 582        /// <summary>
 583        /// Creates a backup of the certificate, including all versions, which can be used to restore the certificate to
 584        /// restore the certificate to a different vault in the same region as the original value. This operation requir
 585        /// </summary>
 586        /// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to backup.</param>
 587        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 588        /// <returns>The certificate backup.</returns>
 589        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 590        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 591        public virtual async Task<Response<byte[]>> BackupCertificateAsync(string certificateName, CancellationToken can
 592        {
 0593            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 594
 0595            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(BackupCertificate)
 0596            scope.AddAttribute("certificate", certificateName);
 0597            scope.Start();
 598
 599            try
 600            {
 0601                Response<CertificateBackup> backup = await _pipeline.SendRequestAsync(RequestMethod.Post, () => new Cert
 602
 0603                return Response.FromValue(backup.Value.Value, backup.GetRawResponse());
 604            }
 0605            catch (Exception e)
 606            {
 0607                scope.Failed(e);
 0608                throw;
 609            }
 0610        }
 611
 612        /// <summary>
 613        /// Restores a <see cref="KeyVaultCertificate"/>, including all versions, from a backup created from the <see cr
 614        /// to a vault in the same region as its original vault. This operation requires the certificate/restore permiss
 615        /// </summary>
 616        /// <param name="backup">The backup of the <see cref="KeyVaultCertificate"/> to restore.</param>
 617        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 618        /// <returns>The restored certificate and policy.</returns>
 619        /// <exception cref="ArgumentNullException"><paramref name="backup"/> is null.</exception>
 620        public virtual Response<KeyVaultCertificateWithPolicy> RestoreCertificateBackup(byte[] backup, CancellationToken
 621        {
 0622            Argument.AssertNotNull(backup, nameof(backup));
 623
 0624            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(RestoreCertificate
 0625            scope.Start();
 626
 627            try
 628            {
 0629                return _pipeline.SendRequest(RequestMethod.Post, new CertificateBackup { Value = backup }, () => new Key
 630            }
 0631            catch (Exception e)
 632            {
 0633                scope.Failed(e);
 0634                throw;
 635            }
 0636        }
 637
 638        /// <summary>
 639        /// Restores a <see cref="KeyVaultCertificate"/>, including all versions, from a backup created from the <see cr
 640        /// to a vault in the same region as its original vault. This operation requires the certificate/restore permiss
 641        /// </summary>
 642        /// <param name="backup">The backup of the <see cref="KeyVaultCertificate"/> to restore.</param>
 643        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 644        /// <returns>The restored certificate and policy.</returns>
 645        /// <exception cref="ArgumentNullException"><paramref name="backup"/> is null.</exception>
 646        public virtual async Task<Response<KeyVaultCertificateWithPolicy>> RestoreCertificateBackupAsync(byte[] backup, 
 647        {
 0648            Argument.AssertNotNull(backup, nameof(backup));
 649
 0650            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(RestoreCertificate
 0651            scope.Start();
 652
 653            try
 654            {
 0655                return await _pipeline.SendRequestAsync(RequestMethod.Post, new CertificateBackup { Value = backup }, ()
 656            }
 0657            catch (Exception e)
 658            {
 0659                scope.Failed(e);
 0660                throw;
 661            }
 0662        }
 663
 664        /// <summary>
 665        /// Imports a pre-existing certificate to the key vault. The specified certificate must be in PFX or ASCII PEM f
 666        /// certificates/import permission.
 667        /// </summary>
 668        /// <param name="importCertificateOptions">The details of the certificate to import to the key vault.</param>
 669        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 670        /// <returns>The imported certificate and policy.</returns>
 671        /// <exception cref="ArgumentException"><see cref="ImportCertificateOptions.Name"/> of <paramref name="importCer
 672        /// <exception cref="ArgumentNullException"><paramref name="importCertificateOptions"/> or <see cref="ImportCert
 673        public virtual Response<KeyVaultCertificateWithPolicy> ImportCertificate(ImportCertificateOptions importCertific
 674        {
 4675            Argument.AssertNotNull(importCertificateOptions, nameof(importCertificateOptions));
 4676            Argument.AssertNotNullOrEmpty(importCertificateOptions.Name, nameof(importCertificateOptions.Name));
 677
 4678            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(ImportCertificate)
 4679            scope.AddAttribute("certificate", importCertificateOptions.Name);
 4680            scope.Start();
 681
 682            try
 683            {
 8684                return _pipeline.SendRequest(RequestMethod.Post, importCertificateOptions, () => new KeyVaultCertificate
 685            }
 0686            catch (Exception e)
 687            {
 0688                scope.Failed(e);
 0689                throw;
 690            }
 4691        }
 692
 693        /// <summary>
 694        /// Imports a pre-existing certificate to the key vault. The specified certificate must be in PFX or ASCII PEM f
 695        /// certificates/import permission.
 696        /// </summary>
 697        /// <param name="importCertificateOptions">The details of the certificate to import to the key vault.</param>
 698        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 699        /// <returns>The imported certificate and policy.</returns>
 700        /// <exception cref="ArgumentException"><see cref="ImportCertificateOptions.Name"/> of <paramref name="importCer
 701        /// <exception cref="ArgumentNullException"><paramref name="importCertificateOptions"/> or <see cref="ImportCert
 702        public virtual async Task<Response<KeyVaultCertificateWithPolicy>> ImportCertificateAsync(ImportCertificateOptio
 703        {
 4704            Argument.AssertNotNull(importCertificateOptions, nameof(importCertificateOptions));
 4705            Argument.AssertNotNullOrEmpty(importCertificateOptions.Name, nameof(importCertificateOptions.Name));
 706
 4707            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(ImportCertificate)
 4708            scope.AddAttribute("certificate", importCertificateOptions.Name);
 4709            scope.Start();
 710
 711            try
 712            {
 8713                return await _pipeline.SendRequestAsync(RequestMethod.Post, importCertificateOptions, () => new KeyVault
 714            }
 0715            catch (Exception e)
 716            {
 0717                scope.Failed(e);
 0718                throw;
 719            }
 4720        }
 721
 722        /// <summary>
 723        /// Lists the properties of all certificates in the specified vault. You can use the returned <see cref="Certifi
 724        /// This operation requires the certificates/list permission.
 725        /// </summary>
 726        /// <param name="includePending">Specifies whether to include certificates in a pending state as well.</param>
 727        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 728        /// <returns>An enumerable collection of certificate metadata.</returns>
 729        public virtual Pageable<CertificateProperties> GetPropertiesOfCertificates(bool includePending = default, Cancel
 730        {
 0731            Uri firstPageUri = _pipeline.CreateFirstPageUri(CertificatesPath, ("includePending", includePending.ToString
 732
 0733            return PageResponseEnumerator.CreateEnumerable(nextLink => _pipeline.GetPage(firstPageUri, nextLink, () => n
 734        }
 735
 736        /// <summary>
 737        /// Lists the properties of all certificates in the specified vault. You can use the returned <see cref="Certifi
 738        /// This operation requires the certificates/list permission.
 739        /// </summary>
 740        /// <param name="includePending">Specifies whether to include certificates in a pending state as well.</param>
 741        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 742        /// <returns>An enumerable collection of certificate metadata.</returns>
 743        public virtual AsyncPageable<CertificateProperties> GetPropertiesOfCertificatesAsync(bool includePending = defau
 744        {
 0745            Uri firstPageUri = _pipeline.CreateFirstPageUri(CertificatesPath, ("includePending", includePending.ToString
 746
 0747            return PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLin
 748        }
 749
 750        /// <summary>
 751        /// Lists the properties of all versions of the specified certificate in the specified vault. You can use the re
 752        /// This operation requires the certificates/list permission.
 753        /// </summary>
 754        /// <param name="certificateName">The name of the certificate whose versions should be retrieved.</param>
 755        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 756        /// <returns>An enumerable collection of the certificate's versions.</returns>
 757        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 758        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 759        public virtual Pageable<CertificateProperties> GetPropertiesOfCertificateVersions(string certificateName, Cancel
 760        {
 0761            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 762
 0763            Uri firstPageUri = _pipeline.CreateFirstPageUri($"{CertificatesPath}{certificateName}/versions");
 764
 0765            return PageResponseEnumerator.CreateEnumerable(nextLink => _pipeline.GetPage(firstPageUri, nextLink, () => n
 766        }
 767
 768        /// <summary>
 769        /// Lists the properties of all versions of the specified certificate in the specified vault. You can use the re
 770        /// This operation requires the certificates/list permission.
 771        /// </summary>
 772        /// <param name="certificateName">The name of the certificate whose versions should be retrieved.</param>
 773        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 774        /// <returns>An enumerable collection of the certificate's versions.</returns>
 775        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 776        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 777        public virtual AsyncPageable<CertificateProperties> GetPropertiesOfCertificateVersionsAsync(string certificateNa
 778        {
 0779            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 780
 0781            Uri firstPageUri = _pipeline.CreateFirstPageUri($"{CertificatesPath}{certificateName}/versions");
 782
 0783            return PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLin
 784        }
 785
 786        /// <summary>
 787        /// Enumerates the deleted certificates in the vault. This operation is only available on soft delete-enabled va
 788        /// </summary>
 789        /// <param name="includePending">Specifies whether to include certificates in a delete pending state as well.</p
 790        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 791        /// <returns>An enumerable collection of deleted certificates.</returns>
 792        public virtual Pageable<DeletedCertificate> GetDeletedCertificates(bool includePending = default, CancellationTo
 793        {
 0794            Uri firstPageUri = _pipeline.CreateFirstPageUri(DeletedCertificatesPath, ("includePending", includePending.T
 795
 0796            return PageResponseEnumerator.CreateEnumerable(nextLink => _pipeline.GetPage(firstPageUri, nextLink, () => n
 797        }
 798
 799        /// <summary>
 800        /// Enumerates the deleted certificates in the vault. This operation is only available on soft delete-enabled va
 801        /// </summary>
 802        /// <param name="includePending">Specifies whether to include certificates in a delete pending state as well.</p
 803        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 804        /// <returns>An enumerable collection of deleted certificates.</returns>
 805        public virtual AsyncPageable<DeletedCertificate> GetDeletedCertificatesAsync(bool includePending = default, Canc
 806        {
 0807            Uri firstPageUri = _pipeline.CreateFirstPageUri(DeletedCertificatesPath, ("includePending", includePending.T
 808
 0809            return PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLin
 810        }
 811
 812        /// <summary>
 813        /// Retrieves the <see cref="CertificatePolicy"/> of the specified certificate. This operation requires the cert
 814        /// </summary>
 815        /// <param name="certificateName">The name of the certificate whose policy should be retrieved.</param>
 816        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 817        /// <returns>The <see cref="CertificatePolicy"/> of the specified certificate.</returns>
 818        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 819        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 820        public virtual Response<CertificatePolicy> GetCertificatePolicy(string certificateName, CancellationToken cancel
 821        {
 6822            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 823
 2824            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificatePoli
 2825            scope.AddAttribute("certificate", certificateName);
 2826            scope.Start();
 827
 828            try
 829            {
 4830                return _pipeline.SendRequest(RequestMethod.Get, () => new CertificatePolicy(), cancellationToken, Certif
 831            }
 0832            catch (Exception e)
 833            {
 0834                scope.Failed(e);
 0835                throw;
 836            }
 2837        }
 838
 839        /// <summary>
 840        /// Retrieves the <see cref="CertificatePolicy"/> of the specified certificate. This operation requires the cert
 841        /// </summary>
 842        /// <param name="certificateName">The name of the certificate whose policy should be retrieved.</param>
 843        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 844        /// <returns>The <see cref="CertificatePolicy"/> of the specified certificate.</returns>
 845        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 846        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 847        public virtual async Task<Response<CertificatePolicy>> GetCertificatePolicyAsync(string certificateName, Cancell
 848        {
 6849            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 850
 2851            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificatePoli
 2852            scope.AddAttribute("certificate", certificateName);
 2853            scope.Start();
 854
 855            try
 856            {
 4857                return await _pipeline.SendRequestAsync(RequestMethod.Get, () => new CertificatePolicy(), cancellationTo
 858            }
 0859            catch (Exception e)
 860            {
 0861                scope.Failed(e);
 0862                throw;
 863            }
 2864        }
 865
 866        /// <summary>
 867        /// Updates the <see cref="CertificatePolicy"/> of the specified certificate. This operation requires the certif
 868        /// </summary>
 869        /// <param name="certificateName">The name of the certificate whose policy should be updated.</param>
 870        /// <param name="policy">The updated policy for the specified certificate.</param>
 871        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 872        /// <returns>The updated certificate policy.</returns>
 873        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 874        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 875        public virtual Response<CertificatePolicy> UpdateCertificatePolicy(string certificateName, CertificatePolicy pol
 876        {
 6877            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 878
 2879            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateCertificateP
 2880            scope.AddAttribute("certificate", certificateName);
 2881            scope.Start();
 882
 883            try
 884            {
 4885                return _pipeline.SendRequest(RequestMethod.Patch, policy, () => new CertificatePolicy(), cancellationTok
 886            }
 0887            catch (Exception e)
 888            {
 0889                scope.Failed(e);
 0890                throw;
 891            }
 2892        }
 893
 894        /// <summary>
 895        /// Updates the <see cref="CertificatePolicy"/> of the specified certificate. This operation requires the certif
 896        /// </summary>
 897        /// <param name="certificateName">The name of the certificate whose policy should be updated.</param>
 898        /// <param name="policy">The updated policy for the specified certificate.</param>
 899        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 900        /// <returns>The updated certificate policy.</returns>
 901        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 902        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 903        public virtual async Task<Response<CertificatePolicy>> UpdateCertificatePolicyAsync(string certificateName, Cert
 904        {
 6905            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 906
 2907            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateCertificateP
 2908            scope.AddAttribute("certificate", certificateName);
 2909            scope.Start();
 910
 911            try
 912            {
 4913                return await _pipeline.SendRequestAsync(RequestMethod.Patch, policy, () => new CertificatePolicy(), canc
 914            }
 0915            catch (Exception e)
 916            {
 0917                scope.Failed(e);
 0918                throw;
 919            }
 2920        }
 921
 922        /// <summary>
 923        /// Creates or replaces a certificate <see cref="CertificateIssuer"/> in the key vault. This operation requires 
 924        /// </summary>
 925        /// <param name="issuer">The <see cref="CertificateIssuer"/> to add or replace in the vault.</param>
 926        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 927        /// <returns>The created certificate issuer.</returns>
 928        /// <exception cref="ArgumentException"><see cref="CertificateIssuer.Name"/> of <paramref name="issuer"/> is emp
 929        /// <exception cref="ArgumentNullException"><paramref name="issuer"/> or <see cref="CertificateIssuer.Name"/> of
 930        public virtual Response<CertificateIssuer> CreateIssuer(CertificateIssuer issuer, CancellationToken cancellation
 931        {
 16932            Argument.AssertNotNull(issuer, nameof(issuer));
 933
 14934            if (string.IsNullOrEmpty(issuer.Name))
 935            {
 2936                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Name)} cannot be null or an empty string."
 937            }
 938
 12939            if (string.IsNullOrEmpty(issuer.Provider))
 940            {
 2941                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Provider)} cannot be null or an empty stri
 942            }
 943
 10944            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(CreateIssuer)}");
 10945            scope.AddAttribute("issuer", issuer.Name);
 10946            scope.Start();
 947
 948            try
 949            {
 20950                return _pipeline.SendRequest(RequestMethod.Put, issuer, () => new CertificateIssuer(), cancellationToken
 951            }
 0952            catch (Exception e)
 953            {
 0954                scope.Failed(e);
 0955                throw;
 956            }
 10957        }
 958
 959        /// <summary>
 960        /// Creates or replaces a certificate <see cref="CertificateIssuer"/> in the key vault. This operation requires 
 961        /// </summary>
 962        /// <param name="issuer">The <see cref="CertificateIssuer"/> to add or replace in the vault.</param>
 963        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 964        /// <returns>The created certificate issuer.</returns>
 965        /// <exception cref="ArgumentException"><see cref="CertificateIssuer.Name"/> of <paramref name="issuer"/> is emp
 966        /// <exception cref="ArgumentNullException"><paramref name="issuer"/> or <see cref="CertificateIssuer.Name"/> of
 967        public virtual async Task<Response<CertificateIssuer>> CreateIssuerAsync(CertificateIssuer issuer, CancellationT
 968        {
 16969            Argument.AssertNotNull(issuer, nameof(issuer));
 970
 14971            if (string.IsNullOrEmpty(issuer.Name))
 972            {
 2973                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Name)} cannot be null or an empty string."
 974            }
 975
 12976            if (string.IsNullOrEmpty(issuer.Provider))
 977            {
 2978                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Provider)} cannot be null or an empty stri
 979            }
 980
 10981            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(CreateIssuer)}");
 10982            scope.AddAttribute("issuer", issuer.Name);
 10983            scope.Start();
 984
 985            try
 986            {
 20987                return await _pipeline.SendRequestAsync(RequestMethod.Put, issuer, () => new CertificateIssuer(), cancel
 988            }
 0989            catch (Exception e)
 990            {
 0991                scope.Failed(e);
 0992                throw;
 993            }
 10994        }
 995
 996        /// <summary>
 997        /// Retrieves the specified certificate <see cref="CertificateIssuer"/> from the vault. This operation requires 
 998        /// </summary>
 999        /// <param name="issuerName">The name of the <see cref="CertificateIssuer"/> to retrieve.</param>
 1000        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1001        /// <returns>The retrieved certificate issuer.</returns>
 1002        /// <exception cref="ArgumentException"><paramref name="issuerName"/> is empty.</exception>
 1003        /// <exception cref="ArgumentNullException"><paramref name="issuerName"/> is null.</exception>
 1004        public virtual Response<CertificateIssuer> GetIssuer(string issuerName, CancellationToken cancellationToken = de
 1005        {
 61006            Argument.AssertNotNullOrEmpty(issuerName, nameof(issuerName));
 1007
 21008            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetIssuer)}");
 21009            scope.AddAttribute("issuer", issuerName);
 21010            scope.Start();
 1011
 1012            try
 1013            {
 41014                return _pipeline.SendRequest(RequestMethod.Get, () => new CertificateIssuer(), cancellationToken, Issuer
 1015            }
 01016            catch (Exception e)
 1017            {
 01018                scope.Failed(e);
 01019                throw;
 1020            }
 21021        }
 1022
 1023        /// <summary>
 1024        /// Retrieves the specified certificate <see cref="CertificateIssuer"/> from the vault. This operation requires 
 1025        /// </summary>
 1026        /// <param name="issuerName">The name of the <see cref="CertificateIssuer"/> to retrieve.</param>
 1027        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1028        /// <returns>The retrieved certificate issuer.</returns>
 1029        /// <exception cref="ArgumentException"><paramref name="issuerName"/> is empty.</exception>
 1030        /// <exception cref="ArgumentNullException"><paramref name="issuerName"/> is null.</exception>
 1031        public virtual async Task<Response<CertificateIssuer>> GetIssuerAsync(string issuerName, CancellationToken cance
 1032        {
 61033            Argument.AssertNotNullOrEmpty(issuerName, nameof(issuerName));
 1034
 21035            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetIssuer)}");
 21036            scope.AddAttribute("issuer", issuerName);
 21037            scope.Start();
 1038
 1039            try
 1040            {
 41041                return await _pipeline.SendRequestAsync(RequestMethod.Get, () => new CertificateIssuer(), cancellationTo
 1042            }
 01043            catch (Exception e)
 1044            {
 01045                scope.Failed(e);
 01046                throw;
 1047            }
 21048        }
 1049
 1050        /// <summary>
 1051        /// Updates the specified certificate <see cref="CertificateIssuer"/> in the vault, only updating the specified 
 1052        /// </summary>
 1053        /// <param name="issuer">The <see cref="CertificateIssuer"/> to update in the vault.</param>
 1054        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1055        /// <returns>The updated certificate issuer.</returns>
 1056        /// <exception cref="ArgumentException"><see cref="CertificateIssuer.Name"/> of <paramref name="issuer"/> is emp
 1057        /// <exception cref="ArgumentNullException"><paramref name="issuer"/> or <see cref="CertificateIssuer.Name"/> of
 1058        public virtual Response<CertificateIssuer> UpdateIssuer(CertificateIssuer issuer, CancellationToken cancellation
 1059        {
 61060            Argument.AssertNotNull(issuer, nameof(issuer));
 1061
 41062            if (string.IsNullOrEmpty(issuer.Name))
 1063            {
 21064                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Name)} cannot be null or an empty string."
 1065            }
 1066
 21067            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateIssuer)}");
 21068            scope.AddAttribute("issuer", issuer.Name);
 21069            scope.Start();
 1070
 1071            try
 1072            {
 41073                return _pipeline.SendRequest(RequestMethod.Patch, issuer, () => new CertificateIssuer(), cancellationTok
 1074            }
 01075            catch (Exception e)
 1076            {
 01077                scope.Failed(e);
 01078                throw;
 1079            }
 21080        }
 1081
 1082        /// <summary>
 1083        /// Updates the specified certificate <see cref="CertificateIssuer"/> in the vault, only updating the specified 
 1084        /// </summary>
 1085        /// <param name="issuer">The <see cref="CertificateIssuer"/> to update in the vault.</param>
 1086        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1087        /// <returns>The updated certificate issuer.</returns>
 1088        /// <exception cref="ArgumentException"><see cref="CertificateIssuer.Name"/> of <paramref name="issuer"/> is emp
 1089        /// <exception cref="ArgumentNullException"><paramref name="issuer"/> or <see cref="CertificateIssuer.Name"/> of
 1090        public virtual async Task<Response<CertificateIssuer>> UpdateIssuerAsync(CertificateIssuer issuer, CancellationT
 1091        {
 61092            Argument.AssertNotNull(issuer, nameof(issuer));
 1093
 41094            if (string.IsNullOrEmpty(issuer.Name))
 1095            {
 21096                throw new ArgumentException($"{nameof(issuer)}.{nameof(issuer.Name)} cannot be null or an empty string."
 1097            }
 1098
 21099            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(UpdateIssuer)}");
 21100            scope.AddAttribute("issuer", issuer.Name);
 21101            scope.Start();
 1102
 1103            try
 1104            {
 41105                return await _pipeline.SendRequestAsync(RequestMethod.Patch, issuer, () => new CertificateIssuer(), canc
 1106            }
 01107            catch (Exception e)
 1108            {
 01109                scope.Failed(e);
 01110                throw;
 1111            }
 21112        }
 1113
 1114        /// <summary>
 1115        /// Deletes the specified certificate <see cref="CertificateIssuer"/> from the vault. This operation requires th
 1116        /// </summary>
 1117        /// <param name="issuerName">The name of the <see cref="CertificateIssuer"/> to delete.</param>
 1118        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1119        /// <returns>The deleted certificate issuer.</returns>
 1120        /// <exception cref="ArgumentException"><paramref name="issuerName"/> is empty.</exception>
 1121        /// <exception cref="ArgumentNullException"><paramref name="issuerName"/> is null.</exception>
 1122        public virtual Response<CertificateIssuer> DeleteIssuer(string issuerName, CancellationToken cancellationToken =
 1123        {
 61124            Argument.AssertNotNullOrEmpty(issuerName, nameof(issuerName));
 1125
 21126            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteIssuer)}");
 21127            scope.AddAttribute("issuer", issuerName);
 21128            scope.Start();
 1129
 1130            try
 1131            {
 41132                return _pipeline.SendRequest(RequestMethod.Delete, () => new CertificateIssuer(), cancellationToken, Iss
 1133            }
 01134            catch (Exception e)
 1135            {
 01136                scope.Failed(e);
 01137                throw;
 1138            }
 21139        }
 1140
 1141        /// <summary>
 1142        /// Deletes the specified certificate <see cref="CertificateIssuer"/> from the vault. This operation requires th
 1143        /// </summary>
 1144        /// <param name="issuerName">The name of the <see cref="CertificateIssuer"/> to delete.</param>
 1145        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1146        /// <returns>The deleted certificate issuer.</returns>
 1147        /// <exception cref="ArgumentException"><paramref name="issuerName"/> is empty.</exception>
 1148        /// <exception cref="ArgumentNullException"><paramref name="issuerName"/> is null.</exception>
 1149        public virtual async Task<Response<CertificateIssuer>> DeleteIssuerAsync(string issuerName, CancellationToken ca
 1150        {
 61151            Argument.AssertNotNullOrEmpty(issuerName, nameof(issuerName));
 1152
 21153            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteIssuer)}");
 21154            scope.AddAttribute("issuer", issuerName);
 21155            scope.Start();
 1156
 1157            try
 1158            {
 41159                return await _pipeline.SendRequestAsync(RequestMethod.Delete, () => new CertificateIssuer(), cancellatio
 1160            }
 01161            catch (Exception e)
 1162            {
 01163                scope.Failed(e);
 01164                throw;
 1165            }
 21166        }
 1167
 1168        /// <summary>
 1169        /// Lists the properties of all issuers in the specified vault. You can use the returned <see cref="CertificateP
 1170        /// This operation requires the certificates/getissuers permission.
 1171        /// </summary>
 1172        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1173        /// <returns>An enumerable collection of certificate issuers' metadata.</returns>
 1174        public virtual Pageable<IssuerProperties> GetPropertiesOfIssuers(CancellationToken cancellationToken = default)
 1175        {
 21176            Uri firstPageUri = _pipeline.CreateFirstPageUri(IssuersPath);
 1177
 161178            return PageResponseEnumerator.CreateEnumerable(nextLink => _pipeline.GetPage(firstPageUri, nextLink, () => n
 1179        }
 1180
 1181        /// <summary>
 1182        /// Lists the properties of all issuers in the specified vault. You can use the returned <see cref="CertificateP
 1183        /// This operation requires the certificates/getissuers permission.
 1184        /// </summary>
 1185        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1186        /// <returns>An enumerable collection of certificate issuers' metadata.</returns>
 1187        public virtual AsyncPageable<IssuerProperties> GetPropertiesOfIssuersAsync(CancellationToken cancellationToken =
 1188        {
 21189            Uri firstPageUri = _pipeline.CreateFirstPageUri(IssuersPath);
 1190
 161191            return PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLin
 1192        }
 1193
 1194        /// <summary>
 1195        /// Gets a pending <see cref="CertificateOperation"/> from the key vault. This operation requires the certificat
 1196        /// </summary>
 1197        /// <param name="certificateName">The name of the certificate for which an operation is pending.</param>
 1198        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1199        /// <returns>The given certificate's current pending operation.</returns>
 1200        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 1201        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 1202        public virtual CertificateOperation GetCertificateOperation(string certificateName, CancellationToken cancellati
 1203        {
 21204            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1205
 21206            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificateOper
 21207            scope.AddAttribute("certificate", certificateName);
 21208            scope.Start();
 1209
 1210            try
 1211            {
 41212                Response<CertificateOperationProperties> response = _pipeline.SendRequest(RequestMethod.Get, () => new C
 1213
 21214                return new CertificateOperation(response, this);
 1215            }
 01216            catch (Exception e)
 1217            {
 01218                scope.Failed(e);
 01219                throw;
 1220            }
 21221        }
 1222
 1223        /// <summary>
 1224        /// Gets a pending <see cref="CertificateOperation"/> from the key vault. This operation requires the certificat
 1225        /// </summary>
 1226        /// <param name="certificateName">The name of the certificate for which an operation is pending.</param>
 1227        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1228        /// <returns>The given certificate's current pending operation.</returns>
 1229        /// <exception cref="ArgumentException"><paramref name="certificateName"/> is empty.</exception>
 1230        /// <exception cref="ArgumentNullException"><paramref name="certificateName"/> is null.</exception>
 1231        public virtual async Task<CertificateOperation> GetCertificateOperationAsync(string certificateName, Cancellatio
 1232        {
 21233            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1234
 21235            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetCertificateOper
 21236            scope.AddAttribute("certificate", certificateName);
 21237            scope.Start();
 1238
 1239            try
 1240            {
 41241                Response<CertificateOperationProperties> response = await _pipeline.SendRequestAsync(RequestMethod.Get, 
 1242
 21243                return new CertificateOperation(response, this);
 1244            }
 01245            catch (Exception e)
 1246            {
 01247                scope.Failed(e);
 01248                throw;
 1249            }
 21250        }
 1251
 1252        /// <summary>
 1253        /// Sets the certificate <see cref="CertificateContact"/>s for the key vault, replacing any existing contacts. T
 1254        /// </summary>
 1255        /// <param name="contacts">The certificate contacts for the vault.</param>
 1256        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1257        /// <returns>The updated certificate contacts of the vault.</returns>
 1258        /// <exception cref="ArgumentNullException"><paramref name="contacts"/> is null.</exception>
 1259        public virtual Response<IList<CertificateContact>> SetContacts(IEnumerable<CertificateContact> contacts, Cancell
 1260        {
 41261            Argument.AssertNotNull(contacts, nameof(contacts));
 1262
 21263            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(SetContacts)}");
 21264            scope.Start();
 1265
 1266            try
 1267            {
 41268                Response<ContactList> contactList = _pipeline.SendRequest(RequestMethod.Put, new ContactList(contacts), 
 1269
 21270                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1271            }
 01272            catch (Exception e)
 1273            {
 01274                scope.Failed(e);
 01275                throw;
 1276            }
 21277        }
 1278
 1279        /// <summary>
 1280        /// Sets the certificate <see cref="CertificateContact"/>s for the key vault, replacing any existing contacts. T
 1281        /// </summary>
 1282        /// <param name="contacts">The certificate contacts for the vault.</param>
 1283        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1284        /// <returns>The updated certificate contacts of the vault.</returns>
 1285        /// <exception cref="ArgumentNullException"><paramref name="contacts"/> is null.</exception>
 1286        public virtual async Task<Response<IList<CertificateContact>>> SetContactsAsync(IEnumerable<CertificateContact> 
 1287        {
 41288            Argument.AssertNotNull(contacts, nameof(contacts));
 1289
 21290            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(SetContacts)}");
 21291            scope.Start();
 1292
 1293            try
 1294            {
 41295                Response<ContactList> contactList = await _pipeline.SendRequestAsync(RequestMethod.Put, new ContactList(
 1296
 21297                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1298            }
 01299            catch (Exception e)
 1300            {
 01301                scope.Failed(e);
 01302                throw;
 1303            }
 21304        }
 1305
 1306        /// <summary>
 1307        /// Gets the certificate <see cref="CertificateContact"/>s for the key vaults. This operation requires the certi
 1308        /// </summary>
 1309        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1310        /// <returns>The certificate contacts of the vault.</returns>
 1311        public virtual Response<IList<CertificateContact>> GetContacts(CancellationToken cancellationToken = default)
 1312        {
 21313            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetContacts)}");
 21314            scope.Start();
 1315
 1316            try
 1317            {
 41318                Response<ContactList> contactList = _pipeline.SendRequest(RequestMethod.Get, () => new ContactList(), ca
 1319
 21320                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1321            }
 01322            catch (Exception e)
 1323            {
 01324                scope.Failed(e);
 01325                throw;
 1326            }
 21327        }
 1328
 1329        /// <summary>
 1330        /// Gets the certificate <see cref="CertificateContact"/>s for the key vaults. This operation requires the certi
 1331        /// </summary>
 1332        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1333        /// <returns>The certificate contacts of the vault.</returns>
 1334        public virtual async Task<Response<IList<CertificateContact>>> GetContactsAsync(CancellationToken cancellationTo
 1335        {
 21336            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetContacts)}");
 21337            scope.Start();
 1338
 1339            try
 1340            {
 41341                Response<ContactList> contactList = await _pipeline.SendRequestAsync(RequestMethod.Get, () => new Contac
 1342
 21343                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1344            }
 01345            catch (Exception e)
 1346            {
 01347                scope.Failed(e);
 01348                throw;
 1349            }
 21350        }
 1351
 1352        /// <summary>
 1353        /// Deletes all certificate <see cref="CertificateContact"/>s from the key vault, replacing any existing contact
 1354        /// </summary>
 1355        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1356        /// <returns>The certificate contacts deleted from the vault.</returns>
 1357        public virtual Response<IList<CertificateContact>> DeleteContacts(CancellationToken cancellationToken = default)
 1358        {
 01359            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteContacts)}")
 01360            scope.Start();
 1361
 1362            try
 1363            {
 01364                Response<ContactList> contactList = _pipeline.SendRequest(RequestMethod.Delete, () => new ContactList(),
 1365
 01366                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1367            }
 01368            catch (Exception e)
 1369            {
 01370                scope.Failed(e);
 01371                throw;
 1372            }
 01373        }
 1374
 1375        /// <summary>
 1376        /// Deletes all certificate <see cref="CertificateContact"/>s from the key vault, replacing any existing contact
 1377        /// </summary>
 1378        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1379        /// <returns>The certificate contacts deleted from the vault.</returns>
 1380        public virtual async Task<Response<IList<CertificateContact>>> DeleteContactsAsync(CancellationToken cancellatio
 1381        {
 01382            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteContacts)}")
 01383            scope.Start();
 1384
 1385            try
 1386            {
 01387                Response<ContactList> contactList = await _pipeline.SendRequestAsync(RequestMethod.Delete, () => new Con
 1388
 01389                return Response.FromValue(contactList.Value.ToList(), contactList.GetRawResponse());
 1390            }
 01391            catch (Exception e)
 1392            {
 01393                scope.Failed(e);
 01394                throw;
 1395            }
 01396        }
 1397
 1398        /// <summary>
 1399        /// Merges a certificate or a certificate chain with a key pair currently available in the service. This operati
 1400        /// </summary>
 1401        /// <param name="mergeCertificateOptions">The details of the certificate or certificate chain to merge into the 
 1402        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1403        /// <returns>The merged certificate.</returns>
 1404        /// <exception cref="ArgumentNullException"><paramref name="mergeCertificateOptions"/> is null.</exception>
 1405        public virtual Response<KeyVaultCertificateWithPolicy> MergeCertificate(MergeCertificateOptions mergeCertificate
 1406        {
 21407            Argument.AssertNotNull(mergeCertificateOptions, nameof(mergeCertificateOptions));
 1408
 21409            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(MergeCertificate)}
 21410            scope.AddAttribute("certificate", mergeCertificateOptions.Name);
 21411            scope.Start();
 1412
 1413            try
 1414            {
 41415                Response<KeyVaultCertificateWithPolicy> certificate = _pipeline.SendRequest(RequestMethod.Post, mergeCer
 1416
 21417                return Response.FromValue(certificate.Value, certificate.GetRawResponse());
 1418            }
 01419            catch (Exception e)
 1420            {
 01421                scope.Failed(e);
 01422                throw;
 1423            }
 21424        }
 1425
 1426        /// <summary>
 1427        /// Merges a certificate or a certificate chain with a key pair currently available in the service. This operati
 1428        /// </summary>
 1429        /// <param name="mergeCertificateOptions">The details of the certificate or certificate chain to merge into the 
 1430        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 1431        /// <returns>The merged certificate.</returns>
 1432        /// <exception cref="ArgumentNullException"><paramref name="mergeCertificateOptions"/> is null.</exception>
 1433        public virtual async Task<Response<KeyVaultCertificateWithPolicy>> MergeCertificateAsync(MergeCertificateOptions
 1434        {
 21435            Argument.AssertNotNull(mergeCertificateOptions, nameof(mergeCertificateOptions));
 1436
 21437            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(MergeCertificate)}
 21438            scope.AddAttribute("certificate", mergeCertificateOptions.Name);
 21439            scope.Start();
 1440
 1441            try
 1442            {
 41443                Response<KeyVaultCertificateWithPolicy> certificate = await _pipeline.SendRequestAsync(RequestMethod.Pos
 1444
 21445                return Response.FromValue(certificate.Value, certificate.GetRawResponse());
 1446            }
 01447            catch (Exception e)
 1448            {
 01449                scope.Failed(e);
 01450                throw;
 1451            }
 21452        }
 1453
 1454        internal virtual Response<CertificateOperationProperties> GetPendingCertificate(string certificateName, Cancella
 1455        {
 3101456            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1457
 3101458            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetPendingCertific
 3101459            scope.AddAttribute("certificate", certificateName);
 3101460            scope.Start();
 1461
 1462            try
 1463            {
 3101464                Response response = _pipeline.GetResponse(RequestMethod.Get, cancellationToken, CertificatesPath, certif
 3101465                switch (response.Status)
 1466                {
 1467                    case 200:
 1468                    case 403:
 3061469                        return _pipeline.CreateResponse(response, new CertificateOperationProperties());
 1470
 1471                    case 404:
 41472                        return Response.FromValue<CertificateOperationProperties>(null, response);
 1473
 1474                    default:
 01475                        throw _pipeline.Diagnostics.CreateRequestFailedException(response);
 1476                }
 1477            }
 01478            catch (Exception e)
 1479            {
 01480                scope.Failed(e);
 01481                throw;
 1482            }
 3101483        }
 1484
 1485        internal virtual async Task<Response<CertificateOperationProperties>> GetPendingCertificateAsync(string certific
 1486        {
 3641487            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1488
 3641489            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(GetPendingCertific
 3641490            scope.AddAttribute("certificate", certificateName);
 3641491            scope.Start();
 1492
 1493            try
 1494            {
 3641495                Response response = await _pipeline.GetResponseAsync(RequestMethod.Get, cancellationToken, CertificatesP
 3641496                switch (response.Status)
 1497                {
 1498                    case 200:
 1499                    case 403:
 3601500                        return _pipeline.CreateResponse(response, new CertificateOperationProperties());
 1501
 1502                    case 404:
 41503                        return Response.FromValue<CertificateOperationProperties>(null, response);
 1504
 1505                    default:
 01506                        throw await _pipeline.Diagnostics.CreateRequestFailedExceptionAsync(response).ConfigureAwait(fal
 1507                }
 1508            }
 01509            catch (Exception e)
 1510            {
 01511                scope.Failed(e);
 01512                throw;
 1513            }
 3641514        }
 1515
 1516        internal virtual Response<CertificateOperationProperties> CancelCertificateOperation(string certificateName, Can
 1517        {
 21518            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1519
 21520            var parameters = new CertificateOperationUpdateParameters(true);
 1521
 21522            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(CancelCertificateO
 21523            scope.AddAttribute("certificate", certificateName);
 21524            scope.Start();
 1525
 1526            try
 1527            {
 41528                return _pipeline.SendRequest(RequestMethod.Patch, parameters, () => new CertificateOperationProperties()
 1529            }
 01530            catch (Exception e)
 1531            {
 01532                scope.Failed(e);
 01533                throw;
 1534            }
 21535        }
 1536
 1537        internal virtual async Task<Response<CertificateOperationProperties>> CancelCertificateOperationAsync(string cer
 1538        {
 61539            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1540
 61541            var parameters = new CertificateOperationUpdateParameters(true);
 1542
 61543            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(CancelCertificateO
 61544            scope.AddAttribute("certificate", certificateName);
 61545            scope.Start();
 1546
 1547            try
 1548            {
 121549                return await _pipeline.SendRequestAsync(RequestMethod.Patch, parameters, () => new CertificateOperationP
 1550            }
 01551            catch (Exception e)
 1552            {
 01553                scope.Failed(e);
 01554                throw;
 1555            }
 61556        }
 1557
 1558        internal virtual Response<CertificateOperationProperties> DeleteCertificateOperation(string certificateName, Can
 1559        {
 21560            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1561
 21562            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteCertificateO
 21563            scope.AddAttribute("certificate", certificateName);
 21564            scope.Start();
 1565
 1566            try
 1567            {
 41568                return _pipeline.SendRequest(RequestMethod.Delete, () => new CertificateOperationProperties(), cancellat
 1569            }
 01570            catch (Exception e)
 1571            {
 01572                scope.Failed(e);
 01573                throw;
 1574            }
 21575        }
 1576
 1577        internal virtual async Task<Response<CertificateOperationProperties>> DeleteCertificateOperationAsync(string cer
 1578        {
 61579            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));
 1580
 61581            using DiagnosticScope scope = _pipeline.CreateScope($"{nameof(CertificateClient)}.{nameof(DeleteCertificateO
 61582            scope.AddAttribute("certificate", certificateName);
 61583            scope.Start();
 1584
 1585            try
 1586            {
 121587                return await _pipeline.SendRequestAsync(RequestMethod.Delete, () => new CertificateOperationProperties()
 1588            }
 01589            catch (Exception e)
 1590            {
 01591                scope.Failed(e);
 01592                throw;
 1593            }
 61594        }
 1595    }
 1596}

Methods/Properties

.ctor()
.ctor(...)
.ctor(...)
get_VaultUri()
StartCreateCertificate(...)
StartCreateCertificateAsync()
GetCertificate(...)
GetCertificateAsync()
GetCertificateVersion(...)
GetCertificateVersionAsync()
UpdateCertificateProperties(...)
UpdateCertificatePropertiesAsync()
StartDeleteCertificate(...)
StartDeleteCertificateAsync()
GetDeletedCertificate(...)
GetDeletedCertificateAsync()
StartRecoverDeletedCertificate(...)
StartRecoverDeletedCertificateAsync()
PurgeDeletedCertificate(...)
PurgeDeletedCertificateAsync()
BackupCertificate(...)
BackupCertificateAsync()
RestoreCertificateBackup(...)
RestoreCertificateBackupAsync()
ImportCertificate(...)
ImportCertificateAsync()
GetPropertiesOfCertificates(...)
GetPropertiesOfCertificatesAsync(...)
GetPropertiesOfCertificateVersions(...)
GetPropertiesOfCertificateVersionsAsync(...)
GetDeletedCertificates(...)
GetDeletedCertificatesAsync(...)
GetCertificatePolicy(...)
GetCertificatePolicyAsync()
UpdateCertificatePolicy(...)
UpdateCertificatePolicyAsync()
CreateIssuer(...)
CreateIssuerAsync()
GetIssuer(...)
GetIssuerAsync()
UpdateIssuer(...)
UpdateIssuerAsync()
DeleteIssuer(...)
DeleteIssuerAsync()
GetPropertiesOfIssuers(...)
GetPropertiesOfIssuersAsync(...)
GetCertificateOperation(...)
GetCertificateOperationAsync()
SetContacts(...)
SetContactsAsync()
GetContacts(...)
GetContactsAsync()
DeleteContacts(...)
DeleteContactsAsync()
MergeCertificate(...)
MergeCertificateAsync()
GetPendingCertificate(...)
GetPendingCertificateAsync()
CancelCertificateOperation(...)
CancelCertificateOperationAsync()
DeleteCertificateOperation(...)
DeleteCertificateOperationAsync()