| | 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 ExpressRouteCrossConnection : 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 (PrimaryAzurePort != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("primaryAzurePort"); |
| 0 | 60 | | writer.WriteStringValue(PrimaryAzurePort); |
| | 61 | | } |
| 0 | 62 | | if (SecondaryAzurePort != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("secondaryAzurePort"); |
| 0 | 65 | | writer.WriteStringValue(SecondaryAzurePort); |
| | 66 | | } |
| 0 | 67 | | if (STag != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("sTag"); |
| 0 | 70 | | writer.WriteNumberValue(STag.Value); |
| | 71 | | } |
| 0 | 72 | | if (PeeringLocation != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("peeringLocation"); |
| 0 | 75 | | writer.WriteStringValue(PeeringLocation); |
| | 76 | | } |
| 0 | 77 | | if (BandwidthInMbps != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("bandwidthInMbps"); |
| 0 | 80 | | writer.WriteNumberValue(BandwidthInMbps.Value); |
| | 81 | | } |
| 0 | 82 | | if (ExpressRouteCircuit != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("expressRouteCircuit"); |
| 0 | 85 | | writer.WriteObjectValue(ExpressRouteCircuit); |
| | 86 | | } |
| 0 | 87 | | if (ServiceProviderProvisioningState != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("serviceProviderProvisioningState"); |
| 0 | 90 | | writer.WriteStringValue(ServiceProviderProvisioningState.Value.ToString()); |
| | 91 | | } |
| 0 | 92 | | if (ServiceProviderNotes != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("serviceProviderNotes"); |
| 0 | 95 | | writer.WriteStringValue(ServiceProviderNotes); |
| | 96 | | } |
| 0 | 97 | | if (ProvisioningState != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("provisioningState"); |
| 0 | 100 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 101 | | } |
| 0 | 102 | | if (Peerings != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("peerings"); |
| 0 | 105 | | writer.WriteStartArray(); |
| 0 | 106 | | foreach (var item in Peerings) |
| | 107 | | { |
| 0 | 108 | | writer.WriteObjectValue(item); |
| | 109 | | } |
| 0 | 110 | | writer.WriteEndArray(); |
| | 111 | | } |
| 0 | 112 | | writer.WriteEndObject(); |
| 0 | 113 | | writer.WriteEndObject(); |
| 0 | 114 | | } |
| | 115 | |
|
| | 116 | | internal static ExpressRouteCrossConnection DeserializeExpressRouteCrossConnection(JsonElement element) |
| | 117 | | { |
| 0 | 118 | | string etag = default; |
| 0 | 119 | | string id = default; |
| 0 | 120 | | string name = default; |
| 0 | 121 | | string type = default; |
| 0 | 122 | | string location = default; |
| 0 | 123 | | IDictionary<string, string> tags = default; |
| 0 | 124 | | string primaryAzurePort = default; |
| 0 | 125 | | string secondaryAzurePort = default; |
| 0 | 126 | | int? sTag = default; |
| 0 | 127 | | string peeringLocation = default; |
| 0 | 128 | | int? bandwidthInMbps = default; |
| 0 | 129 | | ExpressRouteCircuitReference expressRouteCircuit = default; |
| 0 | 130 | | ServiceProviderProvisioningState? serviceProviderProvisioningState = default; |
| 0 | 131 | | string serviceProviderNotes = default; |
| 0 | 132 | | ProvisioningState? provisioningState = default; |
| 0 | 133 | | IList<ExpressRouteCrossConnectionPeering> peerings = default; |
| 0 | 134 | | foreach (var property in element.EnumerateObject()) |
| | 135 | | { |
| 0 | 136 | | if (property.NameEquals("etag")) |
| | 137 | | { |
| 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | etag = property.Value.GetString(); |
| 0 | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | if (property.NameEquals("id")) |
| | 146 | | { |
| 0 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 148 | | { |
| | 149 | | continue; |
| | 150 | | } |
| 0 | 151 | | id = property.Value.GetString(); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property.NameEquals("name")) |
| | 155 | | { |
| 0 | 156 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 157 | | { |
| | 158 | | continue; |
| | 159 | | } |
| 0 | 160 | | name = property.Value.GetString(); |
| 0 | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | if (property.NameEquals("type")) |
| | 164 | | { |
| 0 | 165 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 166 | | { |
| | 167 | | continue; |
| | 168 | | } |
| 0 | 169 | | type = property.Value.GetString(); |
| 0 | 170 | | continue; |
| | 171 | | } |
| 0 | 172 | | if (property.NameEquals("location")) |
| | 173 | | { |
| 0 | 174 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 175 | | { |
| | 176 | | continue; |
| | 177 | | } |
| 0 | 178 | | location = property.Value.GetString(); |
| 0 | 179 | | continue; |
| | 180 | | } |
| 0 | 181 | | if (property.NameEquals("tags")) |
| | 182 | | { |
| 0 | 183 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 184 | | { |
| | 185 | | continue; |
| | 186 | | } |
| 0 | 187 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 188 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 189 | | { |
| 0 | 190 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| 0 | 192 | | dictionary.Add(property0.Name, null); |
| | 193 | | } |
| | 194 | | else |
| | 195 | | { |
| 0 | 196 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 197 | | } |
| | 198 | | } |
| 0 | 199 | | tags = dictionary; |
| 0 | 200 | | continue; |
| | 201 | | } |
| 0 | 202 | | if (property.NameEquals("properties")) |
| | 203 | | { |
| 0 | 204 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 205 | | { |
| 0 | 206 | | if (property0.NameEquals("primaryAzurePort")) |
| | 207 | | { |
| 0 | 208 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 209 | | { |
| | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | primaryAzurePort = property0.Value.GetString(); |
| 0 | 213 | | continue; |
| | 214 | | } |
| 0 | 215 | | if (property0.NameEquals("secondaryAzurePort")) |
| | 216 | | { |
| 0 | 217 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 218 | | { |
| | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | secondaryAzurePort = property0.Value.GetString(); |
| 0 | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | if (property0.NameEquals("sTag")) |
| | 225 | | { |
| 0 | 226 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 227 | | { |
| | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | sTag = property0.Value.GetInt32(); |
| 0 | 231 | | continue; |
| | 232 | | } |
| 0 | 233 | | if (property0.NameEquals("peeringLocation")) |
| | 234 | | { |
| 0 | 235 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | peeringLocation = property0.Value.GetString(); |
| 0 | 240 | | continue; |
| | 241 | | } |
| 0 | 242 | | if (property0.NameEquals("bandwidthInMbps")) |
| | 243 | | { |
| 0 | 244 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | bandwidthInMbps = property0.Value.GetInt32(); |
| 0 | 249 | | continue; |
| | 250 | | } |
| 0 | 251 | | if (property0.NameEquals("expressRouteCircuit")) |
| | 252 | | { |
| 0 | 253 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | expressRouteCircuit = ExpressRouteCircuitReference.DeserializeExpressRouteCircuitReference(p |
| 0 | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | if (property0.NameEquals("serviceProviderProvisioningState")) |
| | 261 | | { |
| 0 | 262 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | serviceProviderProvisioningState = new ServiceProviderProvisioningState(property0.Value.GetS |
| 0 | 267 | | continue; |
| | 268 | | } |
| 0 | 269 | | if (property0.NameEquals("serviceProviderNotes")) |
| | 270 | | { |
| 0 | 271 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| | 273 | | continue; |
| | 274 | | } |
| 0 | 275 | | serviceProviderNotes = property0.Value.GetString(); |
| 0 | 276 | | continue; |
| | 277 | | } |
| 0 | 278 | | if (property0.NameEquals("provisioningState")) |
| | 279 | | { |
| 0 | 280 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 281 | | { |
| | 282 | | continue; |
| | 283 | | } |
| 0 | 284 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 285 | | continue; |
| | 286 | | } |
| 0 | 287 | | if (property0.NameEquals("peerings")) |
| | 288 | | { |
| 0 | 289 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 290 | | { |
| | 291 | | continue; |
| | 292 | | } |
| 0 | 293 | | List<ExpressRouteCrossConnectionPeering> array = new List<ExpressRouteCrossConnectionPeering |
| 0 | 294 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 295 | | { |
| 0 | 296 | | if (item.ValueKind == JsonValueKind.Null) |
| | 297 | | { |
| 0 | 298 | | array.Add(null); |
| | 299 | | } |
| | 300 | | else |
| | 301 | | { |
| 0 | 302 | | array.Add(ExpressRouteCrossConnectionPeering.DeserializeExpressRouteCrossConnectionP |
| | 303 | | } |
| | 304 | | } |
| 0 | 305 | | peerings = array; |
| | 306 | | continue; |
| | 307 | | } |
| | 308 | | } |
| | 309 | | continue; |
| | 310 | | } |
| | 311 | | } |
| 0 | 312 | | return new ExpressRouteCrossConnection(id, name, type, location, tags, etag, primaryAzurePort, secondaryAzur |
| | 313 | | } |
| | 314 | | } |
| | 315 | | } |