| | 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 ServiceEndpointPropertiesFormat : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Service != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("service"); |
| 0 | 22 | | writer.WriteStringValue(Service); |
| | 23 | | } |
| 0 | 24 | | if (Locations != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("locations"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in Locations) |
| | 29 | | { |
| 0 | 30 | | writer.WriteStringValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 0 | 34 | | if (ProvisioningState != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("provisioningState"); |
| 0 | 37 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 38 | | } |
| 0 | 39 | | writer.WriteEndObject(); |
| 0 | 40 | | } |
| | 41 | |
|
| | 42 | | internal static ServiceEndpointPropertiesFormat DeserializeServiceEndpointPropertiesFormat(JsonElement element) |
| | 43 | | { |
| 0 | 44 | | string service = default; |
| 0 | 45 | | IList<string> locations = default; |
| 0 | 46 | | ProvisioningState? provisioningState = default; |
| 0 | 47 | | foreach (var property in element.EnumerateObject()) |
| | 48 | | { |
| 0 | 49 | | if (property.NameEquals("service")) |
| | 50 | | { |
| 0 | 51 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 52 | | { |
| | 53 | | continue; |
| | 54 | | } |
| 0 | 55 | | service = property.Value.GetString(); |
| 0 | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | if (property.NameEquals("locations")) |
| | 59 | | { |
| 0 | 60 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | List<string> array = new List<string>(); |
| 0 | 65 | | foreach (var item in property.Value.EnumerateArray()) |
| | 66 | | { |
| 0 | 67 | | if (item.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| 0 | 69 | | array.Add(null); |
| | 70 | | } |
| | 71 | | else |
| | 72 | | { |
| 0 | 73 | | array.Add(item.GetString()); |
| | 74 | | } |
| | 75 | | } |
| 0 | 76 | | locations = array; |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("provisioningState")) |
| | 80 | | { |
| 0 | 81 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | provisioningState = new ProvisioningState(property.Value.GetString()); |
| | 86 | | continue; |
| | 87 | | } |
| | 88 | | } |
| 0 | 89 | | return new ServiceEndpointPropertiesFormat(service, locations, provisioningState); |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |