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