| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class KeyVaultProperties : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (KeyName != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("keyname"); |
| 0 | 22 | | writer.WriteStringValue(KeyName); |
| | 23 | | } |
| 0 | 24 | | if (KeyVersion != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("keyversion"); |
| 0 | 27 | | writer.WriteStringValue(KeyVersion); |
| | 28 | | } |
| 0 | 29 | | if (KeyVaultUri != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("keyvaulturi"); |
| 0 | 32 | | writer.WriteStringValue(KeyVaultUri); |
| | 33 | | } |
| 0 | 34 | | if (CurrentVersionedKeyIdentifier != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("currentVersionedKeyIdentifier"); |
| 0 | 37 | | writer.WriteStringValue(CurrentVersionedKeyIdentifier); |
| | 38 | | } |
| 0 | 39 | | if (LastKeyRotationTimestamp != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("lastKeyRotationTimestamp"); |
| 0 | 42 | | writer.WriteStringValue(LastKeyRotationTimestamp.Value, "O"); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndObject(); |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element) |
| | 48 | | { |
| 8 | 49 | | string keyname = default; |
| 8 | 50 | | string keyversion = default; |
| 8 | 51 | | string keyvaulturi = default; |
| 8 | 52 | | string currentVersionedKeyIdentifier = default; |
| 8 | 53 | | DateTimeOffset? lastKeyRotationTimestamp = default; |
| 88 | 54 | | foreach (var property in element.EnumerateObject()) |
| | 55 | | { |
| 36 | 56 | | if (property.NameEquals("keyname")) |
| | 57 | | { |
| 8 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 8 | 62 | | keyname = property.Value.GetString(); |
| 8 | 63 | | continue; |
| | 64 | | } |
| 28 | 65 | | if (property.NameEquals("keyversion")) |
| | 66 | | { |
| 8 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 8 | 71 | | keyversion = property.Value.GetString(); |
| 8 | 72 | | continue; |
| | 73 | | } |
| 20 | 74 | | if (property.NameEquals("keyvaulturi")) |
| | 75 | | { |
| 8 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 8 | 80 | | keyvaulturi = property.Value.GetString(); |
| 8 | 81 | | continue; |
| | 82 | | } |
| 12 | 83 | | if (property.NameEquals("currentVersionedKeyIdentifier")) |
| | 84 | | { |
| 4 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 4 | 89 | | currentVersionedKeyIdentifier = property.Value.GetString(); |
| 4 | 90 | | continue; |
| | 91 | | } |
| 8 | 92 | | if (property.NameEquals("lastKeyRotationTimestamp")) |
| | 93 | | { |
| 4 | 94 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 95 | | { |
| | 96 | | continue; |
| | 97 | | } |
| 4 | 98 | | lastKeyRotationTimestamp = property.Value.GetDateTimeOffset("O"); |
| | 99 | | continue; |
| | 100 | | } |
| | 101 | | } |
| 8 | 102 | | return new KeyVaultProperties(keyname, keyversion, keyvaulturi, currentVersionedKeyIdentifier, lastKeyRotati |
| | 103 | | } |
| | 104 | | } |
| | 105 | | } |