| | 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 ApplicationGatewaySslPolicy : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (DisabledSslProtocols != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("disabledSslProtocols"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in DisabledSslProtocols) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item.ToString()); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (PolicyType != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("policyType"); |
| 0 | 32 | | writer.WriteStringValue(PolicyType.Value.ToString()); |
| | 33 | | } |
| 0 | 34 | | if (PolicyName != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("policyName"); |
| 0 | 37 | | writer.WriteStringValue(PolicyName.Value.ToString()); |
| | 38 | | } |
| 0 | 39 | | if (CipherSuites != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("cipherSuites"); |
| 0 | 42 | | writer.WriteStartArray(); |
| 0 | 43 | | foreach (var item in CipherSuites) |
| | 44 | | { |
| 0 | 45 | | writer.WriteStringValue(item.ToString()); |
| | 46 | | } |
| 0 | 47 | | writer.WriteEndArray(); |
| | 48 | | } |
| 0 | 49 | | if (MinProtocolVersion != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("minProtocolVersion"); |
| 0 | 52 | | writer.WriteStringValue(MinProtocolVersion.Value.ToString()); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndObject(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static ApplicationGatewaySslPolicy DeserializeApplicationGatewaySslPolicy(JsonElement element) |
| | 58 | | { |
| 0 | 59 | | IList<ApplicationGatewaySslProtocol> disabledSslProtocols = default; |
| 0 | 60 | | ApplicationGatewaySslPolicyType? policyType = default; |
| 0 | 61 | | ApplicationGatewaySslPolicyName? policyName = default; |
| 0 | 62 | | IList<ApplicationGatewaySslCipherSuite> cipherSuites = default; |
| 0 | 63 | | ApplicationGatewaySslProtocol? minProtocolVersion = default; |
| 0 | 64 | | foreach (var property in element.EnumerateObject()) |
| | 65 | | { |
| 0 | 66 | | if (property.NameEquals("disabledSslProtocols")) |
| | 67 | | { |
| 0 | 68 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 69 | | { |
| | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | List<ApplicationGatewaySslProtocol> array = new List<ApplicationGatewaySslProtocol>(); |
| 0 | 73 | | foreach (var item in property.Value.EnumerateArray()) |
| | 74 | | { |
| 0 | 75 | | array.Add(new ApplicationGatewaySslProtocol(item.GetString())); |
| | 76 | | } |
| 0 | 77 | | disabledSslProtocols = array; |
| 0 | 78 | | continue; |
| | 79 | | } |
| 0 | 80 | | if (property.NameEquals("policyType")) |
| | 81 | | { |
| 0 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | policyType = new ApplicationGatewaySslPolicyType(property.Value.GetString()); |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("policyName")) |
| | 90 | | { |
| 0 | 91 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | policyName = new ApplicationGatewaySslPolicyName(property.Value.GetString()); |
| 0 | 96 | | continue; |
| | 97 | | } |
| 0 | 98 | | if (property.NameEquals("cipherSuites")) |
| | 99 | | { |
| 0 | 100 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 101 | | { |
| | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | List<ApplicationGatewaySslCipherSuite> array = new List<ApplicationGatewaySslCipherSuite>(); |
| 0 | 105 | | foreach (var item in property.Value.EnumerateArray()) |
| | 106 | | { |
| 0 | 107 | | array.Add(new ApplicationGatewaySslCipherSuite(item.GetString())); |
| | 108 | | } |
| 0 | 109 | | cipherSuites = array; |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("minProtocolVersion")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | minProtocolVersion = new ApplicationGatewaySslProtocol(property.Value.GetString()); |
| | 119 | | continue; |
| | 120 | | } |
| | 121 | | } |
| 0 | 122 | | return new ApplicationGatewaySslPolicy(disabledSslProtocols, policyType, policyName, cipherSuites, minProtoc |
| | 123 | | } |
| | 124 | | } |
| | 125 | | } |