| | 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 ExpressRouteGateway : 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 (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 0 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 0 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 0 | 39 | | if (Location != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("location"); |
| 0 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 0 | 44 | | if (Tags != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("tags"); |
| 0 | 47 | | writer.WriteStartObject(); |
| 0 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName(item.Key); |
| 0 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 0 | 55 | | writer.WritePropertyName("properties"); |
| 0 | 56 | | writer.WriteStartObject(); |
| 0 | 57 | | if (AutoScaleConfiguration != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("autoScaleConfiguration"); |
| 0 | 60 | | writer.WriteObjectValue(AutoScaleConfiguration); |
| | 61 | | } |
| 0 | 62 | | if (ExpressRouteConnections != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("expressRouteConnections"); |
| 0 | 65 | | writer.WriteStartArray(); |
| 0 | 66 | | foreach (var item in ExpressRouteConnections) |
| | 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 (VirtualHub != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("virtualHub"); |
| 0 | 80 | | writer.WriteObjectValue(VirtualHub); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndObject(); |
| 0 | 83 | | writer.WriteEndObject(); |
| 0 | 84 | | } |
| | 85 | |
|
| | 86 | | internal static ExpressRouteGateway DeserializeExpressRouteGateway(JsonElement element) |
| | 87 | | { |
| 0 | 88 | | string etag = default; |
| 0 | 89 | | string id = default; |
| 0 | 90 | | string name = default; |
| 0 | 91 | | string type = default; |
| 0 | 92 | | string location = default; |
| 0 | 93 | | IDictionary<string, string> tags = default; |
| 0 | 94 | | ExpressRouteGatewayPropertiesAutoScaleConfiguration autoScaleConfiguration = default; |
| 0 | 95 | | IList<ExpressRouteConnection> expressRouteConnections = default; |
| 0 | 96 | | ProvisioningState? provisioningState = default; |
| 0 | 97 | | VirtualHubId virtualHub = default; |
| 0 | 98 | | foreach (var property in element.EnumerateObject()) |
| | 99 | | { |
| 0 | 100 | | if (property.NameEquals("etag")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | etag = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("id")) |
| | 110 | | { |
| 0 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | id = property.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("name")) |
| | 119 | | { |
| 0 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | name = property.Value.GetString(); |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property.NameEquals("type")) |
| | 128 | | { |
| 0 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | type = property.Value.GetString(); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property.NameEquals("location")) |
| | 137 | | { |
| 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | location = property.Value.GetString(); |
| 0 | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | if (property.NameEquals("tags")) |
| | 146 | | { |
| 0 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 148 | | { |
| | 149 | | continue; |
| | 150 | | } |
| 0 | 151 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 152 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 153 | | { |
| 0 | 154 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| 0 | 156 | | dictionary.Add(property0.Name, null); |
| | 157 | | } |
| | 158 | | else |
| | 159 | | { |
| 0 | 160 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 161 | | } |
| | 162 | | } |
| 0 | 163 | | tags = dictionary; |
| 0 | 164 | | continue; |
| | 165 | | } |
| 0 | 166 | | if (property.NameEquals("properties")) |
| | 167 | | { |
| 0 | 168 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 169 | | { |
| 0 | 170 | | if (property0.NameEquals("autoScaleConfiguration")) |
| | 171 | | { |
| 0 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | autoScaleConfiguration = ExpressRouteGatewayPropertiesAutoScaleConfiguration.DeserializeExpr |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property0.NameEquals("expressRouteConnections")) |
| | 180 | | { |
| 0 | 181 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 182 | | { |
| | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | List<ExpressRouteConnection> array = new List<ExpressRouteConnection>(); |
| 0 | 186 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 187 | | { |
| 0 | 188 | | if (item.ValueKind == JsonValueKind.Null) |
| | 189 | | { |
| 0 | 190 | | array.Add(null); |
| | 191 | | } |
| | 192 | | else |
| | 193 | | { |
| 0 | 194 | | array.Add(ExpressRouteConnection.DeserializeExpressRouteConnection(item)); |
| | 195 | | } |
| | 196 | | } |
| 0 | 197 | | expressRouteConnections = array; |
| 0 | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | if (property0.NameEquals("provisioningState")) |
| | 201 | | { |
| 0 | 202 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | if (property0.NameEquals("virtualHub")) |
| | 210 | | { |
| 0 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 0 | 215 | | virtualHub = VirtualHubId.DeserializeVirtualHubId(property0.Value); |
| | 216 | | continue; |
| | 217 | | } |
| | 218 | | } |
| | 219 | | continue; |
| | 220 | | } |
| | 221 | | } |
| 0 | 222 | | return new ExpressRouteGateway(id, name, type, location, tags, etag, autoScaleConfiguration, expressRouteCon |
| | 223 | | } |
| | 224 | | } |
| | 225 | | } |