| | 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 FirewallPolicy : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Etag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("etag"); |
| 0 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 0 | 24 | | if (Identity != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("identity"); |
| 0 | 27 | | writer.WriteObjectValue(Identity); |
| | 28 | | } |
| 0 | 29 | | if (Id != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("id"); |
| 0 | 32 | | writer.WriteStringValue(Id); |
| | 33 | | } |
| 0 | 34 | | if (Name != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("name"); |
| 0 | 37 | | writer.WriteStringValue(Name); |
| | 38 | | } |
| 0 | 39 | | if (Type != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("type"); |
| 0 | 42 | | writer.WriteStringValue(Type); |
| | 43 | | } |
| 0 | 44 | | if (Location != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("location"); |
| 0 | 47 | | writer.WriteStringValue(Location); |
| | 48 | | } |
| 0 | 49 | | if (Tags != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("tags"); |
| 0 | 52 | | writer.WriteStartObject(); |
| 0 | 53 | | foreach (var item in Tags) |
| | 54 | | { |
| 0 | 55 | | writer.WritePropertyName(item.Key); |
| 0 | 56 | | writer.WriteStringValue(item.Value); |
| | 57 | | } |
| 0 | 58 | | writer.WriteEndObject(); |
| | 59 | | } |
| 0 | 60 | | writer.WritePropertyName("properties"); |
| 0 | 61 | | writer.WriteStartObject(); |
| 0 | 62 | | if (RuleGroups != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("ruleGroups"); |
| 0 | 65 | | writer.WriteStartArray(); |
| 0 | 66 | | foreach (var item in RuleGroups) |
| | 67 | | { |
| 0 | 68 | | writer.WriteObjectValue(item); |
| | 69 | | } |
| 0 | 70 | | writer.WriteEndArray(); |
| | 71 | | } |
| 0 | 72 | | if (ProvisioningState != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("provisioningState"); |
| 0 | 75 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 76 | | } |
| 0 | 77 | | if (BasePolicy != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("basePolicy"); |
| 0 | 80 | | writer.WriteObjectValue(BasePolicy); |
| | 81 | | } |
| 0 | 82 | | if (Firewalls != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("firewalls"); |
| 0 | 85 | | writer.WriteStartArray(); |
| 0 | 86 | | foreach (var item in Firewalls) |
| | 87 | | { |
| 0 | 88 | | writer.WriteObjectValue(item); |
| | 89 | | } |
| 0 | 90 | | writer.WriteEndArray(); |
| | 91 | | } |
| 0 | 92 | | if (ChildPolicies != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("childPolicies"); |
| 0 | 95 | | writer.WriteStartArray(); |
| 0 | 96 | | foreach (var item in ChildPolicies) |
| | 97 | | { |
| 0 | 98 | | writer.WriteObjectValue(item); |
| | 99 | | } |
| 0 | 100 | | writer.WriteEndArray(); |
| | 101 | | } |
| 0 | 102 | | if (ThreatIntelMode != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("threatIntelMode"); |
| 0 | 105 | | writer.WriteStringValue(ThreatIntelMode.Value.ToString()); |
| | 106 | | } |
| 0 | 107 | | if (ThreatIntelWhitelist != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("threatIntelWhitelist"); |
| 0 | 110 | | writer.WriteObjectValue(ThreatIntelWhitelist); |
| | 111 | | } |
| 0 | 112 | | if (IntrusionSystemMode != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("intrusionSystemMode"); |
| 0 | 115 | | writer.WriteStringValue(IntrusionSystemMode.Value.ToString()); |
| | 116 | | } |
| 0 | 117 | | if (TransportSecurity != null) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName("transportSecurity"); |
| 0 | 120 | | writer.WriteObjectValue(TransportSecurity); |
| | 121 | | } |
| 0 | 122 | | writer.WriteEndObject(); |
| 0 | 123 | | writer.WriteEndObject(); |
| 0 | 124 | | } |
| | 125 | |
|
| | 126 | | internal static FirewallPolicy DeserializeFirewallPolicy(JsonElement element) |
| | 127 | | { |
| 0 | 128 | | string etag = default; |
| 0 | 129 | | ManagedServiceIdentity identity = default; |
| 0 | 130 | | string id = default; |
| 0 | 131 | | string name = default; |
| 0 | 132 | | string type = default; |
| 0 | 133 | | string location = default; |
| 0 | 134 | | IDictionary<string, string> tags = default; |
| 0 | 135 | | IList<SubResource> ruleGroups = default; |
| 0 | 136 | | ProvisioningState? provisioningState = default; |
| 0 | 137 | | SubResource basePolicy = default; |
| 0 | 138 | | IList<SubResource> firewalls = default; |
| 0 | 139 | | IList<SubResource> childPolicies = default; |
| 0 | 140 | | AzureFirewallThreatIntelMode? threatIntelMode = default; |
| 0 | 141 | | FirewallPolicyThreatIntelWhitelist threatIntelWhitelist = default; |
| 0 | 142 | | FirewallPolicyIntrusionSystemMode? intrusionSystemMode = default; |
| 0 | 143 | | FirewallPolicyTransportSecurity transportSecurity = default; |
| 0 | 144 | | foreach (var property in element.EnumerateObject()) |
| | 145 | | { |
| 0 | 146 | | if (property.NameEquals("etag")) |
| | 147 | | { |
| 0 | 148 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | etag = property.Value.GetString(); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property.NameEquals("identity")) |
| | 156 | | { |
| 0 | 157 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property.NameEquals("id")) |
| | 165 | | { |
| 0 | 166 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | id = property.Value.GetString(); |
| 0 | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | if (property.NameEquals("name")) |
| | 174 | | { |
| 0 | 175 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | name = property.Value.GetString(); |
| 0 | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | if (property.NameEquals("type")) |
| | 183 | | { |
| 0 | 184 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | type = property.Value.GetString(); |
| 0 | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | if (property.NameEquals("location")) |
| | 192 | | { |
| 0 | 193 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | location = property.Value.GetString(); |
| 0 | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | if (property.NameEquals("tags")) |
| | 201 | | { |
| 0 | 202 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 207 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 208 | | { |
| 0 | 209 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| 0 | 211 | | dictionary.Add(property0.Name, null); |
| | 212 | | } |
| | 213 | | else |
| | 214 | | { |
| 0 | 215 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 216 | | } |
| | 217 | | } |
| 0 | 218 | | tags = dictionary; |
| 0 | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | if (property.NameEquals("properties")) |
| | 222 | | { |
| 0 | 223 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 224 | | { |
| 0 | 225 | | if (property0.NameEquals("ruleGroups")) |
| | 226 | | { |
| 0 | 227 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| | 229 | | continue; |
| | 230 | | } |
| 0 | 231 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 232 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 233 | | { |
| 0 | 234 | | if (item.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| 0 | 236 | | array.Add(null); |
| | 237 | | } |
| | 238 | | else |
| | 239 | | { |
| 0 | 240 | | array.Add(SubResource.DeserializeSubResource(item)); |
| | 241 | | } |
| | 242 | | } |
| 0 | 243 | | ruleGroups = array; |
| 0 | 244 | | continue; |
| | 245 | | } |
| 0 | 246 | | if (property0.NameEquals("provisioningState")) |
| | 247 | | { |
| 0 | 248 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 249 | | { |
| | 250 | | continue; |
| | 251 | | } |
| 0 | 252 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 253 | | continue; |
| | 254 | | } |
| 0 | 255 | | if (property0.NameEquals("basePolicy")) |
| | 256 | | { |
| 0 | 257 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 258 | | { |
| | 259 | | continue; |
| | 260 | | } |
| 0 | 261 | | basePolicy = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 262 | | continue; |
| | 263 | | } |
| 0 | 264 | | if (property0.NameEquals("firewalls")) |
| | 265 | | { |
| 0 | 266 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 267 | | { |
| | 268 | | continue; |
| | 269 | | } |
| 0 | 270 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 271 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 272 | | { |
| 0 | 273 | | if (item.ValueKind == JsonValueKind.Null) |
| | 274 | | { |
| 0 | 275 | | array.Add(null); |
| | 276 | | } |
| | 277 | | else |
| | 278 | | { |
| 0 | 279 | | array.Add(SubResource.DeserializeSubResource(item)); |
| | 280 | | } |
| | 281 | | } |
| 0 | 282 | | firewalls = array; |
| 0 | 283 | | continue; |
| | 284 | | } |
| 0 | 285 | | if (property0.NameEquals("childPolicies")) |
| | 286 | | { |
| 0 | 287 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 288 | | { |
| | 289 | | continue; |
| | 290 | | } |
| 0 | 291 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 292 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 293 | | { |
| 0 | 294 | | if (item.ValueKind == JsonValueKind.Null) |
| | 295 | | { |
| 0 | 296 | | array.Add(null); |
| | 297 | | } |
| | 298 | | else |
| | 299 | | { |
| 0 | 300 | | array.Add(SubResource.DeserializeSubResource(item)); |
| | 301 | | } |
| | 302 | | } |
| 0 | 303 | | childPolicies = array; |
| 0 | 304 | | continue; |
| | 305 | | } |
| 0 | 306 | | if (property0.NameEquals("threatIntelMode")) |
| | 307 | | { |
| 0 | 308 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 309 | | { |
| | 310 | | continue; |
| | 311 | | } |
| 0 | 312 | | threatIntelMode = new AzureFirewallThreatIntelMode(property0.Value.GetString()); |
| 0 | 313 | | continue; |
| | 314 | | } |
| 0 | 315 | | if (property0.NameEquals("threatIntelWhitelist")) |
| | 316 | | { |
| 0 | 317 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 318 | | { |
| | 319 | | continue; |
| | 320 | | } |
| 0 | 321 | | threatIntelWhitelist = FirewallPolicyThreatIntelWhitelist.DeserializeFirewallPolicyThreatInt |
| 0 | 322 | | continue; |
| | 323 | | } |
| 0 | 324 | | if (property0.NameEquals("intrusionSystemMode")) |
| | 325 | | { |
| 0 | 326 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 327 | | { |
| | 328 | | continue; |
| | 329 | | } |
| 0 | 330 | | intrusionSystemMode = new FirewallPolicyIntrusionSystemMode(property0.Value.GetString()); |
| 0 | 331 | | continue; |
| | 332 | | } |
| 0 | 333 | | if (property0.NameEquals("transportSecurity")) |
| | 334 | | { |
| 0 | 335 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 336 | | { |
| | 337 | | continue; |
| | 338 | | } |
| 0 | 339 | | transportSecurity = FirewallPolicyTransportSecurity.DeserializeFirewallPolicyTransportSecuri |
| | 340 | | continue; |
| | 341 | | } |
| | 342 | | } |
| | 343 | | continue; |
| | 344 | | } |
| | 345 | | } |
| 0 | 346 | | return new FirewallPolicy(id, name, type, location, tags, etag, identity, ruleGroups, provisioningState, bas |
| | 347 | | } |
| | 348 | | } |
| | 349 | | } |