| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System.Text.Json; |
| | | 5 | | |
| | | 6 | | namespace Azure.Security.KeyVault.Certificates |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// A <see cref="KeyVaultCertificate"/> along with its <see cref="CertificatePolicy"/>. |
| | | 10 | | /// </summary> |
| | | 11 | | public class KeyVaultCertificateWithPolicy : KeyVaultCertificate |
| | | 12 | | { |
| | | 13 | | private const string PolicyPropertyName = "policy"; |
| | | 14 | | |
| | 60 | 15 | | internal KeyVaultCertificateWithPolicy(CertificateProperties properties = null) : base(properties) |
| | | 16 | | { |
| | 60 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the current policy for the certificate. |
| | | 21 | | /// </summary> |
| | 120 | 22 | | public CertificatePolicy Policy { get; internal set; } |
| | | 23 | | |
| | | 24 | | internal override void ReadProperty(JsonProperty prop) |
| | | 25 | | { |
| | 456 | 26 | | switch (prop.Name) |
| | | 27 | | { |
| | | 28 | | case PolicyPropertyName: |
| | 60 | 29 | | Policy = new CertificatePolicy(); |
| | 60 | 30 | | ((IJsonDeserializable)Policy).ReadProperties(prop.Value); |
| | 60 | 31 | | break; |
| | | 32 | | |
| | | 33 | | default: |
| | 396 | 34 | | base.ReadProperty(prop); |
| | | 35 | | break; |
| | | 36 | | } |
| | 396 | 37 | | } |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | } |