| | 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 PrivateLinkService : 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 (LoadBalancerFrontendIpConfigurations != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("loadBalancerFrontendIpConfigurations"); |
| 0 | 60 | | writer.WriteStartArray(); |
| 0 | 61 | | foreach (var item in LoadBalancerFrontendIpConfigurations) |
| | 62 | | { |
| 0 | 63 | | writer.WriteObjectValue(item); |
| | 64 | | } |
| 0 | 65 | | writer.WriteEndArray(); |
| | 66 | | } |
| 0 | 67 | | if (IpConfigurations != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("ipConfigurations"); |
| 0 | 70 | | writer.WriteStartArray(); |
| 0 | 71 | | foreach (var item in IpConfigurations) |
| | 72 | | { |
| 0 | 73 | | writer.WriteObjectValue(item); |
| | 74 | | } |
| 0 | 75 | | writer.WriteEndArray(); |
| | 76 | | } |
| 0 | 77 | | if (NetworkInterfaces != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("networkInterfaces"); |
| 0 | 80 | | writer.WriteStartArray(); |
| 0 | 81 | | foreach (var item in NetworkInterfaces) |
| | 82 | | { |
| 0 | 83 | | writer.WriteObjectValue(item); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndArray(); |
| | 86 | | } |
| 0 | 87 | | if (ProvisioningState != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("provisioningState"); |
| 0 | 90 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 91 | | } |
| 0 | 92 | | if (PrivateEndpointConnections != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("privateEndpointConnections"); |
| 0 | 95 | | writer.WriteStartArray(); |
| 0 | 96 | | foreach (var item in PrivateEndpointConnections) |
| | 97 | | { |
| 0 | 98 | | writer.WriteObjectValue(item); |
| | 99 | | } |
| 0 | 100 | | writer.WriteEndArray(); |
| | 101 | | } |
| 0 | 102 | | if (Visibility != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("visibility"); |
| 0 | 105 | | writer.WriteObjectValue(Visibility); |
| | 106 | | } |
| 0 | 107 | | if (AutoApproval != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("autoApproval"); |
| 0 | 110 | | writer.WriteObjectValue(AutoApproval); |
| | 111 | | } |
| 0 | 112 | | if (Fqdns != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("fqdns"); |
| 0 | 115 | | writer.WriteStartArray(); |
| 0 | 116 | | foreach (var item in Fqdns) |
| | 117 | | { |
| 0 | 118 | | writer.WriteStringValue(item); |
| | 119 | | } |
| 0 | 120 | | writer.WriteEndArray(); |
| | 121 | | } |
| 0 | 122 | | if (Alias != null) |
| | 123 | | { |
| 0 | 124 | | writer.WritePropertyName("alias"); |
| 0 | 125 | | writer.WriteStringValue(Alias); |
| | 126 | | } |
| 0 | 127 | | if (EnableProxyProtocol != null) |
| | 128 | | { |
| 0 | 129 | | writer.WritePropertyName("enableProxyProtocol"); |
| 0 | 130 | | writer.WriteBooleanValue(EnableProxyProtocol.Value); |
| | 131 | | } |
| 0 | 132 | | writer.WriteEndObject(); |
| 0 | 133 | | writer.WriteEndObject(); |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | internal static PrivateLinkService DeserializePrivateLinkService(JsonElement element) |
| | 137 | | { |
| 0 | 138 | | string etag = default; |
| 0 | 139 | | string id = default; |
| 0 | 140 | | string name = default; |
| 0 | 141 | | string type = default; |
| 0 | 142 | | string location = default; |
| 0 | 143 | | IDictionary<string, string> tags = default; |
| 0 | 144 | | IList<FrontendIPConfiguration> loadBalancerFrontendIpConfigurations = default; |
| 0 | 145 | | IList<PrivateLinkServiceIpConfiguration> ipConfigurations = default; |
| 0 | 146 | | IList<NetworkInterface> networkInterfaces = default; |
| 0 | 147 | | ProvisioningState? provisioningState = default; |
| 0 | 148 | | IList<PrivateEndpointConnection> privateEndpointConnections = default; |
| 0 | 149 | | ResourceSet visibility = default; |
| 0 | 150 | | ResourceSet autoApproval = default; |
| 0 | 151 | | IList<string> fqdns = default; |
| 0 | 152 | | string @alias = default; |
| 0 | 153 | | bool? enableProxyProtocol = default; |
| 0 | 154 | | foreach (var property in element.EnumerateObject()) |
| | 155 | | { |
| 0 | 156 | | if (property.NameEquals("etag")) |
| | 157 | | { |
| 0 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | etag = property.Value.GetString(); |
| 0 | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | if (property.NameEquals("id")) |
| | 166 | | { |
| 0 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | id = property.Value.GetString(); |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property.NameEquals("name")) |
| | 175 | | { |
| 0 | 176 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | name = property.Value.GetString(); |
| 0 | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | if (property.NameEquals("type")) |
| | 184 | | { |
| 0 | 185 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | type = property.Value.GetString(); |
| 0 | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | if (property.NameEquals("location")) |
| | 193 | | { |
| 0 | 194 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | location = property.Value.GetString(); |
| 0 | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | if (property.NameEquals("tags")) |
| | 202 | | { |
| 0 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 208 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 209 | | { |
| 0 | 210 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| 0 | 212 | | dictionary.Add(property0.Name, null); |
| | 213 | | } |
| | 214 | | else |
| | 215 | | { |
| 0 | 216 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 217 | | } |
| | 218 | | } |
| 0 | 219 | | tags = dictionary; |
| 0 | 220 | | continue; |
| | 221 | | } |
| 0 | 222 | | if (property.NameEquals("properties")) |
| | 223 | | { |
| 0 | 224 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 225 | | { |
| 0 | 226 | | if (property0.NameEquals("loadBalancerFrontendIpConfigurations")) |
| | 227 | | { |
| 0 | 228 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | List<FrontendIPConfiguration> array = new List<FrontendIPConfiguration>(); |
| 0 | 233 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 234 | | { |
| 0 | 235 | | if (item.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| 0 | 237 | | array.Add(null); |
| | 238 | | } |
| | 239 | | else |
| | 240 | | { |
| 0 | 241 | | array.Add(FrontendIPConfiguration.DeserializeFrontendIPConfiguration(item)); |
| | 242 | | } |
| | 243 | | } |
| 0 | 244 | | loadBalancerFrontendIpConfigurations = array; |
| 0 | 245 | | continue; |
| | 246 | | } |
| 0 | 247 | | if (property0.NameEquals("ipConfigurations")) |
| | 248 | | { |
| 0 | 249 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 250 | | { |
| | 251 | | continue; |
| | 252 | | } |
| 0 | 253 | | List<PrivateLinkServiceIpConfiguration> array = new List<PrivateLinkServiceIpConfiguration>( |
| 0 | 254 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 255 | | { |
| 0 | 256 | | if (item.ValueKind == JsonValueKind.Null) |
| | 257 | | { |
| 0 | 258 | | array.Add(null); |
| | 259 | | } |
| | 260 | | else |
| | 261 | | { |
| 0 | 262 | | array.Add(PrivateLinkServiceIpConfiguration.DeserializePrivateLinkServiceIpConfigura |
| | 263 | | } |
| | 264 | | } |
| 0 | 265 | | ipConfigurations = array; |
| 0 | 266 | | continue; |
| | 267 | | } |
| 0 | 268 | | if (property0.NameEquals("networkInterfaces")) |
| | 269 | | { |
| 0 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | List<NetworkInterface> array = new List<NetworkInterface>(); |
| 0 | 275 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 276 | | { |
| 0 | 277 | | if (item.ValueKind == JsonValueKind.Null) |
| | 278 | | { |
| 0 | 279 | | array.Add(null); |
| | 280 | | } |
| | 281 | | else |
| | 282 | | { |
| 0 | 283 | | array.Add(NetworkInterface.DeserializeNetworkInterface(item)); |
| | 284 | | } |
| | 285 | | } |
| 0 | 286 | | networkInterfaces = array; |
| 0 | 287 | | continue; |
| | 288 | | } |
| 0 | 289 | | if (property0.NameEquals("provisioningState")) |
| | 290 | | { |
| 0 | 291 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 292 | | { |
| | 293 | | continue; |
| | 294 | | } |
| 0 | 295 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 296 | | continue; |
| | 297 | | } |
| 0 | 298 | | if (property0.NameEquals("privateEndpointConnections")) |
| | 299 | | { |
| 0 | 300 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 301 | | { |
| | 302 | | continue; |
| | 303 | | } |
| 0 | 304 | | List<PrivateEndpointConnection> array = new List<PrivateEndpointConnection>(); |
| 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(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item)); |
| | 314 | | } |
| | 315 | | } |
| 0 | 316 | | privateEndpointConnections = array; |
| 0 | 317 | | continue; |
| | 318 | | } |
| 0 | 319 | | if (property0.NameEquals("visibility")) |
| | 320 | | { |
| 0 | 321 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 322 | | { |
| | 323 | | continue; |
| | 324 | | } |
| 0 | 325 | | visibility = ResourceSet.DeserializeResourceSet(property0.Value); |
| 0 | 326 | | continue; |
| | 327 | | } |
| 0 | 328 | | if (property0.NameEquals("autoApproval")) |
| | 329 | | { |
| 0 | 330 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 331 | | { |
| | 332 | | continue; |
| | 333 | | } |
| 0 | 334 | | autoApproval = ResourceSet.DeserializeResourceSet(property0.Value); |
| 0 | 335 | | continue; |
| | 336 | | } |
| 0 | 337 | | if (property0.NameEquals("fqdns")) |
| | 338 | | { |
| 0 | 339 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 340 | | { |
| | 341 | | continue; |
| | 342 | | } |
| 0 | 343 | | List<string> array = new List<string>(); |
| 0 | 344 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 345 | | { |
| 0 | 346 | | if (item.ValueKind == JsonValueKind.Null) |
| | 347 | | { |
| 0 | 348 | | array.Add(null); |
| | 349 | | } |
| | 350 | | else |
| | 351 | | { |
| 0 | 352 | | array.Add(item.GetString()); |
| | 353 | | } |
| | 354 | | } |
| 0 | 355 | | fqdns = array; |
| 0 | 356 | | continue; |
| | 357 | | } |
| 0 | 358 | | if (property0.NameEquals("alias")) |
| | 359 | | { |
| 0 | 360 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 361 | | { |
| | 362 | | continue; |
| | 363 | | } |
| 0 | 364 | | @alias = property0.Value.GetString(); |
| 0 | 365 | | continue; |
| | 366 | | } |
| 0 | 367 | | if (property0.NameEquals("enableProxyProtocol")) |
| | 368 | | { |
| 0 | 369 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 370 | | { |
| | 371 | | continue; |
| | 372 | | } |
| 0 | 373 | | enableProxyProtocol = property0.Value.GetBoolean(); |
| | 374 | | continue; |
| | 375 | | } |
| | 376 | | } |
| | 377 | | continue; |
| | 378 | | } |
| | 379 | | } |
| 0 | 380 | | return new PrivateLinkService(id, name, type, location, tags, etag, loadBalancerFrontendIpConfigurations, ip |
| | 381 | | } |
| | 382 | | } |
| | 383 | | } |