| | 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.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.KeyVault.Models |
| | 14 | | { |
| | 15 | | public partial class VaultProperties : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 104 | 19 | | writer.WriteStartObject(); |
| 104 | 20 | | writer.WritePropertyName("tenantId"); |
| 104 | 21 | | writer.WriteStringValue(TenantId); |
| 104 | 22 | | writer.WritePropertyName("sku"); |
| 104 | 23 | | writer.WriteObjectValue(Sku); |
| 104 | 24 | | if (Optional.IsCollectionDefined(AccessPolicies)) |
| | 25 | | { |
| 104 | 26 | | writer.WritePropertyName("accessPolicies"); |
| 104 | 27 | | writer.WriteStartArray(); |
| 416 | 28 | | foreach (var item in AccessPolicies) |
| | 29 | | { |
| 104 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 104 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 104 | 34 | | if (Optional.IsDefined(VaultUri)) |
| | 35 | | { |
| 104 | 36 | | writer.WritePropertyName("vaultUri"); |
| 104 | 37 | | writer.WriteStringValue(VaultUri); |
| | 38 | | } |
| 104 | 39 | | if (Optional.IsDefined(EnabledForDeployment)) |
| | 40 | | { |
| 104 | 41 | | writer.WritePropertyName("enabledForDeployment"); |
| 104 | 42 | | writer.WriteBooleanValue(EnabledForDeployment.Value); |
| | 43 | | } |
| 104 | 44 | | if (Optional.IsDefined(EnabledForDiskEncryption)) |
| | 45 | | { |
| 104 | 46 | | writer.WritePropertyName("enabledForDiskEncryption"); |
| 104 | 47 | | writer.WriteBooleanValue(EnabledForDiskEncryption.Value); |
| | 48 | | } |
| 104 | 49 | | if (Optional.IsDefined(EnabledForTemplateDeployment)) |
| | 50 | | { |
| 104 | 51 | | writer.WritePropertyName("enabledForTemplateDeployment"); |
| 104 | 52 | | writer.WriteBooleanValue(EnabledForTemplateDeployment.Value); |
| | 53 | | } |
| 104 | 54 | | if (Optional.IsDefined(EnableSoftDelete)) |
| | 55 | | { |
| 64 | 56 | | writer.WritePropertyName("enableSoftDelete"); |
| 64 | 57 | | writer.WriteBooleanValue(EnableSoftDelete.Value); |
| | 58 | | } |
| 104 | 59 | | if (Optional.IsDefined(CreateMode)) |
| | 60 | | { |
| 8 | 61 | | writer.WritePropertyName("createMode"); |
| 8 | 62 | | writer.WriteStringValue(CreateMode.Value.ToSerialString()); |
| | 63 | | } |
| 104 | 64 | | if (Optional.IsDefined(EnablePurgeProtection)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("enablePurgeProtection"); |
| 0 | 67 | | writer.WriteBooleanValue(EnablePurgeProtection.Value); |
| | 68 | | } |
| 104 | 69 | | if (Optional.IsDefined(NetworkAcls)) |
| | 70 | | { |
| 104 | 71 | | writer.WritePropertyName("networkAcls"); |
| 104 | 72 | | writer.WriteObjectValue(NetworkAcls); |
| | 73 | | } |
| 104 | 74 | | writer.WriteEndObject(); |
| 104 | 75 | | } |
| | 76 | |
|
| | 77 | | internal static VaultProperties DeserializeVaultProperties(JsonElement element) |
| | 78 | | { |
| 76 | 79 | | Guid tenantId = default; |
| 76 | 80 | | Sku sku = default; |
| 76 | 81 | | Optional<IList<AccessPolicyEntry>> accessPolicies = default; |
| 76 | 82 | | Optional<string> vaultUri = default; |
| 76 | 83 | | Optional<bool> enabledForDeployment = default; |
| 76 | 84 | | Optional<bool> enabledForDiskEncryption = default; |
| 76 | 85 | | Optional<bool> enabledForTemplateDeployment = default; |
| 76 | 86 | | Optional<bool> enableSoftDelete = default; |
| 76 | 87 | | Optional<CreateMode> createMode = default; |
| 76 | 88 | | Optional<bool> enablePurgeProtection = default; |
| 76 | 89 | | Optional<NetworkRuleSet> networkAcls = default; |
| 76 | 90 | | Optional<IReadOnlyList<PrivateEndpointConnectionItem>> privateEndpointConnections = default; |
| 1672 | 91 | | foreach (var property in element.EnumerateObject()) |
| | 92 | | { |
| 760 | 93 | | if (property.NameEquals("tenantId")) |
| | 94 | | { |
| 76 | 95 | | tenantId = property.Value.GetGuid(); |
| 76 | 96 | | continue; |
| | 97 | | } |
| 684 | 98 | | if (property.NameEquals("sku")) |
| | 99 | | { |
| 76 | 100 | | sku = Sku.DeserializeSku(property.Value); |
| 76 | 101 | | continue; |
| | 102 | | } |
| 608 | 103 | | if (property.NameEquals("accessPolicies")) |
| | 104 | | { |
| 76 | 105 | | List<AccessPolicyEntry> array = new List<AccessPolicyEntry>(); |
| 304 | 106 | | foreach (var item in property.Value.EnumerateArray()) |
| | 107 | | { |
| 76 | 108 | | array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item)); |
| | 109 | | } |
| 76 | 110 | | accessPolicies = array; |
| 76 | 111 | | continue; |
| | 112 | | } |
| 532 | 113 | | if (property.NameEquals("vaultUri")) |
| | 114 | | { |
| 76 | 115 | | vaultUri = property.Value.GetString(); |
| 76 | 116 | | continue; |
| | 117 | | } |
| 456 | 118 | | if (property.NameEquals("enabledForDeployment")) |
| | 119 | | { |
| 76 | 120 | | enabledForDeployment = property.Value.GetBoolean(); |
| 76 | 121 | | continue; |
| | 122 | | } |
| 380 | 123 | | if (property.NameEquals("enabledForDiskEncryption")) |
| | 124 | | { |
| 76 | 125 | | enabledForDiskEncryption = property.Value.GetBoolean(); |
| 76 | 126 | | continue; |
| | 127 | | } |
| 304 | 128 | | if (property.NameEquals("enabledForTemplateDeployment")) |
| | 129 | | { |
| 76 | 130 | | enabledForTemplateDeployment = property.Value.GetBoolean(); |
| 76 | 131 | | continue; |
| | 132 | | } |
| 228 | 133 | | if (property.NameEquals("enableSoftDelete")) |
| | 134 | | { |
| 76 | 135 | | enableSoftDelete = property.Value.GetBoolean(); |
| 76 | 136 | | continue; |
| | 137 | | } |
| 152 | 138 | | if (property.NameEquals("createMode")) |
| | 139 | | { |
| 0 | 140 | | createMode = property.Value.GetString().ToCreateMode(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 152 | 143 | | if (property.NameEquals("enablePurgeProtection")) |
| | 144 | | { |
| 0 | 145 | | enablePurgeProtection = property.Value.GetBoolean(); |
| 0 | 146 | | continue; |
| | 147 | | } |
| 152 | 148 | | if (property.NameEquals("networkAcls")) |
| | 149 | | { |
| 76 | 150 | | networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property.Value); |
| 76 | 151 | | continue; |
| | 152 | | } |
| 76 | 153 | | if (property.NameEquals("privateEndpointConnections")) |
| | 154 | | { |
| 0 | 155 | | List<PrivateEndpointConnectionItem> array = new List<PrivateEndpointConnectionItem>(); |
| 0 | 156 | | foreach (var item in property.Value.EnumerateArray()) |
| | 157 | | { |
| 0 | 158 | | array.Add(PrivateEndpointConnectionItem.DeserializePrivateEndpointConnectionItem(item)); |
| | 159 | | } |
| 0 | 160 | | privateEndpointConnections = array; |
| | 161 | | continue; |
| | 162 | | } |
| | 163 | | } |
| 76 | 164 | | return new VaultProperties(tenantId, sku, Optional.ToList(accessPolicies), vaultUri.Value, Optional.ToNullab |
| | 165 | | } |
| | 166 | | } |
| | 167 | | } |