| | | 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.Text.Json; |
| | | 9 | | using Azure.Core; |
| | | 10 | | |
| | | 11 | | namespace Azure.ResourceManager.Network.Models |
| | | 12 | | { |
| | | 13 | | public partial class ApplicationGatewaySku : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 0 | 17 | | writer.WriteStartObject(); |
| | 0 | 18 | | if (Name != null) |
| | | 19 | | { |
| | 0 | 20 | | writer.WritePropertyName("name"); |
| | 0 | 21 | | writer.WriteStringValue(Name.Value.ToString()); |
| | | 22 | | } |
| | 0 | 23 | | if (Tier != null) |
| | | 24 | | { |
| | 0 | 25 | | writer.WritePropertyName("tier"); |
| | 0 | 26 | | writer.WriteStringValue(Tier.Value.ToString()); |
| | | 27 | | } |
| | 0 | 28 | | if (Capacity != null) |
| | | 29 | | { |
| | 0 | 30 | | writer.WritePropertyName("capacity"); |
| | 0 | 31 | | writer.WriteNumberValue(Capacity.Value); |
| | | 32 | | } |
| | 0 | 33 | | writer.WriteEndObject(); |
| | 0 | 34 | | } |
| | | 35 | | |
| | | 36 | | internal static ApplicationGatewaySku DeserializeApplicationGatewaySku(JsonElement element) |
| | | 37 | | { |
| | 0 | 38 | | ApplicationGatewaySkuName? name = default; |
| | 0 | 39 | | ApplicationGatewayTier? tier = default; |
| | 0 | 40 | | int? capacity = default; |
| | 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | | 42 | | { |
| | 0 | 43 | | if (property.NameEquals("name")) |
| | | 44 | | { |
| | 0 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 46 | | { |
| | | 47 | | continue; |
| | | 48 | | } |
| | 0 | 49 | | name = new ApplicationGatewaySkuName(property.Value.GetString()); |
| | 0 | 50 | | continue; |
| | | 51 | | } |
| | 0 | 52 | | if (property.NameEquals("tier")) |
| | | 53 | | { |
| | 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 55 | | { |
| | | 56 | | continue; |
| | | 57 | | } |
| | 0 | 58 | | tier = new ApplicationGatewayTier(property.Value.GetString()); |
| | 0 | 59 | | continue; |
| | | 60 | | } |
| | 0 | 61 | | if (property.NameEquals("capacity")) |
| | | 62 | | { |
| | 0 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 64 | | { |
| | | 65 | | continue; |
| | | 66 | | } |
| | 0 | 67 | | capacity = property.Value.GetInt32(); |
| | | 68 | | continue; |
| | | 69 | | } |
| | | 70 | | } |
| | 0 | 71 | | return new ApplicationGatewaySku(name, tier, capacity); |
| | | 72 | | } |
| | | 73 | | } |
| | | 74 | | } |