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