| | 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.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class PrivateLinkResource : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 0 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("properties"); |
| 0 | 35 | | writer.WriteStartObject(); |
| 0 | 36 | | if (GroupId != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("groupId"); |
| 0 | 39 | | writer.WriteStringValue(GroupId); |
| | 40 | | } |
| 0 | 41 | | if (RequiredMembers != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("requiredMembers"); |
| 0 | 44 | | writer.WriteStartArray(); |
| 0 | 45 | | foreach (var item in RequiredMembers) |
| | 46 | | { |
| 0 | 47 | | writer.WriteStringValue(item); |
| | 48 | | } |
| 0 | 49 | | writer.WriteEndArray(); |
| | 50 | | } |
| 0 | 51 | | if (RequiredZoneNames != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("requiredZoneNames"); |
| 0 | 54 | | writer.WriteStartArray(); |
| 0 | 55 | | foreach (var item in RequiredZoneNames) |
| | 56 | | { |
| 0 | 57 | | writer.WriteStringValue(item); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 0 | 61 | | writer.WriteEndObject(); |
| 0 | 62 | | writer.WriteEndObject(); |
| 0 | 63 | | } |
| | 64 | |
|
| | 65 | | internal static PrivateLinkResource DeserializePrivateLinkResource(JsonElement element) |
| | 66 | | { |
| 24 | 67 | | string id = default; |
| 24 | 68 | | string name = default; |
| 24 | 69 | | string type = default; |
| 24 | 70 | | string groupId = default; |
| 24 | 71 | | IList<string> requiredMembers = default; |
| 24 | 72 | | IList<string> requiredZoneNames = default; |
| 240 | 73 | | foreach (var property in element.EnumerateObject()) |
| | 74 | | { |
| 96 | 75 | | if (property.NameEquals("id")) |
| | 76 | | { |
| 24 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 24 | 81 | | id = property.Value.GetString(); |
| 24 | 82 | | continue; |
| | 83 | | } |
| 72 | 84 | | if (property.NameEquals("name")) |
| | 85 | | { |
| 24 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 24 | 90 | | name = property.Value.GetString(); |
| 24 | 91 | | continue; |
| | 92 | | } |
| 48 | 93 | | if (property.NameEquals("type")) |
| | 94 | | { |
| 24 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 24 | 99 | | type = property.Value.GetString(); |
| 24 | 100 | | continue; |
| | 101 | | } |
| 24 | 102 | | if (property.NameEquals("properties")) |
| | 103 | | { |
| 192 | 104 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 105 | | { |
| 72 | 106 | | if (property0.NameEquals("groupId")) |
| | 107 | | { |
| 24 | 108 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 24 | 112 | | groupId = property0.Value.GetString(); |
| 24 | 113 | | continue; |
| | 114 | | } |
| 48 | 115 | | if (property0.NameEquals("requiredMembers")) |
| | 116 | | { |
| 24 | 117 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 24 | 121 | | List<string> array = new List<string>(); |
| 96 | 122 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 123 | | { |
| 24 | 124 | | if (item.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| 0 | 126 | | array.Add(null); |
| | 127 | | } |
| | 128 | | else |
| | 129 | | { |
| 24 | 130 | | array.Add(item.GetString()); |
| | 131 | | } |
| | 132 | | } |
| 24 | 133 | | requiredMembers = array; |
| 24 | 134 | | continue; |
| | 135 | | } |
| 24 | 136 | | if (property0.NameEquals("requiredZoneNames")) |
| | 137 | | { |
| 24 | 138 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 24 | 142 | | List<string> array = new List<string>(); |
| 96 | 143 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 144 | | { |
| 24 | 145 | | if (item.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| 0 | 147 | | array.Add(null); |
| | 148 | | } |
| | 149 | | else |
| | 150 | | { |
| 24 | 151 | | array.Add(item.GetString()); |
| | 152 | | } |
| | 153 | | } |
| 24 | 154 | | requiredZoneNames = array; |
| | 155 | | continue; |
| | 156 | | } |
| | 157 | | } |
| | 158 | | continue; |
| | 159 | | } |
| | 160 | | } |
| 24 | 161 | | return new PrivateLinkResource(id, name, type, groupId, requiredMembers, requiredZoneNames); |
| | 162 | | } |
| | 163 | | } |
| | 164 | | } |