| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class DiskEncryptionSet : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 40 | 18 | | writer.WriteStartObject(); |
| 40 | 19 | | if (Identity != null) |
| | 20 | | { |
| 40 | 21 | | writer.WritePropertyName("identity"); |
| 40 | 22 | | writer.WriteObjectValue(Identity); |
| | 23 | | } |
| 40 | 24 | | if (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 40 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 40 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 40 | 39 | | writer.WritePropertyName("location"); |
| 40 | 40 | | writer.WriteStringValue(Location); |
| 40 | 41 | | if (Tags != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("tags"); |
| 0 | 44 | | writer.WriteStartObject(); |
| 0 | 45 | | foreach (var item in Tags) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName(item.Key); |
| 0 | 48 | | writer.WriteStringValue(item.Value); |
| | 49 | | } |
| 0 | 50 | | writer.WriteEndObject(); |
| | 51 | | } |
| 40 | 52 | | writer.WritePropertyName("properties"); |
| 40 | 53 | | writer.WriteStartObject(); |
| 40 | 54 | | if (ActiveKey != null) |
| | 55 | | { |
| 40 | 56 | | writer.WritePropertyName("activeKey"); |
| 40 | 57 | | writer.WriteObjectValue(ActiveKey); |
| | 58 | | } |
| 40 | 59 | | if (PreviousKeys != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("previousKeys"); |
| 0 | 62 | | writer.WriteStartArray(); |
| 0 | 63 | | foreach (var item in PreviousKeys) |
| | 64 | | { |
| 0 | 65 | | writer.WriteObjectValue(item); |
| | 66 | | } |
| 0 | 67 | | writer.WriteEndArray(); |
| | 68 | | } |
| 40 | 69 | | if (ProvisioningState != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("provisioningState"); |
| 0 | 72 | | writer.WriteStringValue(ProvisioningState); |
| | 73 | | } |
| 40 | 74 | | writer.WriteEndObject(); |
| 40 | 75 | | writer.WriteEndObject(); |
| 40 | 76 | | } |
| | 77 | |
|
| | 78 | | internal static DiskEncryptionSet DeserializeDiskEncryptionSet(JsonElement element) |
| | 79 | | { |
| 60 | 80 | | EncryptionSetIdentity identity = default; |
| 60 | 81 | | string id = default; |
| 60 | 82 | | string name = default; |
| 60 | 83 | | string type = default; |
| 60 | 84 | | string location = default; |
| 60 | 85 | | IDictionary<string, string> tags = default; |
| 60 | 86 | | KeyVaultAndKeyReference activeKey = default; |
| 60 | 87 | | IList<KeyVaultAndKeyReference> previousKeys = default; |
| 60 | 88 | | string provisioningState = default; |
| 848 | 89 | | foreach (var property in element.EnumerateObject()) |
| | 90 | | { |
| 364 | 91 | | if (property.NameEquals("identity")) |
| | 92 | | { |
| 60 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 60 | 97 | | identity = EncryptionSetIdentity.DeserializeEncryptionSetIdentity(property.Value); |
| 60 | 98 | | continue; |
| | 99 | | } |
| 304 | 100 | | if (property.NameEquals("id")) |
| | 101 | | { |
| 60 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 60 | 106 | | id = property.Value.GetString(); |
| 60 | 107 | | continue; |
| | 108 | | } |
| 244 | 109 | | if (property.NameEquals("name")) |
| | 110 | | { |
| 60 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 60 | 115 | | name = property.Value.GetString(); |
| 60 | 116 | | continue; |
| | 117 | | } |
| 184 | 118 | | if (property.NameEquals("type")) |
| | 119 | | { |
| 60 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 60 | 124 | | type = property.Value.GetString(); |
| 60 | 125 | | continue; |
| | 126 | | } |
| 124 | 127 | | if (property.NameEquals("location")) |
| | 128 | | { |
| 60 | 129 | | location = property.Value.GetString(); |
| 60 | 130 | | continue; |
| | 131 | | } |
| 64 | 132 | | if (property.NameEquals("tags")) |
| | 133 | | { |
| 4 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 4 | 138 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 16 | 139 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 140 | | { |
| 4 | 141 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 142 | | { |
| 0 | 143 | | dictionary.Add(property0.Name, null); |
| | 144 | | } |
| | 145 | | else |
| | 146 | | { |
| 4 | 147 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 148 | | } |
| | 149 | | } |
| 4 | 150 | | tags = dictionary; |
| 4 | 151 | | continue; |
| | 152 | | } |
| 60 | 153 | | if (property.NameEquals("properties")) |
| | 154 | | { |
| 360 | 155 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 156 | | { |
| 120 | 157 | | if (property0.NameEquals("activeKey")) |
| | 158 | | { |
| 60 | 159 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 160 | | { |
| | 161 | | continue; |
| | 162 | | } |
| 60 | 163 | | activeKey = KeyVaultAndKeyReference.DeserializeKeyVaultAndKeyReference(property0.Value); |
| 60 | 164 | | continue; |
| | 165 | | } |
| 60 | 166 | | if (property0.NameEquals("previousKeys")) |
| | 167 | | { |
| 0 | 168 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 169 | | { |
| | 170 | | continue; |
| | 171 | | } |
| 0 | 172 | | List<KeyVaultAndKeyReference> array = new List<KeyVaultAndKeyReference>(); |
| 0 | 173 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 174 | | { |
| 0 | 175 | | if (item.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| 0 | 177 | | array.Add(null); |
| | 178 | | } |
| | 179 | | else |
| | 180 | | { |
| 0 | 181 | | array.Add(KeyVaultAndKeyReference.DeserializeKeyVaultAndKeyReference(item)); |
| | 182 | | } |
| | 183 | | } |
| 0 | 184 | | previousKeys = array; |
| 0 | 185 | | continue; |
| | 186 | | } |
| 60 | 187 | | if (property0.NameEquals("provisioningState")) |
| | 188 | | { |
| 60 | 189 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| | 191 | | continue; |
| | 192 | | } |
| 60 | 193 | | provisioningState = property0.Value.GetString(); |
| | 194 | | continue; |
| | 195 | | } |
| | 196 | | } |
| | 197 | | continue; |
| | 198 | | } |
| | 199 | | } |
| 60 | 200 | | return new DiskEncryptionSet(id, name, type, location, tags, identity, activeKey, previousKeys, provisioning |
| | 201 | | } |
| | 202 | | } |
| | 203 | | } |