| | 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 ApplicationGatewayPathRule : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (Paths != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("paths"); |
| 0 | 44 | | writer.WriteStartArray(); |
| 0 | 45 | | foreach (var item in Paths) |
| | 46 | | { |
| 0 | 47 | | writer.WriteStringValue(item); |
| | 48 | | } |
| 0 | 49 | | writer.WriteEndArray(); |
| | 50 | | } |
| 0 | 51 | | if (BackendAddressPool != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("backendAddressPool"); |
| 0 | 54 | | writer.WriteObjectValue(BackendAddressPool); |
| | 55 | | } |
| 0 | 56 | | if (BackendHttpSettings != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("backendHttpSettings"); |
| 0 | 59 | | writer.WriteObjectValue(BackendHttpSettings); |
| | 60 | | } |
| 0 | 61 | | if (RedirectConfiguration != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("redirectConfiguration"); |
| 0 | 64 | | writer.WriteObjectValue(RedirectConfiguration); |
| | 65 | | } |
| 0 | 66 | | if (RewriteRuleSet != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("rewriteRuleSet"); |
| 0 | 69 | | writer.WriteObjectValue(RewriteRuleSet); |
| | 70 | | } |
| 0 | 71 | | if (ProvisioningState != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("provisioningState"); |
| 0 | 74 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 75 | | } |
| 0 | 76 | | if (FirewallPolicy != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("firewallPolicy"); |
| 0 | 79 | | writer.WriteObjectValue(FirewallPolicy); |
| | 80 | | } |
| 0 | 81 | | writer.WriteEndObject(); |
| 0 | 82 | | writer.WriteEndObject(); |
| 0 | 83 | | } |
| | 84 | |
|
| | 85 | | internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule(JsonElement element) |
| | 86 | | { |
| 0 | 87 | | string name = default; |
| 0 | 88 | | string etag = default; |
| 0 | 89 | | string type = default; |
| 0 | 90 | | string id = default; |
| 0 | 91 | | IList<string> paths = default; |
| 0 | 92 | | SubResource backendAddressPool = default; |
| 0 | 93 | | SubResource backendHttpSettings = default; |
| 0 | 94 | | SubResource redirectConfiguration = default; |
| 0 | 95 | | SubResource rewriteRuleSet = default; |
| 0 | 96 | | ProvisioningState? provisioningState = default; |
| 0 | 97 | | SubResource firewallPolicy = default; |
| 0 | 98 | | foreach (var property in element.EnumerateObject()) |
| | 99 | | { |
| 0 | 100 | | if (property.NameEquals("name")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | name = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("etag")) |
| | 110 | | { |
| 0 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | etag = property.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("type")) |
| | 119 | | { |
| 0 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | type = property.Value.GetString(); |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property.NameEquals("id")) |
| | 128 | | { |
| 0 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | id = property.Value.GetString(); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property.NameEquals("properties")) |
| | 137 | | { |
| 0 | 138 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 139 | | { |
| 0 | 140 | | if (property0.NameEquals("paths")) |
| | 141 | | { |
| 0 | 142 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 143 | | { |
| | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | List<string> array = new List<string>(); |
| 0 | 147 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 148 | | { |
| 0 | 149 | | if (item.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| 0 | 151 | | array.Add(null); |
| | 152 | | } |
| | 153 | | else |
| | 154 | | { |
| 0 | 155 | | array.Add(item.GetString()); |
| | 156 | | } |
| | 157 | | } |
| 0 | 158 | | paths = array; |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property0.NameEquals("backendAddressPool")) |
| | 162 | | { |
| 0 | 163 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | backendAddressPool = DeserializeSubResource(property0.Value); |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property0.NameEquals("backendHttpSettings")) |
| | 171 | | { |
| 0 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | backendHttpSettings = DeserializeSubResource(property0.Value); |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property0.NameEquals("redirectConfiguration")) |
| | 180 | | { |
| 0 | 181 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 182 | | { |
| | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | redirectConfiguration = DeserializeSubResource(property0.Value); |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property0.NameEquals("rewriteRuleSet")) |
| | 189 | | { |
| 0 | 190 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | rewriteRuleSet = DeserializeSubResource(property0.Value); |
| 0 | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | if (property0.NameEquals("provisioningState")) |
| | 198 | | { |
| 0 | 199 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 200 | | { |
| | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | if (property0.NameEquals("firewallPolicy")) |
| | 207 | | { |
| 0 | 208 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 209 | | { |
| | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | firewallPolicy = DeserializeSubResource(property0.Value); |
| | 213 | | continue; |
| | 214 | | } |
| | 215 | | } |
| | 216 | | continue; |
| | 217 | | } |
| | 218 | | } |
| 0 | 219 | | return new ApplicationGatewayPathRule(id, name, etag, type, paths, backendAddressPool, backendHttpSettings, |
| | 220 | | } |
| | 221 | | } |
| | 222 | | } |