Beispiel #1
0
        /// <summary>
        /// Updates a certificate version.
        /// </summary>
        /// <param name="certificateIdentifier">The URL for the certificate.</param>
        /// <param name='certificatePolicy'>The management policy for the certificate.</param>
        /// <param name="certificateAttributes">The attributes of the certificate (optional)</param>
        /// <param name="tags">Application-specific metadata in the form of key-value pairs</param>
        /// <param name="cancellationToken">Optional cancellation token</param>
        /// <returns>The updated certificate.</returns>
        public static async Task <CertificateBundle> UpdateCertificateAsync(this IKeyVaultClient operations, string certificateIdentifier, CertificatePolicy certificatePolicy = default(CertificatePolicy), CertificateAttributes certificateAttributes = null, IDictionary <string, string> tags = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (string.IsNullOrWhiteSpace(certificateIdentifier))
            {
                throw new ArgumentNullException(nameof(certificateIdentifier));
            }

            var certId = new CertificateIdentifier(certificateIdentifier);

            using (var _result = await operations.UpdateCertificateWithHttpMessagesAsync(certId.Vault, certId.Name, certId.Version ?? string.Empty, certificatePolicy, certificateAttributes, tags, null, cancellationToken).ConfigureAwait(false))
            {
                return(_result.Body);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets a certificate.
        /// </summary>
        /// <param name="certificateIdentifier">The URL for the certificate.</param>
        /// <param name="cancellationToken">Optional cancellation token</param>
        /// <returns>The retrieved certificate</returns>
        public static async Task <CertificateBundle> GetCertificateAsync(this IKeyVaultClient operations, string certificateIdentifier, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (string.IsNullOrEmpty(certificateIdentifier))
            {
                throw new ArgumentNullException(nameof(certificateIdentifier));
            }

            var certId = new CertificateIdentifier(certificateIdentifier);

            using (var _result = await operations.GetCertificateWithHttpMessagesAsync(certId.Vault, certId.Name, certId.Version ?? string.Empty, null, cancellationToken).ConfigureAwait(false))
            {
                return(_result.Body);
            }
        }