| | 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.KeyVault.Models |
| | 13 | | { |
| | 14 | | public partial class PrivateLinkResource : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("properties"); |
| 0 | 20 | | writer.WriteStartObject(); |
| 0 | 21 | | if (Optional.IsCollectionDefined(RequiredZoneNames)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("requiredZoneNames"); |
| 0 | 24 | | writer.WriteStartArray(); |
| 0 | 25 | | foreach (var item in RequiredZoneNames) |
| | 26 | | { |
| 0 | 27 | | writer.WriteStringValue(item); |
| | 28 | | } |
| 0 | 29 | | writer.WriteEndArray(); |
| | 30 | | } |
| 0 | 31 | | writer.WriteEndObject(); |
| 0 | 32 | | writer.WriteEndObject(); |
| 0 | 33 | | } |
| | 34 | |
|
| | 35 | | internal static PrivateLinkResource DeserializePrivateLinkResource(JsonElement element) |
| | 36 | | { |
| 0 | 37 | | Optional<string> id = default; |
| 0 | 38 | | Optional<string> name = default; |
| 0 | 39 | | Optional<string> type = default; |
| 0 | 40 | | Optional<string> location = default; |
| 0 | 41 | | Optional<IReadOnlyDictionary<string, string>> tags = default; |
| 0 | 42 | | Optional<string> groupId = default; |
| 0 | 43 | | Optional<IReadOnlyList<string>> requiredMembers = default; |
| 0 | 44 | | Optional<IList<string>> requiredZoneNames = default; |
| 0 | 45 | | foreach (var property in element.EnumerateObject()) |
| | 46 | | { |
| 0 | 47 | | if (property.NameEquals("id")) |
| | 48 | | { |
| 0 | 49 | | id = property.Value.GetString(); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("name")) |
| | 53 | | { |
| 0 | 54 | | name = property.Value.GetString(); |
| 0 | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | if (property.NameEquals("type")) |
| | 58 | | { |
| 0 | 59 | | type = property.Value.GetString(); |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("location")) |
| | 63 | | { |
| 0 | 64 | | location = property.Value.GetString(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("tags")) |
| | 68 | | { |
| 0 | 69 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 70 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 71 | | { |
| 0 | 72 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 73 | | } |
| 0 | 74 | | tags = dictionary; |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("properties")) |
| | 78 | | { |
| 0 | 79 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 80 | | { |
| 0 | 81 | | if (property0.NameEquals("groupId")) |
| | 82 | | { |
| 0 | 83 | | groupId = property0.Value.GetString(); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property0.NameEquals("requiredMembers")) |
| | 87 | | { |
| 0 | 88 | | List<string> array = new List<string>(); |
| 0 | 89 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 90 | | { |
| 0 | 91 | | array.Add(item.GetString()); |
| | 92 | | } |
| 0 | 93 | | requiredMembers = array; |
| 0 | 94 | | continue; |
| | 95 | | } |
| 0 | 96 | | if (property0.NameEquals("requiredZoneNames")) |
| | 97 | | { |
| 0 | 98 | | List<string> array = new List<string>(); |
| 0 | 99 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 100 | | { |
| 0 | 101 | | array.Add(item.GetString()); |
| | 102 | | } |
| 0 | 103 | | requiredZoneNames = array; |
| | 104 | | continue; |
| | 105 | | } |
| | 106 | | } |
| | 107 | | continue; |
| | 108 | | } |
| | 109 | | } |
| 0 | 110 | | return new PrivateLinkResource(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags) |
| | 111 | | } |
| | 112 | | } |
| | 113 | | } |