| | 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.Network.Models |
| | 13 | | { |
| | 14 | | public partial class VpnClientConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (VpnClientAddressPool != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("vpnClientAddressPool"); |
| 0 | 22 | | writer.WriteObjectValue(VpnClientAddressPool); |
| | 23 | | } |
| 0 | 24 | | if (VpnClientRootCertificates != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("vpnClientRootCertificates"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in VpnClientRootCertificates) |
| | 29 | | { |
| 0 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 0 | 34 | | if (VpnClientRevokedCertificates != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("vpnClientRevokedCertificates"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in VpnClientRevokedCertificates) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | if (VpnClientProtocols != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("vpnClientProtocols"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in VpnClientProtocols) |
| | 49 | | { |
| 0 | 50 | | writer.WriteStringValue(item.ToString()); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | if (VpnClientIpsecPolicies != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("vpnClientIpsecPolicies"); |
| 0 | 57 | | writer.WriteStartArray(); |
| 0 | 58 | | foreach (var item in VpnClientIpsecPolicies) |
| | 59 | | { |
| 0 | 60 | | writer.WriteObjectValue(item); |
| | 61 | | } |
| 0 | 62 | | writer.WriteEndArray(); |
| | 63 | | } |
| 0 | 64 | | if (RadiusServerAddress != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("radiusServerAddress"); |
| 0 | 67 | | writer.WriteStringValue(RadiusServerAddress); |
| | 68 | | } |
| 0 | 69 | | if (RadiusServerSecret != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("radiusServerSecret"); |
| 0 | 72 | | writer.WriteStringValue(RadiusServerSecret); |
| | 73 | | } |
| 0 | 74 | | if (RadiusServers != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("radiusServers"); |
| 0 | 77 | | writer.WriteStartArray(); |
| 0 | 78 | | foreach (var item in RadiusServers) |
| | 79 | | { |
| 0 | 80 | | writer.WriteObjectValue(item); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndArray(); |
| | 83 | | } |
| 0 | 84 | | if (AadTenant != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("aadTenant"); |
| 0 | 87 | | writer.WriteStringValue(AadTenant); |
| | 88 | | } |
| 0 | 89 | | if (AadAudience != null) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("aadAudience"); |
| 0 | 92 | | writer.WriteStringValue(AadAudience); |
| | 93 | | } |
| 0 | 94 | | if (AadIssuer != null) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName("aadIssuer"); |
| 0 | 97 | | writer.WriteStringValue(AadIssuer); |
| | 98 | | } |
| 0 | 99 | | writer.WriteEndObject(); |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | internal static VpnClientConfiguration DeserializeVpnClientConfiguration(JsonElement element) |
| | 103 | | { |
| 0 | 104 | | AddressSpace vpnClientAddressPool = default; |
| 0 | 105 | | IList<VpnClientRootCertificate> vpnClientRootCertificates = default; |
| 0 | 106 | | IList<VpnClientRevokedCertificate> vpnClientRevokedCertificates = default; |
| 0 | 107 | | IList<VpnClientProtocol> vpnClientProtocols = default; |
| 0 | 108 | | IList<IpsecPolicy> vpnClientIpsecPolicies = default; |
| 0 | 109 | | string radiusServerAddress = default; |
| 0 | 110 | | string radiusServerSecret = default; |
| 0 | 111 | | IList<RadiusServer> radiusServers = default; |
| 0 | 112 | | string aadTenant = default; |
| 0 | 113 | | string aadAudience = default; |
| 0 | 114 | | string aadIssuer = default; |
| 0 | 115 | | foreach (var property in element.EnumerateObject()) |
| | 116 | | { |
| 0 | 117 | | if (property.NameEquals("vpnClientAddressPool")) |
| | 118 | | { |
| 0 | 119 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 120 | | { |
| | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | vpnClientAddressPool = AddressSpace.DeserializeAddressSpace(property.Value); |
| 0 | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | if (property.NameEquals("vpnClientRootCertificates")) |
| | 127 | | { |
| 0 | 128 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 129 | | { |
| | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | List<VpnClientRootCertificate> array = new List<VpnClientRootCertificate>(); |
| 0 | 133 | | foreach (var item in property.Value.EnumerateArray()) |
| | 134 | | { |
| 0 | 135 | | if (item.ValueKind == JsonValueKind.Null) |
| | 136 | | { |
| 0 | 137 | | array.Add(null); |
| | 138 | | } |
| | 139 | | else |
| | 140 | | { |
| 0 | 141 | | array.Add(VpnClientRootCertificate.DeserializeVpnClientRootCertificate(item)); |
| | 142 | | } |
| | 143 | | } |
| 0 | 144 | | vpnClientRootCertificates = array; |
| 0 | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | if (property.NameEquals("vpnClientRevokedCertificates")) |
| | 148 | | { |
| 0 | 149 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | List<VpnClientRevokedCertificate> array = new List<VpnClientRevokedCertificate>(); |
| 0 | 154 | | foreach (var item in property.Value.EnumerateArray()) |
| | 155 | | { |
| 0 | 156 | | if (item.ValueKind == JsonValueKind.Null) |
| | 157 | | { |
| 0 | 158 | | array.Add(null); |
| | 159 | | } |
| | 160 | | else |
| | 161 | | { |
| 0 | 162 | | array.Add(VpnClientRevokedCertificate.DeserializeVpnClientRevokedCertificate(item)); |
| | 163 | | } |
| | 164 | | } |
| 0 | 165 | | vpnClientRevokedCertificates = array; |
| 0 | 166 | | continue; |
| | 167 | | } |
| 0 | 168 | | if (property.NameEquals("vpnClientProtocols")) |
| | 169 | | { |
| 0 | 170 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 171 | | { |
| | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | List<VpnClientProtocol> array = new List<VpnClientProtocol>(); |
| 0 | 175 | | foreach (var item in property.Value.EnumerateArray()) |
| | 176 | | { |
| 0 | 177 | | array.Add(new VpnClientProtocol(item.GetString())); |
| | 178 | | } |
| 0 | 179 | | vpnClientProtocols = array; |
| 0 | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | if (property.NameEquals("vpnClientIpsecPolicies")) |
| | 183 | | { |
| 0 | 184 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | List<IpsecPolicy> array = new List<IpsecPolicy>(); |
| 0 | 189 | | foreach (var item in property.Value.EnumerateArray()) |
| | 190 | | { |
| 0 | 191 | | if (item.ValueKind == JsonValueKind.Null) |
| | 192 | | { |
| 0 | 193 | | array.Add(null); |
| | 194 | | } |
| | 195 | | else |
| | 196 | | { |
| 0 | 197 | | array.Add(IpsecPolicy.DeserializeIpsecPolicy(item)); |
| | 198 | | } |
| | 199 | | } |
| 0 | 200 | | vpnClientIpsecPolicies = array; |
| 0 | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | if (property.NameEquals("radiusServerAddress")) |
| | 204 | | { |
| 0 | 205 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | radiusServerAddress = property.Value.GetString(); |
| 0 | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | if (property.NameEquals("radiusServerSecret")) |
| | 213 | | { |
| 0 | 214 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | radiusServerSecret = property.Value.GetString(); |
| 0 | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | if (property.NameEquals("radiusServers")) |
| | 222 | | { |
| 0 | 223 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | List<RadiusServer> array = new List<RadiusServer>(); |
| 0 | 228 | | foreach (var item in property.Value.EnumerateArray()) |
| | 229 | | { |
| 0 | 230 | | if (item.ValueKind == JsonValueKind.Null) |
| | 231 | | { |
| 0 | 232 | | array.Add(null); |
| | 233 | | } |
| | 234 | | else |
| | 235 | | { |
| 0 | 236 | | array.Add(RadiusServer.DeserializeRadiusServer(item)); |
| | 237 | | } |
| | 238 | | } |
| 0 | 239 | | radiusServers = array; |
| 0 | 240 | | continue; |
| | 241 | | } |
| 0 | 242 | | if (property.NameEquals("aadTenant")) |
| | 243 | | { |
| 0 | 244 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | aadTenant = property.Value.GetString(); |
| 0 | 249 | | continue; |
| | 250 | | } |
| 0 | 251 | | if (property.NameEquals("aadAudience")) |
| | 252 | | { |
| 0 | 253 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | aadAudience = property.Value.GetString(); |
| 0 | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | if (property.NameEquals("aadIssuer")) |
| | 261 | | { |
| 0 | 262 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | aadIssuer = property.Value.GetString(); |
| | 267 | | continue; |
| | 268 | | } |
| | 269 | | } |
| 0 | 270 | | return new VpnClientConfiguration(vpnClientAddressPool, vpnClientRootCertificates, vpnClientRevokedCertifica |
| | 271 | | } |
| | 272 | | } |
| | 273 | | } |