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