| | 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 FirewallPolicyTransportSecurity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (CertificateAuthority != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("certificateAuthority"); |
| 0 | 22 | | writer.WriteObjectValue(CertificateAuthority); |
| | 23 | | } |
| 0 | 24 | | if (ExcludedDomains != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("excludedDomains"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in ExcludedDomains) |
| | 29 | | { |
| 0 | 30 | | writer.WriteStringValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 0 | 34 | | if (TrustedRootCertificates != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("trustedRootCertificates"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in TrustedRootCertificates) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndObject(); |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static FirewallPolicyTransportSecurity DeserializeFirewallPolicyTransportSecurity(JsonElement element) |
| | 48 | | { |
| 0 | 49 | | FirewallPolicyCertificateAuthority certificateAuthority = default; |
| 0 | 50 | | IList<string> excludedDomains = default; |
| 0 | 51 | | IList<FirewallPolicyTrustedRootCertificate> trustedRootCertificates = default; |
| 0 | 52 | | foreach (var property in element.EnumerateObject()) |
| | 53 | | { |
| 0 | 54 | | if (property.NameEquals("certificateAuthority")) |
| | 55 | | { |
| 0 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 0 | 60 | | certificateAuthority = FirewallPolicyCertificateAuthority.DeserializeFirewallPolicyCertificateAuthor |
| 0 | 61 | | continue; |
| | 62 | | } |
| 0 | 63 | | if (property.NameEquals("excludedDomains")) |
| | 64 | | { |
| 0 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 66 | | { |
| | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | List<string> array = new List<string>(); |
| 0 | 70 | | foreach (var item in property.Value.EnumerateArray()) |
| | 71 | | { |
| 0 | 72 | | if (item.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| 0 | 74 | | array.Add(null); |
| | 75 | | } |
| | 76 | | else |
| | 77 | | { |
| 0 | 78 | | array.Add(item.GetString()); |
| | 79 | | } |
| | 80 | | } |
| 0 | 81 | | excludedDomains = array; |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("trustedRootCertificates")) |
| | 85 | | { |
| 0 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | List<FirewallPolicyTrustedRootCertificate> array = new List<FirewallPolicyTrustedRootCertificate>(); |
| 0 | 91 | | foreach (var item in property.Value.EnumerateArray()) |
| | 92 | | { |
| 0 | 93 | | if (item.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| 0 | 95 | | array.Add(null); |
| | 96 | | } |
| | 97 | | else |
| | 98 | | { |
| 0 | 99 | | array.Add(FirewallPolicyTrustedRootCertificate.DeserializeFirewallPolicyTrustedRootCertifica |
| | 100 | | } |
| | 101 | | } |
| 0 | 102 | | trustedRootCertificates = array; |
| | 103 | | continue; |
| | 104 | | } |
| | 105 | | } |
| 0 | 106 | | return new FirewallPolicyTransportSecurity(certificateAuthority, excludedDomains, trustedRootCertificates); |
| | 107 | | } |
| | 108 | | } |
| | 109 | | } |