| | 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 ExpressRouteCircuit : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Sku != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("sku"); |
| 0 | 22 | | writer.WriteObjectValue(Sku); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 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 (AllowClassicOperations != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("allowClassicOperations"); |
| 0 | 65 | | writer.WriteBooleanValue(AllowClassicOperations.Value); |
| | 66 | | } |
| 0 | 67 | | if (CircuitProvisioningState != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("circuitProvisioningState"); |
| 0 | 70 | | writer.WriteStringValue(CircuitProvisioningState); |
| | 71 | | } |
| 0 | 72 | | if (ServiceProviderProvisioningState != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("serviceProviderProvisioningState"); |
| 0 | 75 | | writer.WriteStringValue(ServiceProviderProvisioningState.Value.ToString()); |
| | 76 | | } |
| 0 | 77 | | if (Authorizations != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("authorizations"); |
| 0 | 80 | | writer.WriteStartArray(); |
| 0 | 81 | | foreach (var item in Authorizations) |
| | 82 | | { |
| 0 | 83 | | writer.WriteObjectValue(item); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndArray(); |
| | 86 | | } |
| 0 | 87 | | if (Peerings != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("peerings"); |
| 0 | 90 | | writer.WriteStartArray(); |
| 0 | 91 | | foreach (var item in Peerings) |
| | 92 | | { |
| 0 | 93 | | writer.WriteObjectValue(item); |
| | 94 | | } |
| 0 | 95 | | writer.WriteEndArray(); |
| | 96 | | } |
| 0 | 97 | | if (ServiceKey != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("serviceKey"); |
| 0 | 100 | | writer.WriteStringValue(ServiceKey); |
| | 101 | | } |
| 0 | 102 | | if (ServiceProviderNotes != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("serviceProviderNotes"); |
| 0 | 105 | | writer.WriteStringValue(ServiceProviderNotes); |
| | 106 | | } |
| 0 | 107 | | if (ServiceProviderProperties != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("serviceProviderProperties"); |
| 0 | 110 | | writer.WriteObjectValue(ServiceProviderProperties); |
| | 111 | | } |
| 0 | 112 | | if (ExpressRoutePort != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("expressRoutePort"); |
| 0 | 115 | | writer.WriteObjectValue(ExpressRoutePort); |
| | 116 | | } |
| 0 | 117 | | if (BandwidthInGbps != null) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName("bandwidthInGbps"); |
| 0 | 120 | | writer.WriteNumberValue(BandwidthInGbps.Value); |
| | 121 | | } |
| 0 | 122 | | if (Stag != null) |
| | 123 | | { |
| 0 | 124 | | writer.WritePropertyName("stag"); |
| 0 | 125 | | writer.WriteNumberValue(Stag.Value); |
| | 126 | | } |
| 0 | 127 | | if (ProvisioningState != null) |
| | 128 | | { |
| 0 | 129 | | writer.WritePropertyName("provisioningState"); |
| 0 | 130 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 131 | | } |
| 0 | 132 | | if (GatewayManagerEtag != null) |
| | 133 | | { |
| 0 | 134 | | writer.WritePropertyName("gatewayManagerEtag"); |
| 0 | 135 | | writer.WriteStringValue(GatewayManagerEtag); |
| | 136 | | } |
| 0 | 137 | | if (GlobalReachEnabled != null) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName("globalReachEnabled"); |
| 0 | 140 | | writer.WriteBooleanValue(GlobalReachEnabled.Value); |
| | 141 | | } |
| 0 | 142 | | writer.WriteEndObject(); |
| 0 | 143 | | writer.WriteEndObject(); |
| 0 | 144 | | } |
| | 145 | |
|
| | 146 | | internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement element) |
| | 147 | | { |
| 0 | 148 | | ExpressRouteCircuitSku sku = default; |
| 0 | 149 | | string etag = default; |
| 0 | 150 | | string id = default; |
| 0 | 151 | | string name = default; |
| 0 | 152 | | string type = default; |
| 0 | 153 | | string location = default; |
| 0 | 154 | | IDictionary<string, string> tags = default; |
| 0 | 155 | | bool? allowClassicOperations = default; |
| 0 | 156 | | string circuitProvisioningState = default; |
| 0 | 157 | | ServiceProviderProvisioningState? serviceProviderProvisioningState = default; |
| 0 | 158 | | IList<ExpressRouteCircuitAuthorization> authorizations = default; |
| 0 | 159 | | IList<ExpressRouteCircuitPeering> peerings = default; |
| 0 | 160 | | string serviceKey = default; |
| 0 | 161 | | string serviceProviderNotes = default; |
| 0 | 162 | | ExpressRouteCircuitServiceProviderProperties serviceProviderProperties = default; |
| 0 | 163 | | SubResource expressRoutePort = default; |
| 0 | 164 | | float? bandwidthInGbps = default; |
| 0 | 165 | | int? stag = default; |
| 0 | 166 | | ProvisioningState? provisioningState = default; |
| 0 | 167 | | string gatewayManagerEtag = default; |
| 0 | 168 | | bool? globalReachEnabled = default; |
| 0 | 169 | | foreach (var property in element.EnumerateObject()) |
| | 170 | | { |
| 0 | 171 | | if (property.NameEquals("sku")) |
| | 172 | | { |
| 0 | 173 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | sku = ExpressRouteCircuitSku.DeserializeExpressRouteCircuitSku(property.Value); |
| 0 | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | if (property.NameEquals("etag")) |
| | 181 | | { |
| 0 | 182 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 183 | | { |
| | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | etag = property.Value.GetString(); |
| 0 | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | if (property.NameEquals("id")) |
| | 190 | | { |
| 0 | 191 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 192 | | { |
| | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | id = property.Value.GetString(); |
| 0 | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | if (property.NameEquals("name")) |
| | 199 | | { |
| 0 | 200 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| | 202 | | continue; |
| | 203 | | } |
| 0 | 204 | | name = property.Value.GetString(); |
| 0 | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | if (property.NameEquals("type")) |
| | 208 | | { |
| 0 | 209 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| | 211 | | continue; |
| | 212 | | } |
| 0 | 213 | | type = property.Value.GetString(); |
| 0 | 214 | | continue; |
| | 215 | | } |
| 0 | 216 | | if (property.NameEquals("location")) |
| | 217 | | { |
| 0 | 218 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| | 220 | | continue; |
| | 221 | | } |
| 0 | 222 | | location = property.Value.GetString(); |
| 0 | 223 | | continue; |
| | 224 | | } |
| 0 | 225 | | if (property.NameEquals("tags")) |
| | 226 | | { |
| 0 | 227 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| | 229 | | continue; |
| | 230 | | } |
| 0 | 231 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 232 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 233 | | { |
| 0 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| 0 | 236 | | dictionary.Add(property0.Name, null); |
| | 237 | | } |
| | 238 | | else |
| | 239 | | { |
| 0 | 240 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 241 | | } |
| | 242 | | } |
| 0 | 243 | | tags = dictionary; |
| 0 | 244 | | continue; |
| | 245 | | } |
| 0 | 246 | | if (property.NameEquals("properties")) |
| | 247 | | { |
| 0 | 248 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 249 | | { |
| 0 | 250 | | if (property0.NameEquals("allowClassicOperations")) |
| | 251 | | { |
| 0 | 252 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 253 | | { |
| | 254 | | continue; |
| | 255 | | } |
| 0 | 256 | | allowClassicOperations = property0.Value.GetBoolean(); |
| 0 | 257 | | continue; |
| | 258 | | } |
| 0 | 259 | | if (property0.NameEquals("circuitProvisioningState")) |
| | 260 | | { |
| 0 | 261 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 262 | | { |
| | 263 | | continue; |
| | 264 | | } |
| 0 | 265 | | circuitProvisioningState = property0.Value.GetString(); |
| 0 | 266 | | continue; |
| | 267 | | } |
| 0 | 268 | | if (property0.NameEquals("serviceProviderProvisioningState")) |
| | 269 | | { |
| 0 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | serviceProviderProvisioningState = new ServiceProviderProvisioningState(property0.Value.GetS |
| 0 | 275 | | continue; |
| | 276 | | } |
| 0 | 277 | | if (property0.NameEquals("authorizations")) |
| | 278 | | { |
| 0 | 279 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 280 | | { |
| | 281 | | continue; |
| | 282 | | } |
| 0 | 283 | | List<ExpressRouteCircuitAuthorization> array = new List<ExpressRouteCircuitAuthorization>(); |
| 0 | 284 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 285 | | { |
| 0 | 286 | | if (item.ValueKind == JsonValueKind.Null) |
| | 287 | | { |
| 0 | 288 | | array.Add(null); |
| | 289 | | } |
| | 290 | | else |
| | 291 | | { |
| 0 | 292 | | array.Add(ExpressRouteCircuitAuthorization.DeserializeExpressRouteCircuitAuthorizati |
| | 293 | | } |
| | 294 | | } |
| 0 | 295 | | authorizations = array; |
| 0 | 296 | | continue; |
| | 297 | | } |
| 0 | 298 | | if (property0.NameEquals("peerings")) |
| | 299 | | { |
| 0 | 300 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 301 | | { |
| | 302 | | continue; |
| | 303 | | } |
| 0 | 304 | | List<ExpressRouteCircuitPeering> array = new List<ExpressRouteCircuitPeering>(); |
| 0 | 305 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 306 | | { |
| 0 | 307 | | if (item.ValueKind == JsonValueKind.Null) |
| | 308 | | { |
| 0 | 309 | | array.Add(null); |
| | 310 | | } |
| | 311 | | else |
| | 312 | | { |
| 0 | 313 | | array.Add(ExpressRouteCircuitPeering.DeserializeExpressRouteCircuitPeering(item)); |
| | 314 | | } |
| | 315 | | } |
| 0 | 316 | | peerings = array; |
| 0 | 317 | | continue; |
| | 318 | | } |
| 0 | 319 | | if (property0.NameEquals("serviceKey")) |
| | 320 | | { |
| 0 | 321 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 322 | | { |
| | 323 | | continue; |
| | 324 | | } |
| 0 | 325 | | serviceKey = property0.Value.GetString(); |
| 0 | 326 | | continue; |
| | 327 | | } |
| 0 | 328 | | if (property0.NameEquals("serviceProviderNotes")) |
| | 329 | | { |
| 0 | 330 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 331 | | { |
| | 332 | | continue; |
| | 333 | | } |
| 0 | 334 | | serviceProviderNotes = property0.Value.GetString(); |
| 0 | 335 | | continue; |
| | 336 | | } |
| 0 | 337 | | if (property0.NameEquals("serviceProviderProperties")) |
| | 338 | | { |
| 0 | 339 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 340 | | { |
| | 341 | | continue; |
| | 342 | | } |
| 0 | 343 | | serviceProviderProperties = ExpressRouteCircuitServiceProviderProperties.DeserializeExpressR |
| 0 | 344 | | continue; |
| | 345 | | } |
| 0 | 346 | | if (property0.NameEquals("expressRoutePort")) |
| | 347 | | { |
| 0 | 348 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 349 | | { |
| | 350 | | continue; |
| | 351 | | } |
| 0 | 352 | | expressRoutePort = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 353 | | continue; |
| | 354 | | } |
| 0 | 355 | | if (property0.NameEquals("bandwidthInGbps")) |
| | 356 | | { |
| 0 | 357 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 358 | | { |
| | 359 | | continue; |
| | 360 | | } |
| 0 | 361 | | bandwidthInGbps = property0.Value.GetSingle(); |
| 0 | 362 | | continue; |
| | 363 | | } |
| 0 | 364 | | if (property0.NameEquals("stag")) |
| | 365 | | { |
| 0 | 366 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 367 | | { |
| | 368 | | continue; |
| | 369 | | } |
| 0 | 370 | | stag = property0.Value.GetInt32(); |
| 0 | 371 | | continue; |
| | 372 | | } |
| 0 | 373 | | if (property0.NameEquals("provisioningState")) |
| | 374 | | { |
| 0 | 375 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 376 | | { |
| | 377 | | continue; |
| | 378 | | } |
| 0 | 379 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 380 | | continue; |
| | 381 | | } |
| 0 | 382 | | if (property0.NameEquals("gatewayManagerEtag")) |
| | 383 | | { |
| 0 | 384 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 385 | | { |
| | 386 | | continue; |
| | 387 | | } |
| 0 | 388 | | gatewayManagerEtag = property0.Value.GetString(); |
| 0 | 389 | | continue; |
| | 390 | | } |
| 0 | 391 | | if (property0.NameEquals("globalReachEnabled")) |
| | 392 | | { |
| 0 | 393 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 394 | | { |
| | 395 | | continue; |
| | 396 | | } |
| 0 | 397 | | globalReachEnabled = property0.Value.GetBoolean(); |
| | 398 | | continue; |
| | 399 | | } |
| | 400 | | } |
| | 401 | | continue; |
| | 402 | | } |
| | 403 | | } |
| 0 | 404 | | return new ExpressRouteCircuit(id, name, type, location, tags, sku, etag, allowClassicOperations, circuitPro |
| | 405 | | } |
| | 406 | | } |
| | 407 | | } |