| | 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 ExpressRouteConnection : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("name"); |
| 0 | 19 | | writer.WriteStringValue(Name); |
| 0 | 20 | | if (Id != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("id"); |
| 0 | 23 | | writer.WriteStringValue(Id); |
| | 24 | | } |
| 0 | 25 | | writer.WritePropertyName("properties"); |
| 0 | 26 | | writer.WriteStartObject(); |
| 0 | 27 | | if (ProvisioningState != null) |
| | 28 | | { |
| 0 | 29 | | writer.WritePropertyName("provisioningState"); |
| 0 | 30 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 31 | | } |
| 0 | 32 | | if (ExpressRouteCircuitPeering != null) |
| | 33 | | { |
| 0 | 34 | | writer.WritePropertyName("expressRouteCircuitPeering"); |
| 0 | 35 | | writer.WriteObjectValue(ExpressRouteCircuitPeering); |
| | 36 | | } |
| 0 | 37 | | if (AuthorizationKey != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("authorizationKey"); |
| 0 | 40 | | writer.WriteStringValue(AuthorizationKey); |
| | 41 | | } |
| 0 | 42 | | if (RoutingWeight != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("routingWeight"); |
| 0 | 45 | | writer.WriteNumberValue(RoutingWeight.Value); |
| | 46 | | } |
| 0 | 47 | | if (EnableInternetSecurity != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("enableInternetSecurity"); |
| 0 | 50 | | writer.WriteBooleanValue(EnableInternetSecurity.Value); |
| | 51 | | } |
| 0 | 52 | | if (RoutingConfiguration != null) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("routingConfiguration"); |
| 0 | 55 | | writer.WriteObjectValue(RoutingConfiguration); |
| | 56 | | } |
| 0 | 57 | | writer.WriteEndObject(); |
| 0 | 58 | | writer.WriteEndObject(); |
| 0 | 59 | | } |
| | 60 | |
|
| | 61 | | internal static ExpressRouteConnection DeserializeExpressRouteConnection(JsonElement element) |
| | 62 | | { |
| 0 | 63 | | string name = default; |
| 0 | 64 | | string id = default; |
| 0 | 65 | | ProvisioningState? provisioningState = default; |
| 0 | 66 | | ExpressRouteCircuitPeeringId expressRouteCircuitPeering = default; |
| 0 | 67 | | string authorizationKey = default; |
| 0 | 68 | | int? routingWeight = default; |
| 0 | 69 | | bool? enableInternetSecurity = default; |
| 0 | 70 | | RoutingConfiguration routingConfiguration = default; |
| 0 | 71 | | foreach (var property in element.EnumerateObject()) |
| | 72 | | { |
| 0 | 73 | | if (property.NameEquals("name")) |
| | 74 | | { |
| 0 | 75 | | name = property.Value.GetString(); |
| 0 | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | if (property.NameEquals("id")) |
| | 79 | | { |
| 0 | 80 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 81 | | { |
| | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | id = property.Value.GetString(); |
| 0 | 85 | | continue; |
| | 86 | | } |
| 0 | 87 | | if (property.NameEquals("properties")) |
| | 88 | | { |
| 0 | 89 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 90 | | { |
| 0 | 91 | | if (property0.NameEquals("provisioningState")) |
| | 92 | | { |
| 0 | 93 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | if (property0.NameEquals("expressRouteCircuitPeering")) |
| | 101 | | { |
| 0 | 102 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | expressRouteCircuitPeering = ExpressRouteCircuitPeeringId.DeserializeExpressRouteCircuitPeer |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property0.NameEquals("authorizationKey")) |
| | 110 | | { |
| 0 | 111 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | authorizationKey = property0.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property0.NameEquals("routingWeight")) |
| | 119 | | { |
| 0 | 120 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | routingWeight = property0.Value.GetInt32(); |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property0.NameEquals("enableInternetSecurity")) |
| | 128 | | { |
| 0 | 129 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | enableInternetSecurity = property0.Value.GetBoolean(); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property0.NameEquals("routingConfiguration")) |
| | 137 | | { |
| 0 | 138 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | routingConfiguration = RoutingConfiguration.DeserializeRoutingConfiguration(property0.Value) |
| | 143 | | continue; |
| | 144 | | } |
| | 145 | | } |
| | 146 | | continue; |
| | 147 | | } |
| | 148 | | } |
| 0 | 149 | | return new ExpressRouteConnection(id, name, provisioningState, expressRouteCircuitPeering, authorizationKey, |
| | 150 | | } |
| | 151 | | } |
| | 152 | | } |